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