1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * OnePlus 5(T) (cheeseburger / dumpling) common device tree source based on msm8998-mtp.dtsi
4 *
5 * Copyright (c) 2021, Jami Kettunen <jamipkettunen@gmail.com>
6 * Copyright (c) 2016, The Linux Foundation. All rights reserved.
7 */
8
9/dts-v1/;
10
11#include <dt-bindings/gpio/gpio.h>
12#include <dt-bindings/pinctrl/qcom,pmic-gpio.h>
13#include "msm8998.dtsi"
14#include "pm8005.dtsi"
15#include "pm8998.dtsi"
16#include "pmi8998.dtsi"
17
18/ {
19	/* Required for bootloader to select correct board */
20	qcom,msm-id = <292 0x20001>; /* 8998 v2.1 */
21
22	chosen {
23		#address-cells = <2>;
24		#size-cells = <2>;
25		ranges;
26
27		/* Use display framebuffer setup by the UEFI XBL bootloader for simplefb */
28		framebuffer0: framebuffer@9d400000 {
29			compatible = "simple-framebuffer";
30			reg = <0x0 0x9d400000 0x0 0x2400000>;
31			width = <1080>;
32			height = <1920>;
33			stride = <(1080 * 4)>;
34			format = "a8r8g8b8";
35		};
36	};
37
38	reserved-memory {
39		/* Bootloader display framebuffer region */
40		cont_splash_mem: memory@9d400000 {
41			reg = <0x0 0x9d400000 0x0 0x2400000>;
42			no-map;
43		};
44
45		/* For getting crash logs using Android downstream kernels */
46		ramoops@ac000000 {
47			compatible = "ramoops";
48			reg = <0x0 0xac000000 0x0 0x200000>;
49			console-size = <0x80000>;
50			pmsg-size = <0x40000>;
51			record-size = <0x8000>;
52			ftrace-size = <0x20000>;
53		};
54
55		/*
56		 * The following memory regions on downstream are "dynamically allocated"
57		 * but given the same addresses every time. Hard code them as these addresses
58		 * are where the OnePlus signed firmware expects them to be.
59		 */
60		ipa_fws_region: ipa@f6800000 {
61			compatible = "shared-dma-pool";
62			reg = <0x0 0xf6800000 0x0 0x5000>;
63			no-map;
64		};
65		zap_shader_region: gpu@f6900000 {
66			compatible = "shared-dma-pool";
67			reg = <0x0 0xf6900000 0x0 0x2000>;
68			no-map;
69		};
70	};
71
72	gpio-keys {
73		compatible = "gpio-keys";
74		label = "Volume buttons";
75		autorepeat;
76
77		pinctrl-names = "default";
78		pinctrl-0 = <&vol_keys_default>;
79
80		vol-down {
81			label = "Volume down";
82			gpios = <&pm8998_gpio 5 GPIO_ACTIVE_LOW>;
83			linux,code = <KEY_VOLUMEDOWN>;
84			debounce-interval = <15>;
85			wakeup-source;
86		};
87
88		vol-up {
89			label = "Volume up";
90			gpios = <&pm8998_gpio 6 GPIO_ACTIVE_LOW>;
91			linux,code = <KEY_VOLUMEUP>;
92			debounce-interval = <15>;
93			wakeup-source;
94		};
95	};
96
97	gpio-hall-sensor {
98		compatible = "gpio-keys";
99		label = "Hall effect sensor";
100
101		pinctrl-names = "default";
102		pinctrl-0 = <&hall_sensor_default>;
103
104		hall-sensor {
105			label = "Hall Effect Sensor";
106			gpios = <&tlmm 124 GPIO_ACTIVE_LOW>;
107			linux,input-type = <EV_SW>;
108			linux,code = <SW_LID>;
109			linux,can-disable;
110			wakeup-source;
111		};
112	};
113
114	vph_pwr: vph-pwr-regulator {
115		compatible = "regulator-fixed";
116		regulator-name = "vph_pwr";
117		regulator-always-on;
118		regulator-boot-on;
119	};
120};
121
122/*
123 * OnePlus' ADSP firmware requires 30 MiB in total, so increase the adsp_mem
124 * region by 4 MiB to account for this while relocating the other now
125 * conflicting memory nodes accordingly.
126 */
127&adsp_mem {
128	reg = <0x0 0x8b200000 0x0 0x1e00000>;
129};
130&mpss_mem {
131	reg = <0x0 0x8d000000 0x0 0x7000000>;
132};
133&venus_mem {
134	reg = <0x0 0x94000000 0x0 0x500000>;
135};
136&mba_mem {
137	reg = <0x0 0x94500000 0x0 0x200000>;
138};
139&slpi_mem {
140	reg = <0x0 0x94700000 0x0 0xf00000>;
141};
142&ipa_fw_mem {
143	reg = <0x0 0x95600000 0x0 0x10000>;
144};
145&ipa_gsi_mem {
146	reg = <0x0 0x95610000 0x0 0x5000>;
147};
148&gpu_mem {
149	reg = <0x0 0x95615000 0x0 0x100000>;
150};
151&wlan_msa_mem {
152	reg = <0x0 0x95715000 0x0 0x100000>;
153};
154
155&blsp1_i2c5 {
156	status = "okay";
157
158	touchscreen@20 {
159		compatible = "syna,rmi4-i2c";
160		reg = <0x20>;
161		#address-cells = <1>;
162		#size-cells = <0>;
163
164		interrupt-parent = <&tlmm>;
165		interrupts = <125 IRQ_TYPE_EDGE_FALLING>;
166
167		pinctrl-names = "default";
168		pinctrl-0 = <&ts_int_active &ts_reset_active>;
169
170		vdd-supply = <&vreg_l28_3p0>;
171		vio-supply = <&vreg_l6a_1p8>;
172
173		syna,reset-delay-ms = <20>;
174		syna,startup-delay-ms = <20>;
175
176		rmi4-f01@1 {
177			reg = <0x01>;
178			syna,nosleep-mode = <1>;
179		};
180
181		rmi4_f12: rmi4-f12@12 {
182			reg = <0x12>;
183			syna,rezero-wait-ms = <20>;
184			syna,sensor-type = <1>;
185			touchscreen-x-mm = <68>;
186			touchscreen-y-mm = <122>;
187		};
188	};
189};
190
191&blsp1_i2c6 {
192	status = "okay";
193
194	nfc@28 {
195		compatible = "nxp,nxp-nci-i2c";
196		reg = <0x28>;
197
198		interrupt-parent = <&tlmm>;
199		interrupts = <92 IRQ_TYPE_LEVEL_HIGH>;
200
201		enable-gpios = <&tlmm 116 GPIO_ACTIVE_HIGH>;
202
203		pinctrl-names = "default";
204		pinctrl-0 = <&nfc_int_active &nfc_enable_active>;
205	};
206};
207
208&blsp1_uart3 {
209	status = "okay";
210
211	bluetooth {
212		compatible = "qcom,wcn3990-bt";
213
214		vddio-supply = <&vreg_s4a_1p8>;
215		vddxo-supply = <&vreg_l7a_1p8>;
216		vddrf-supply = <&vreg_l17a_1p3>;
217		vddch0-supply = <&vreg_l25a_3p3>;
218		max-speed = <3200000>;
219	};
220};
221
222&blsp1_uart3_on {
223	rx {
224		/delete-property/ bias-disable;
225		/*
226		 * Configure a pull-up on 46 (RX). This is needed to
227		 * avoid garbage data when the TX pin of the Bluetooth
228		 * module is in tri-state (module powered off or not
229		 * driving the signal yet).
230		 */
231		bias-pull-up;
232	};
233
234	cts {
235		/delete-property/ bias-disable;
236		/*
237		 * Configure a pull-down on 47 (CTS) to match the pull
238		 * of the Bluetooth module.
239		 */
240		bias-pull-down;
241	};
242};
243
244&blsp2_uart1 {
245	status = "okay";
246};
247
248&pm8005_regulators {
249	/* VDD_GFX supply */
250	pm8005_s1: s1 {
251		regulator-min-microvolt = <524000>;
252		regulator-max-microvolt = <1100000>;
253		regulator-enable-ramp-delay = <500>;
254		/* Hack until we rig up the gpu consumer */
255		regulator-always-on;
256	};
257};
258
259&pm8998_gpio {
260	vol_keys_default: vol-keys-default {
261		pins = "gpio5", "gpio6";
262		function = "normal";
263		bias-pull-up;
264		input-enable;
265		qcom,drive-strength = <PMIC_GPIO_STRENGTH_NO>;
266	};
267};
268
269&qusb2phy {
270	status = "okay";
271
272	vdd-supply = <&vreg_l1a_0p875>;
273	vdda-pll-supply = <&vreg_l12a_1p8>;
274	vdda-phy-dpdm-supply = <&vreg_l24a_3p075>;
275};
276
277&rpm_requests {
278	pm8998-regulators {
279		compatible = "qcom,rpm-pm8998-regulators";
280
281		vdd_s1-supply = <&vph_pwr>;
282		vdd_s2-supply = <&vph_pwr>;
283		vdd_s3-supply = <&vph_pwr>;
284		vdd_s4-supply = <&vph_pwr>;
285		vdd_s5-supply = <&vph_pwr>;
286		vdd_s6-supply = <&vph_pwr>;
287		vdd_s7-supply = <&vph_pwr>;
288		vdd_s8-supply = <&vph_pwr>;
289		vdd_s9-supply = <&vph_pwr>;
290		vdd_s10-supply = <&vph_pwr>;
291		vdd_s11-supply = <&vph_pwr>;
292		vdd_s12-supply = <&vph_pwr>;
293		vdd_s13-supply = <&vph_pwr>;
294		vdd_l1_l27-supply = <&vreg_s7a_1p025>;
295		vdd_l2_l8_l17-supply = <&vreg_s3a_1p35>;
296		vdd_l3_l11-supply = <&vreg_s7a_1p025>;
297		vdd_l4_l5-supply = <&vreg_s7a_1p025>;
298		vdd_l6-supply = <&vreg_s5a_2p04>;
299		vdd_l7_l12_l14_l15-supply = <&vreg_s5a_2p04>;
300		vdd_l9-supply = <&vreg_bob>;
301		vdd_l10_l23_l25-supply = <&vreg_bob>;
302		vdd_l13_l19_l21-supply = <&vreg_bob>;
303		vdd_l16_l28-supply = <&vreg_bob>;
304		vdd_l18_l22-supply = <&vreg_bob>;
305		vdd_l20_l24-supply = <&vreg_bob>;
306		vdd_l26-supply = <&vreg_s3a_1p35>;
307		vdd_lvs1_lvs2-supply = <&vreg_s4a_1p8>;
308
309		vreg_s3a_1p35: s3 {
310			regulator-min-microvolt = <1352000>;
311			regulator-max-microvolt = <1352000>;
312		};
313
314		vreg_s4a_1p8: s4 {
315			regulator-min-microvolt = <1800000>;
316			regulator-max-microvolt = <1800000>;
317			regulator-allow-set-load;
318		};
319
320		vreg_s5a_2p04: s5 {
321			regulator-min-microvolt = <1904000>;
322			regulator-max-microvolt = <2040000>;
323		};
324
325		vreg_s7a_1p025: s7 {
326			regulator-min-microvolt = <900000>;
327			regulator-max-microvolt = <1028000>;
328		};
329
330		vreg_l1a_0p875: l1 {
331			regulator-min-microvolt = <880000>;
332			regulator-max-microvolt = <880000>;
333		};
334
335		vreg_l2a_1p2: l2 {
336			regulator-min-microvolt = <1200000>;
337			regulator-max-microvolt = <1200000>;
338		};
339
340		vreg_l3a_1p0: l3 {
341			regulator-min-microvolt = <1000000>;
342			regulator-max-microvolt = <1000000>;
343		};
344
345		vreg_l5a_0p8: l5 {
346			regulator-min-microvolt = <800000>;
347			regulator-max-microvolt = <800000>;
348		};
349
350		vreg_l6a_1p8: l6 {
351			regulator-min-microvolt = <1808000>;
352			regulator-max-microvolt = <1808000>;
353		};
354
355		vreg_l7a_1p8: l7 {
356			regulator-min-microvolt = <1800000>;
357			regulator-max-microvolt = <1800000>;
358		};
359
360		vreg_l8a_1p2: l8 {
361			regulator-min-microvolt = <1200000>;
362			regulator-max-microvolt = <1200000>;
363		};
364
365		vreg_l9a_1p8: l9 {
366			regulator-min-microvolt = <1808000>;
367			regulator-max-microvolt = <2960000>;
368		};
369
370		vreg_l10a_1p8: l10 {
371			regulator-min-microvolt = <1808000>;
372			regulator-max-microvolt = <2960000>;
373		};
374
375		vreg_l11a_1p0: l11 {
376			regulator-min-microvolt = <1000000>;
377			regulator-max-microvolt = <1000000>;
378		};
379
380		vreg_l12a_1p8: l12 {
381			regulator-min-microvolt = <1800000>;
382			regulator-max-microvolt = <1800000>;
383		};
384
385		vreg_l13a_2p95: l13 {
386			regulator-min-microvolt = <1808000>;
387			regulator-max-microvolt = <2960000>;
388		};
389
390		vreg_l14a_1p88: l14 {
391			regulator-min-microvolt = <1880000>;
392			regulator-max-microvolt = <1880000>;
393		};
394
395		vreg_l15a_1p8: l15 {
396			regulator-min-microvolt = <1800000>;
397			regulator-max-microvolt = <1800000>;
398		};
399
400		vreg_l16a_2p7: l16 {
401			regulator-min-microvolt = <2704000>;
402			regulator-max-microvolt = <2704000>;
403		};
404
405		vreg_l17a_1p3: l17 {
406			regulator-min-microvolt = <1304000>;
407			regulator-max-microvolt = <1304000>;
408		};
409
410		vreg_l18a_2p7: l18 {
411			regulator-min-microvolt = <2704000>;
412			regulator-max-microvolt = <2704000>;
413		};
414
415		vreg_l19a_3p0: l19 {
416			regulator-min-microvolt = <3008000>;
417			regulator-max-microvolt = <3008000>;
418		};
419
420		vreg_l20a_2p95: l20 {
421			regulator-min-microvolt = <2960000>;
422			regulator-max-microvolt = <2960000>;
423			regulator-allow-set-load;
424		};
425		vreg_l21a_2p95: l21 {
426			regulator-min-microvolt = <2960000>;
427			regulator-max-microvolt = <2960000>;
428			regulator-system-load = <800000>;
429			regulator-allow-set-load;
430		};
431
432		vreg_l22a_2p85: l22 {
433			regulator-min-microvolt = <2864000>;
434			regulator-max-microvolt = <2864000>;
435		};
436
437		vreg_l23a_3p3: l23 {
438			regulator-min-microvolt = <3312000>;
439			regulator-max-microvolt = <3312000>;
440		};
441
442		vreg_l24a_3p075: l24 {
443			regulator-min-microvolt = <3088000>;
444			regulator-max-microvolt = <3088000>;
445		};
446
447		vreg_l25a_3p3: l25 {
448			regulator-min-microvolt = <3104000>;
449			regulator-max-microvolt = <3312000>;
450		};
451
452		vreg_l26a_1p2: l26 {
453			regulator-min-microvolt = <1200000>;
454			regulator-max-microvolt = <1200000>;
455			regulator-allow-set-load;
456		};
457
458		vreg_l28_3p0: l28 {
459			regulator-min-microvolt = <3008000>;
460			regulator-max-microvolt = <3008000>;
461		};
462
463		vreg_lvs1a_1p8: lvs1 { };
464		vreg_lvs2a_1p8: lvs2 { };
465	};
466
467	pmi8998-regulators {
468		compatible = "qcom,rpm-pmi8998-regulators";
469
470		vdd_bob-supply = <&vph_pwr>;
471
472		vreg_bob: bob {
473			regulator-min-microvolt = <3312000>;
474			regulator-max-microvolt = <3600000>;
475		};
476	};
477};
478
479&tlmm {
480	gpio-reserved-ranges = <0 4>, <81 4>;
481
482	hall_sensor_default: hall-sensor-default {
483		pins = "gpio124";
484		function = "gpio";
485		drive-strength = <2>;
486		bias-disable;
487		input-enable;
488	};
489
490	ts_int_active: ts-int-active {
491		pins = "gpio125";
492		function = "gpio";
493		drive-strength = <8>;
494		bias-pull-up;
495	};
496
497	ts_reset_active: ts-reset-active {
498		pins = "gpio89";
499		function = "gpio";
500		drive-strength = <8>;
501		bias-pull-up;
502	};
503
504	nfc_int_active: nfc-int-active {
505		pins = "gpio92";
506		function = "gpio";
507		drive-strength = <6>;
508		bias-pull-up;
509	};
510
511	nfc_enable_active: nfc-enable-active {
512		pins = "gpio12", "gpio116";
513		function = "gpio";
514		drive-strength = <6>;
515		bias-pull-up;
516	};
517};
518
519&ufshc {
520	status = "okay";
521
522	vcc-supply = <&vreg_l20a_2p95>;
523	vccq-supply = <&vreg_l26a_1p2>;
524	vccq2-supply = <&vreg_s4a_1p8>;
525	vcc-max-microamp = <750000>;
526	vccq-max-microamp = <560000>;
527	vccq2-max-microamp = <750000>;
528};
529
530&ufsphy {
531	status = "okay";
532
533	vdda-phy-supply = <&vreg_l1a_0p875>;
534	vdda-pll-supply = <&vreg_l2a_1p2>;
535	vddp-ref-clk-supply = <&vreg_l26a_1p2>;
536};
537
538&usb3 {
539	status = "okay";
540
541	/* Disable USB3 clock requirement as the device only supports USB2 */
542	qcom,select-utmi-as-pipe-clk;
543};
544
545&usb3_dwc3 {
546	/* Drop the unused USB 3 PHY */
547	phys = <&qusb2phy>;
548	phy-names = "usb2-phy";
549
550	/* Fastest mode for USB 2 */
551	maximum-speed = "high-speed";
552
553	/* Force to peripheral until we can switch modes */
554	dr_mode = "peripheral";
555};
556
557&wifi {
558	/* Leave disabled until MSS is functional */
559	vdd-0.8-cx-mx-supply = <&vreg_l5a_0p8>;
560	vdd-1.8-xo-supply = <&vreg_l7a_1p8>;
561	vdd-1.3-rfa-supply = <&vreg_l17a_1p3>;
562	vdd-3.3-ch0-supply = <&vreg_l25a_3p3>;
563};
564