1// SPDX-License-Identifier: GPL-2.0
2/*
3 * SDM845 MTP board device tree source
4 *
5 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
6 */
7
8/dts-v1/;
9
10#include <dt-bindings/gpio/gpio.h>
11#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
12#include "sdm845.dtsi"
13
14/ {
15	model = "Qualcomm Technologies, Inc. SDM845 MTP";
16	compatible = "qcom,sdm845-mtp";
17
18	aliases {
19		serial0 = &uart9;
20	};
21
22	chosen {
23		stdout-path = "serial0:115200n8";
24	};
25
26	vph_pwr: vph-pwr-regulator {
27		compatible = "regulator-fixed";
28		regulator-name = "vph_pwr";
29		regulator-min-microvolt = <3700000>;
30		regulator-max-microvolt = <3700000>;
31	};
32
33	/*
34	 * Apparently RPMh does not provide support for PM8998 S4 because it
35	 * is always-on; model it as a fixed regulator.
36	 */
37	vreg_s4a_1p8: pm8998-smps4 {
38		compatible = "regulator-fixed";
39		regulator-name = "vreg_s4a_1p8";
40
41		regulator-min-microvolt = <1800000>;
42		regulator-max-microvolt = <1800000>;
43
44		regulator-always-on;
45		regulator-boot-on;
46
47		vin-supply = <&vph_pwr>;
48	};
49};
50
51&adsp_pas {
52	status = "okay";
53};
54
55&apps_rsc {
56	pm8998-rpmh-regulators {
57		compatible = "qcom,pm8998-rpmh-regulators";
58		qcom,pmic-id = "a";
59
60		vdd-s1-supply = <&vph_pwr>;
61		vdd-s2-supply = <&vph_pwr>;
62		vdd-s3-supply = <&vph_pwr>;
63		vdd-s4-supply = <&vph_pwr>;
64		vdd-s5-supply = <&vph_pwr>;
65		vdd-s6-supply = <&vph_pwr>;
66		vdd-s7-supply = <&vph_pwr>;
67		vdd-s8-supply = <&vph_pwr>;
68		vdd-s9-supply = <&vph_pwr>;
69		vdd-s10-supply = <&vph_pwr>;
70		vdd-s11-supply = <&vph_pwr>;
71		vdd-s12-supply = <&vph_pwr>;
72		vdd-s13-supply = <&vph_pwr>;
73		vdd-l1-l27-supply = <&vreg_s7a_1p025>;
74		vdd-l2-l8-l17-supply = <&vreg_s3a_1p35>;
75		vdd-l3-l11-supply = <&vreg_s7a_1p025>;
76		vdd-l4-l5-supply = <&vreg_s7a_1p025>;
77		vdd-l6-supply = <&vph_pwr>;
78		vdd-l7-l12-l14-l15-supply = <&vreg_s5a_2p04>;
79		vdd-l9-supply = <&vreg_bob>;
80		vdd-l10-l23-l25-supply = <&vreg_bob>;
81		vdd-l13-l19-l21-supply = <&vreg_bob>;
82		vdd-l16-l28-supply = <&vreg_bob>;
83		vdd-l18-l22-supply = <&vreg_bob>;
84		vdd-l20-l24-supply = <&vreg_bob>;
85		vdd-l26-supply = <&vreg_s3a_1p35>;
86		vin-lvs-1-2-supply = <&vreg_s4a_1p8>;
87
88		vreg_s2a_1p125: smps2 {
89			regulator-min-microvolt = <1100000>;
90			regulator-max-microvolt = <1100000>;
91		};
92
93		vreg_s3a_1p35: smps3 {
94			regulator-min-microvolt = <1352000>;
95			regulator-max-microvolt = <1352000>;
96		};
97
98		vreg_s5a_2p04: smps5 {
99			regulator-min-microvolt = <1904000>;
100			regulator-max-microvolt = <2040000>;
101		};
102
103		vreg_s7a_1p025: smps7 {
104			regulator-min-microvolt = <900000>;
105			regulator-max-microvolt = <1028000>;
106		};
107
108		vdd_qusb_hs0:
109		vdda_hp_pcie_core:
110		vdda_mipi_csi0_0p9:
111		vdda_mipi_csi1_0p9:
112		vdda_mipi_csi2_0p9:
113		vdda_mipi_dsi0_pll:
114		vdda_mipi_dsi1_pll:
115		vdda_qlink_lv:
116		vdda_qlink_lv_ck:
117		vdda_qrefs_0p875:
118		vdda_pcie_core:
119		vdda_pll_cc_ebi01:
120		vdda_pll_cc_ebi23:
121		vdda_sp_sensor:
122		vdda_ufs1_core:
123		vdda_ufs2_core:
124		vdda_usb1_ss_core:
125		vdda_usb2_ss_core:
126		vreg_l1a_0p875: ldo1 {
127			regulator-min-microvolt = <880000>;
128			regulator-max-microvolt = <880000>;
129			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
130		};
131
132		vddpx_10:
133		vreg_l2a_1p2: ldo2 {
134			regulator-min-microvolt = <1200000>;
135			regulator-max-microvolt = <1200000>;
136			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
137			regulator-always-on;
138		};
139
140		vreg_l3a_1p0: ldo3 {
141			regulator-min-microvolt = <1000000>;
142			regulator-max-microvolt = <1000000>;
143			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
144		};
145
146		vdd_wcss_cx:
147		vdd_wcss_mx:
148		vdda_wcss_pll:
149		vreg_l5a_0p8: ldo5 {
150			regulator-min-microvolt = <800000>;
151			regulator-max-microvolt = <800000>;
152			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
153		};
154
155		vddpx_13:
156		vreg_l6a_1p8: ldo6 {
157			regulator-min-microvolt = <1856000>;
158			regulator-max-microvolt = <1856000>;
159			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
160		};
161
162		vreg_l7a_1p8: ldo7 {
163			regulator-min-microvolt = <1800000>;
164			regulator-max-microvolt = <1800000>;
165			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
166		};
167
168		vreg_l8a_1p2: ldo8 {
169			regulator-min-microvolt = <1200000>;
170			regulator-max-microvolt = <1248000>;
171			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
172		};
173
174		vreg_l9a_1p8: ldo9 {
175			regulator-min-microvolt = <1704000>;
176			regulator-max-microvolt = <2928000>;
177			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
178		};
179
180		vreg_l10a_1p8: ldo10 {
181			regulator-min-microvolt = <1704000>;
182			regulator-max-microvolt = <2928000>;
183			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
184		};
185
186		vreg_l11a_1p0: ldo11 {
187			regulator-min-microvolt = <1000000>;
188			regulator-max-microvolt = <1048000>;
189			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
190		};
191
192		vdd_qfprom:
193		vdd_qfprom_sp:
194		vdda_apc1_cs_1p8:
195		vdda_gfx_cs_1p8:
196		vdda_qrefs_1p8:
197		vdda_qusb_hs0_1p8:
198		vddpx_11:
199		vreg_l12a_1p8: ldo12 {
200			regulator-min-microvolt = <1800000>;
201			regulator-max-microvolt = <1800000>;
202			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
203		};
204
205		vddpx_2:
206		vreg_l13a_2p95: ldo13 {
207			regulator-min-microvolt = <1800000>;
208			regulator-max-microvolt = <2960000>;
209			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
210		};
211
212		vreg_l14a_1p88: ldo14 {
213			regulator-min-microvolt = <1800000>;
214			regulator-max-microvolt = <1800000>;
215			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
216		};
217
218		vreg_l15a_1p8: ldo15 {
219			regulator-min-microvolt = <1800000>;
220			regulator-max-microvolt = <1800000>;
221			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
222		};
223
224		vreg_l16a_2p7: ldo16 {
225			regulator-min-microvolt = <2704000>;
226			regulator-max-microvolt = <2704000>;
227			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
228		};
229
230		vreg_l17a_1p3: ldo17 {
231			regulator-min-microvolt = <1304000>;
232			regulator-max-microvolt = <1304000>;
233			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
234		};
235
236		vreg_l18a_2p7: ldo18 {
237			regulator-min-microvolt = <2704000>;
238			regulator-max-microvolt = <2960000>;
239			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
240		};
241
242		vreg_l19a_3p0: ldo19 {
243			regulator-min-microvolt = <2856000>;
244			regulator-max-microvolt = <3104000>;
245			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
246		};
247
248		vreg_l20a_2p95: ldo20 {
249			regulator-min-microvolt = <2704000>;
250			regulator-max-microvolt = <2960000>;
251			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
252		};
253
254		vreg_l21a_2p95: ldo21 {
255			regulator-min-microvolt = <2704000>;
256			regulator-max-microvolt = <2960000>;
257			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
258		};
259
260		vreg_l22a_2p85: ldo22 {
261			regulator-min-microvolt = <2864000>;
262			regulator-max-microvolt = <3312000>;
263			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
264		};
265
266		vreg_l23a_3p3: ldo23 {
267			regulator-min-microvolt = <3000000>;
268			regulator-max-microvolt = <3312000>;
269			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
270		};
271
272		vdda_qusb_hs0_3p1:
273		vreg_l24a_3p075: ldo24 {
274			regulator-min-microvolt = <3088000>;
275			regulator-max-microvolt = <3088000>;
276			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
277		};
278
279		vreg_l25a_3p3: ldo25 {
280			regulator-min-microvolt = <3300000>;
281			regulator-max-microvolt = <3312000>;
282			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
283		};
284
285		vdda_hp_pcie_1p2:
286		vdda_hv_ebi0:
287		vdda_hv_ebi1:
288		vdda_hv_ebi2:
289		vdda_hv_ebi3:
290		vdda_mipi_csi_1p25:
291		vdda_mipi_dsi0_1p2:
292		vdda_mipi_dsi1_1p2:
293		vdda_pcie_1p2:
294		vdda_ufs1_1p2:
295		vdda_ufs2_1p2:
296		vdda_usb1_ss_1p2:
297		vdda_usb2_ss_1p2:
298		vreg_l26a_1p2: ldo26 {
299			regulator-min-microvolt = <1200000>;
300			regulator-max-microvolt = <1200000>;
301			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
302		};
303
304		vreg_l28a_3p0: ldo28 {
305			regulator-min-microvolt = <2856000>;
306			regulator-max-microvolt = <3008000>;
307			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
308		};
309
310		vreg_lvs1a_1p8: lvs1 {
311			regulator-min-microvolt = <1800000>;
312			regulator-max-microvolt = <1800000>;
313		};
314
315		vreg_lvs2a_1p8: lvs2 {
316			regulator-min-microvolt = <1800000>;
317			regulator-max-microvolt = <1800000>;
318		};
319	};
320
321	pmi8998-rpmh-regulators {
322		compatible = "qcom,pmi8998-rpmh-regulators";
323		qcom,pmic-id = "b";
324
325		vdd-bob-supply = <&vph_pwr>;
326
327		vreg_bob: bob {
328			regulator-min-microvolt = <3312000>;
329			regulator-max-microvolt = <3600000>;
330			regulator-initial-mode = <RPMH_REGULATOR_MODE_AUTO>;
331			regulator-allow-bypass;
332		};
333	};
334
335	pm8005-rpmh-regulators {
336		compatible = "qcom,pm8005-rpmh-regulators";
337		qcom,pmic-id = "c";
338
339		vdd-s1-supply = <&vph_pwr>;
340		vdd-s2-supply = <&vph_pwr>;
341		vdd-s3-supply = <&vph_pwr>;
342		vdd-s4-supply = <&vph_pwr>;
343
344		vreg_s3c_0p6: smps3 {
345			regulator-min-microvolt = <600000>;
346			regulator-max-microvolt = <600000>;
347		};
348	};
349};
350
351&cdsp_pas {
352	status = "okay";
353};
354
355&gcc {
356	protected-clocks = <GCC_QSPI_CORE_CLK>,
357			   <GCC_QSPI_CORE_CLK_SRC>,
358			   <GCC_QSPI_CNOC_PERIPH_AHB_CLK>,
359			   <GCC_LPASS_Q6_AXI_CLK>,
360			   <GCC_LPASS_SWAY_CLK>;
361};
362
363&i2c10 {
364	status = "okay";
365	clock-frequency = <400000>;
366};
367
368&qupv3_id_1 {
369	status = "okay";
370};
371
372&sdhc_2 {
373	status = "okay";
374
375	pinctrl-names = "default";
376	pinctrl-0 = <&sdc2_clk &sdc2_cmd &sdc2_data &sd_card_det_n>;
377
378	vmmc-supply = <&vreg_l21a_2p95>;
379	vqmmc-supply = <&vddpx_2>;
380
381	cd-gpios = <&tlmm 126 GPIO_ACTIVE_LOW>;
382};
383
384&uart9 {
385	status = "okay";
386};
387
388&ufs_mem_hc {
389	status = "okay";
390
391	vcc-supply = <&vreg_l20a_2p95>;
392	vcc-max-microamp = <600000>;
393};
394
395&ufs_mem_phy {
396	status = "okay";
397
398	vdda-phy-supply = <&vdda_ufs1_core>;
399	vdda-pll-supply = <&vdda_ufs1_1p2>;
400};
401
402&usb_1 {
403	status = "okay";
404};
405
406&usb_1_dwc3 {
407	/* Until we have Type C hooked up we'll force this as host. */
408	dr_mode = "host";
409};
410
411&usb_1_hsphy {
412	status = "okay";
413
414	vdd-supply = <&vdda_usb1_ss_core>;
415	vdda-pll-supply = <&vdda_qusb_hs0_1p8>;
416	vdda-phy-dpdm-supply = <&vdda_qusb_hs0_3p1>;
417
418	qcom,imp-res-offset-value = <8>;
419	qcom,hstx-trim-value = <QUSB2_V2_HSTX_TRIM_21_6_MA>;
420	qcom,preemphasis-level = <QUSB2_V2_PREEMPHASIS_5_PERCENT>;
421	qcom,preemphasis-width = <QUSB2_V2_PREEMPHASIS_WIDTH_HALF_BIT>;
422};
423
424&usb_1_qmpphy {
425	status = "okay";
426
427	vdda-phy-supply = <&vdda_usb1_ss_1p2>;
428	vdda-pll-supply = <&vdda_usb1_ss_core>;
429};
430
431&usb_2 {
432	status = "okay";
433};
434
435&usb_2_dwc3 {
436	/*
437	 * Though the USB block on SDM845 can support host, there's no vbus
438	 * signal for this port on MTP.  Thus (unless you have a non-compliant
439	 * hub that works without vbus) the only sensible thing is to force
440	 * peripheral mode.
441	 */
442	dr_mode = "peripheral";
443};
444
445&usb_2_hsphy {
446	status = "okay";
447
448	vdd-supply = <&vdda_usb2_ss_core>;
449	vdda-pll-supply = <&vdda_qusb_hs0_1p8>;
450	vdda-phy-dpdm-supply = <&vdda_qusb_hs0_3p1>;
451
452	qcom,imp-res-offset-value = <8>;
453	qcom,hstx-trim-value = <QUSB2_V2_HSTX_TRIM_22_8_MA>;
454};
455
456&usb_2_qmpphy {
457	status = "okay";
458
459	vdda-phy-supply = <&vdda_usb2_ss_1p2>;
460	vdda-pll-supply = <&vdda_usb2_ss_core>;
461};
462
463&wifi {
464	status = "okay";
465	vdd-0.8-cx-mx-supply = <&vreg_l5a_0p8>;
466	vdd-1.8-xo-supply = <&vreg_l7a_1p8>;
467	vdd-1.3-rfa-supply = <&vreg_l17a_1p3>;
468	vdd-3.3-ch0-supply = <&vreg_l25a_3p3>;
469};
470
471/* PINCTRL - additions to nodes defined in sdm845.dtsi */
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&tlmm {
496	gpio-reserved-ranges = <0 4>, <81 4>;
497
498	sdc2_clk: sdc2-clk {
499		pinconf {
500			pins = "sdc2_clk";
501			bias-disable;
502
503			/*
504			 * It seems that mmc_test reports errors if drive
505			 * strength is not 16 on clk, cmd, and data pins.
506			 */
507			drive-strength = <16>;
508		};
509	};
510
511	sdc2_cmd: sdc2-cmd {
512		pinconf {
513			pins = "sdc2_cmd";
514			bias-pull-up;
515			drive-strength = <16>;
516		};
517	};
518
519	sdc2_data: sdc2-data {
520		pinconf {
521			pins = "sdc2_data";
522			bias-pull-up;
523			drive-strength = <16>;
524		};
525	};
526
527	sd_card_det_n: sd-card-det-n {
528		pinmux {
529			pins = "gpio126";
530			function = "gpio";
531		};
532
533		pinconf {
534			pins = "gpio126";
535			bias-pull-up;
536		};
537	};
538};
539