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