1// SPDX-License-Identifier: GPL-2.0
2/*
3 * SDM845 OnePlus 6(T) (enchilada / fajita) common device tree source
4 *
5 * Copyright (c) 2020, The Linux Foundation. All rights reserved.
6 */
7
8/dts-v1/;
9
10#include <dt-bindings/gpio/gpio.h>
11#include <dt-bindings/input/linux-event-codes.h>
12#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
13
14#include "sdm845.dtsi"
15#include "pm8998.dtsi"
16#include "pmi8998.dtsi"
17
18/delete-node/ &rmtfs_mem;
19
20/ {
21	aliases {
22		serial0 = &uart9;
23		hsuart0 = &uart6;
24	};
25
26	chosen {
27		stdout-path = "serial0:115200n8";
28	};
29
30	gpio-keys {
31		compatible = "gpio-keys";
32		label = "Volume keys";
33		autorepeat;
34
35		pinctrl-names = "default";
36		pinctrl-0 = <&volume_down_gpio &volume_up_gpio>;
37
38		vol-down {
39			label = "Volume down";
40			linux,code = <KEY_VOLUMEDOWN>;
41			gpios = <&pm8998_gpio 5 GPIO_ACTIVE_LOW>;
42			debounce-interval = <15>;
43		};
44
45		vol-up {
46			label = "Volume up";
47			linux,code = <KEY_VOLUMEUP>;
48			gpios = <&pm8998_gpio 6 GPIO_ACTIVE_LOW>;
49			debounce-interval = <15>;
50		};
51	};
52
53	reserved-memory {
54		/* The rmtfs_mem needs to be guarded due to "XPU limitations"
55		 * it is otherwise possible for an allocation adjacent to the
56		 * rmtfs_mem region to trigger an XPU violation, causing a crash.
57		 */
58		rmtfs_lower_guard: memory@f5b00000 {
59			no-map;
60			reg = <0 0xf5b00000 0 0x1000>;
61		};
62		/*
63		 * The rmtfs memory region in downstream is 'dynamically allocated'
64		 * but given the same address every time. Hard code it as this address is
65		 * where the modem firmware expects it to be.
66		 */
67		rmtfs_mem: memory@f5b01000 {
68			compatible = "qcom,rmtfs-mem";
69			reg = <0 0xf5b01000 0 0x200000>;
70			no-map;
71
72			qcom,client-id = <1>;
73			qcom,vmid = <15>;
74		};
75		rmtfs_upper_guard: memory@f5d01000 {
76			no-map;
77			reg = <0 0xf5d01000 0 0x1000>;
78		};
79
80		/*
81		 * It seems like reserving the old rmtfs_mem region is also needed to prevent
82		 * random crashes which are most likely modem related, more testing needed.
83		 */
84		removed_region: memory@88f00000 {
85			no-map;
86			reg = <0 0x88f00000 0 0x1c00000>;
87		};
88
89		ramoops: ramoops@ac300000 {
90			compatible = "ramoops";
91			reg = <0 0xac300000 0 0x400000>;
92			record-size = <0x40000>;
93			console-size = <0x40000>;
94			ftrace-size = <0x40000>;
95			pmsg-size = <0x200000>;
96			devinfo-size = <0x1000>;
97			ecc-size = <16>;
98		};
99	};
100
101	vph_pwr: vph-pwr-regulator {
102		compatible = "regulator-fixed";
103		regulator-name = "vph_pwr";
104		regulator-min-microvolt = <3700000>;
105		regulator-max-microvolt = <3700000>;
106	};
107
108	/*
109	 * Apparently RPMh does not provide support for PM8998 S4 because it
110	 * is always-on; model it as a fixed regulator.
111	 */
112	vreg_s4a_1p8: pm8998-smps4 {
113		compatible = "regulator-fixed";
114		regulator-name = "vreg_s4a_1p8";
115
116		regulator-min-microvolt = <1800000>;
117		regulator-max-microvolt = <1800000>;
118
119		regulator-always-on;
120		regulator-boot-on;
121
122		vin-supply = <&vph_pwr>;
123	};
124
125	/*
126	 * The touchscreen regulator seems to be controlled somehow by a gpio.
127	 * Model it as a fixed regulator and keep it on. Without schematics we
128	 * don't know how this is actually wired up...
129	 */
130	ts_1p8_supply: ts-1p8-regulator {
131		compatible = "regulator-fixed";
132		regulator-name = "ts_1p8_supply";
133
134		regulator-min-microvolt = <1800000>;
135		regulator-max-microvolt = <1800000>;
136
137		gpio = <&tlmm 88 0>;
138		enable-active-high;
139		regulator-boot-on;
140	};
141};
142
143&adsp_pas {
144	status = "okay";
145	firmware-name = "qcom/sdm845/oneplus6/adsp.mbn";
146};
147
148&apps_rsc {
149	pm8998-rpmh-regulators {
150		compatible = "qcom,pm8998-rpmh-regulators";
151		qcom,pmic-id = "a";
152
153		vdd-s1-supply = <&vph_pwr>;
154		vdd-s2-supply = <&vph_pwr>;
155		vdd-s3-supply = <&vph_pwr>;
156		vdd-s4-supply = <&vph_pwr>;
157		vdd-s5-supply = <&vph_pwr>;
158		vdd-s6-supply = <&vph_pwr>;
159		vdd-s7-supply = <&vph_pwr>;
160		vdd-s8-supply = <&vph_pwr>;
161		vdd-s9-supply = <&vph_pwr>;
162		vdd-s10-supply = <&vph_pwr>;
163		vdd-s11-supply = <&vph_pwr>;
164		vdd-s12-supply = <&vph_pwr>;
165		vdd-s13-supply = <&vph_pwr>;
166		vdd-l1-l27-supply = <&vreg_s7a_1p025>;
167		vdd-l2-l8-l17-supply = <&vreg_s3a_1p35>;
168		vdd-l3-l11-supply = <&vreg_s7a_1p025>;
169		vdd-l4-l5-supply = <&vreg_s7a_1p025>;
170		vdd-l6-supply = <&vph_pwr>;
171		vdd-l7-l12-l14-l15-supply = <&vreg_s5a_2p04>;
172		vdd-l9-supply = <&vreg_bob>;
173		vdd-l10-l23-l25-supply = <&vreg_bob>;
174		vdd-l13-l19-l21-supply = <&vreg_bob>;
175		vdd-l16-l28-supply = <&vreg_bob>;
176		vdd-l18-l22-supply = <&vreg_bob>;
177		vdd-l20-l24-supply = <&vreg_bob>;
178		vdd-l26-supply = <&vreg_s3a_1p35>;
179		vin-lvs-1-2-supply = <&vreg_s4a_1p8>;
180
181		vreg_s3a_1p35: smps3 {
182			regulator-min-microvolt = <1352000>;
183			regulator-max-microvolt = <1352000>;
184		};
185
186		vreg_s5a_2p04: smps5 {
187			regulator-min-microvolt = <1904000>;
188			regulator-max-microvolt = <2040000>;
189		};
190
191		vreg_s7a_1p025: smps7 {
192			regulator-min-microvolt = <900000>;
193			regulator-max-microvolt = <1028000>;
194		};
195
196		vdda_mipi_dsi0_pll:
197		vdda_qlink_lv:
198		vdda_ufs1_core:
199		vdda_usb1_ss_core:
200		vreg_l1a_0p875: ldo1 {
201			regulator-min-microvolt = <880000>;
202			regulator-max-microvolt = <880000>;
203			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
204		};
205
206		vreg_l2a_1p2: ldo2 {
207			regulator-min-microvolt = <1200000>;
208			regulator-max-microvolt = <1200000>;
209			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
210			regulator-always-on;
211		};
212
213		vreg_l5a_0p8: ldo5 {
214			regulator-min-microvolt = <800000>;
215			regulator-max-microvolt = <800000>;
216			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
217		};
218
219		vreg_l7a_1p8: ldo7 {
220			regulator-min-microvolt = <1800000>;
221			regulator-max-microvolt = <1800000>;
222			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
223		};
224
225		vdda_qusb_hs0_1p8:
226		vreg_l12a_1p8: ldo12 {
227			regulator-min-microvolt = <1800000>;
228			regulator-max-microvolt = <1800000>;
229			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
230		};
231
232		vreg_l14a_1p88: ldo14 {
233			regulator-min-microvolt = <1800000>;
234			regulator-max-microvolt = <1800000>;
235			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
236			regulator-always-on;
237		};
238
239		vreg_l17a_1p3: ldo17 {
240			regulator-min-microvolt = <1304000>;
241			regulator-max-microvolt = <1304000>;
242			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
243		};
244
245		vreg_l20a_2p95: ldo20 {
246			regulator-min-microvolt = <2704000>;
247			regulator-max-microvolt = <2960000>;
248			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
249		};
250
251		vreg_l23a_3p3: ldo23 {
252			regulator-min-microvolt = <3300000>;
253			regulator-max-microvolt = <3312000>;
254			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
255		};
256
257		vdda_qusb_hs0_3p1:
258		vreg_l24a_3p075: ldo24 {
259			regulator-min-microvolt = <3088000>;
260			regulator-max-microvolt = <3088000>;
261			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
262		};
263
264		vreg_l25a_3p3: ldo25 {
265			regulator-min-microvolt = <3300000>;
266			regulator-max-microvolt = <3312000>;
267			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
268		};
269
270		vdda_mipi_dsi0_1p2:
271		vdda_ufs1_1p2:
272		vreg_l26a_1p2: ldo26 {
273			regulator-min-microvolt = <1200000>;
274			regulator-max-microvolt = <1200000>;
275			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
276		};
277
278		vreg_l28a_3p0: ldo28 {
279			regulator-min-microvolt = <2856000>;
280			regulator-max-microvolt = <3008000>;
281			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
282		};
283	};
284
285	pmi8998-rpmh-regulators {
286		compatible = "qcom,pmi8998-rpmh-regulators";
287		qcom,pmic-id = "b";
288
289		vdd-bob-supply = <&vph_pwr>;
290
291		vreg_bob: bob {
292			regulator-min-microvolt = <3312000>;
293			regulator-max-microvolt = <3600000>;
294			regulator-initial-mode = <RPMH_REGULATOR_MODE_AUTO>;
295			regulator-allow-bypass;
296		};
297	};
298
299	pm8005-rpmh-regulators {
300		compatible = "qcom,pm8005-rpmh-regulators";
301		qcom,pmic-id = "c";
302
303		vdd-s1-supply = <&vph_pwr>;
304		vdd-s2-supply = <&vph_pwr>;
305		vdd-s3-supply = <&vph_pwr>;
306		vdd-s4-supply = <&vph_pwr>;
307
308		vreg_s3c_0p6: smps3 {
309			regulator-min-microvolt = <600000>;
310			regulator-max-microvolt = <600000>;
311		};
312	};
313};
314
315&cdsp_pas {
316	status = "okay";
317	firmware-name = "qcom/sdm845/oneplus6/cdsp.mbn";
318};
319
320&dsi0 {
321	status = "okay";
322	vdda-supply = <&vdda_mipi_dsi0_1p2>;
323
324	#address-cells = <1>;
325	#size-cells = <0>;
326
327	/*
328	 * Both devices use different panels but all other properties
329	 * are common. Compatible line is declared in device dts.
330	 */
331	display_panel: panel@0 {
332		status = "disabled";
333
334		#address-cells = <1>;
335		#size-cells = <0>;
336		reg = <0>;
337
338		vddio-supply = <&vreg_l14a_1p88>;
339
340		reset-gpios = <&tlmm 6 GPIO_ACTIVE_LOW>;
341
342		pinctrl-names = "default";
343		pinctrl-0 = <&panel_reset_pins &panel_te_pin &panel_esd_pin>;
344
345		port {
346			panel_in: endpoint {
347				remote-endpoint = <&dsi0_out>;
348			};
349		};
350	};
351};
352
353&dsi0_out {
354	remote-endpoint = <&panel_in>;
355	data-lanes = <0 1 2 3>;
356};
357
358&dsi0_phy {
359	status = "okay";
360	vdds-supply = <&vdda_mipi_dsi0_pll>;
361};
362
363&gcc {
364	protected-clocks = <GCC_QSPI_CORE_CLK>,
365				<GCC_QSPI_CORE_CLK_SRC>,
366				<GCC_QSPI_CNOC_PERIPH_AHB_CLK>,
367				<GCC_LPASS_Q6_AXI_CLK>,
368				<GCC_LPASS_SWAY_CLK>;
369};
370
371&gpu {
372	zap-shader {
373		memory-region = <&gpu_mem>;
374		firmware-name = "qcom/sdm845/oneplus6/a630_zap.mbn";
375	};
376};
377
378&i2c12 {
379	status = "okay";
380	clock-frequency = <400000>;
381
382	synaptics-rmi4-i2c@20 {
383		compatible = "syna,rmi4-i2c";
384		reg = <0x20>;
385		#address-cells = <1>;
386		#size-cells = <0>;
387		interrupts-extended = <&tlmm 125 IRQ_TYPE_EDGE_FALLING>;
388
389		pinctrl-names = "default";
390		pinctrl-0 = <&ts_default_pins>;
391
392		vdd-supply = <&vreg_l28a_3p0>;
393		vio-supply = <&ts_1p8_supply>;
394
395		syna,reset-delay-ms = <200>;
396		syna,startup-delay-ms = <200>;
397
398		rmi4-f01@1 {
399			reg = <0x01>;
400			syna,nosleep-mode = <1>;
401		};
402
403		rmi4_f12: rmi4-f12@12 {
404			reg = <0x12>;
405			touchscreen-x-mm = <68>;
406			touchscreen-y-mm = <144>;
407			syna,sensor-type = <1>;
408			syna,rezero-wait-ms = <200>;
409		};
410	};
411};
412
413&ipa {
414	status = "okay";
415
416	memory-region = <&ipa_fw_mem>;
417	firmware-name = "qcom/sdm845/oneplus6/ipa_fws.mbn";
418};
419
420&mdss {
421	status = "okay";
422};
423
424&mdss_mdp {
425	status = "okay";
426};
427
428/* Modem/wifi*/
429&mss_pil {
430	status = "okay";
431	firmware-name = "qcom/sdm845/oneplus6/mba.mbn", "qcom/sdm845/oneplus6/modem.mbn";
432};
433
434&pm8998_gpio {
435	volume_down_gpio: pm8998_gpio5 {
436		pinconf {
437			pins = "gpio5";
438			function = "normal";
439			input-enable;
440			bias-pull-up;
441			qcom,drive-strength = <0>;
442		};
443	};
444
445	volume_up_gpio: pm8998_gpio6 {
446		pinconf {
447			pins = "gpio6";
448			function = "normal";
449			input-enable;
450			bias-pull-up;
451			qcom,drive-strength = <0>;
452		};
453	};
454};
455
456&qupv3_id_1 {
457	status = "okay";
458};
459
460&qupv3_id_0 {
461	status = "okay";
462};
463
464&qup_i2c12_default {
465	mux {
466		pins = "gpio49", "gpio50";
467		function = "qup12";
468		drive-strength = <2>;
469		bias-disable;
470	};
471};
472
473&qup_i2c10_default {
474	pinconf {
475		pins = "gpio55", "gpio56";
476		drive-strength = <2>;
477		bias-disable;
478	};
479};
480
481&qup_uart9_default {
482	pinconf-tx {
483		pins = "gpio4";
484		drive-strength = <2>;
485		bias-disable;
486	};
487
488	pinconf-rx {
489		pins = "gpio5";
490		drive-strength = <2>;
491		bias-pull-up;
492	};
493};
494
495/*
496 * Prevent garbage data on bluetooth UART lines
497 */
498&qup_uart6_default {
499	pinmux {
500		pins = "gpio45", "gpio46", "gpio47", "gpio48";
501		function = "qup6";
502	};
503
504	cts {
505		pins = "gpio45";
506		bias-pull-down;
507	};
508
509	rts-tx {
510		pins = "gpio46", "gpio47";
511		drive-strength = <2>;
512		bias-disable;
513	};
514
515	rx {
516		pins = "gpio48";
517		bias-pull-up;
518	};
519};
520
521&uart6 {
522	status = "okay";
523
524	bluetooth {
525		compatible = "qcom,wcn3990-bt";
526
527		/*
528		 * This path is relative to the qca/
529		 * subdir under lib/firmware.
530		 */
531		firmware-name = "oneplus6/crnv21.bin";
532
533		vddio-supply = <&vreg_s4a_1p8>;
534		vddxo-supply = <&vreg_l7a_1p8>;
535		vddrf-supply = <&vreg_l17a_1p3>;
536		vddch0-supply = <&vreg_l25a_3p3>;
537		max-speed = <3200000>;
538	};
539};
540
541&uart9 {
542	label = "LS-UART1";
543	status = "okay";
544};
545
546&ufs_mem_hc {
547	status = "okay";
548
549	reset-gpios = <&tlmm 150 GPIO_ACTIVE_LOW>;
550
551	vcc-supply = <&vreg_l20a_2p95>;
552	vcc-max-microamp = <600000>;
553};
554
555&ufs_mem_phy {
556	status = "okay";
557
558	vdda-phy-supply = <&vdda_ufs1_core>;
559	vdda-pll-supply = <&vdda_ufs1_1p2>;
560};
561
562&usb_1 {
563	status = "okay";
564
565	/*
566	 * disable USB3 clock requirement as the device only supports
567	 * USB2.
568	 */
569	qcom,select-utmi-as-pipe-clk;
570};
571
572&usb_1_dwc3 {
573	/*
574	 * We don't have the capability to switch modes yet.
575	 */
576	dr_mode = "peripheral";
577
578	/* fastest mode for USB 2 */
579	maximum-speed = "high-speed";
580
581	/* Remove USB3 phy as it's unused on this device. */
582	phys = <&usb_1_hsphy>;
583	phy-names = "usb2-phy";
584};
585
586&usb_1_hsphy {
587	status = "okay";
588
589	vdd-supply = <&vdda_usb1_ss_core>;
590	vdda-pll-supply = <&vdda_qusb_hs0_1p8>;
591	vdda-phy-dpdm-supply = <&vdda_qusb_hs0_3p1>;
592
593	qcom,imp-res-offset-value = <8>;
594	qcom,hstx-trim-value = <QUSB2_V2_HSTX_TRIM_21_6_MA>;
595	qcom,preemphasis-level = <QUSB2_V2_PREEMPHASIS_5_PERCENT>;
596	qcom,preemphasis-width = <QUSB2_V2_PREEMPHASIS_WIDTH_HALF_BIT>;
597};
598
599&tlmm {
600	gpio-reserved-ranges = <0 4>, <81 4>;
601
602	tri_state_key_default: tri_state_key_default {
603		mux {
604			pins = "gpio40", "gpio42", "gpio26";
605			function = "gpio";
606			drive-strength = <2>;
607			bias-disable;
608		};
609	};
610
611	ts_default_pins: ts-int {
612		mux {
613			pins = "gpio99", "gpio125";
614			function = "gpio";
615			drive-strength = <16>;
616			bias-pull-up;
617		};
618	};
619
620	panel_reset_pins: panel-reset {
621		mux {
622			pins = "gpio6", "gpio25", "gpio26";
623			function = "gpio";
624			drive-strength = <8>;
625			bias-disable = <0>;
626		};
627	};
628
629	panel_te_pin: panel-te {
630		mux {
631			pins = "gpio10";
632			function = "mdp_vsync";
633			drive-strength = <2>;
634			bias-disable;
635			input-enable;
636		};
637	};
638
639	panel_esd_pin: panel-esd {
640		mux {
641			pins = "gpio30";
642			function = "gpio";
643			drive-strength = <2>;
644			bias-pull-down;
645			input-enable;
646		};
647	};
648};
649
650&wifi {
651	status = "okay";
652	vdd-0.8-cx-mx-supply = <&vreg_l5a_0p8>;
653	vdd-1.8-xo-supply = <&vreg_l7a_1p8>;
654	vdd-1.3-rfa-supply = <&vreg_l17a_1p3>;
655	vdd-3.3-ch0-supply = <&vreg_l25a_3p3>;
656	vdd-3.3-ch1-supply = <&vreg_l23a_3p3>;
657
658	qcom,snoc-host-cap-8bit-quirk;
659};
660