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	reset-gpios = <&tlmm 150 GPIO_ACTIVE_LOW>;
392
393	vcc-supply = <&vreg_l20a_2p95>;
394	vcc-max-microamp = <600000>;
395};
396
397&ufs_mem_phy {
398	status = "okay";
399
400	vdda-phy-supply = <&vdda_ufs1_core>;
401	vdda-pll-supply = <&vdda_ufs1_1p2>;
402};
403
404&usb_1 {
405	status = "okay";
406};
407
408&usb_1_dwc3 {
409	/* Until we have Type C hooked up we'll force this as peripheral. */
410	dr_mode = "peripheral";
411};
412
413&usb_1_hsphy {
414	status = "okay";
415
416	vdd-supply = <&vdda_usb1_ss_core>;
417	vdda-pll-supply = <&vdda_qusb_hs0_1p8>;
418	vdda-phy-dpdm-supply = <&vdda_qusb_hs0_3p1>;
419
420	qcom,imp-res-offset-value = <8>;
421	qcom,hstx-trim-value = <QUSB2_V2_HSTX_TRIM_21_6_MA>;
422	qcom,preemphasis-level = <QUSB2_V2_PREEMPHASIS_5_PERCENT>;
423	qcom,preemphasis-width = <QUSB2_V2_PREEMPHASIS_WIDTH_HALF_BIT>;
424};
425
426&usb_1_qmpphy {
427	status = "okay";
428
429	vdda-phy-supply = <&vdda_usb1_ss_1p2>;
430	vdda-pll-supply = <&vdda_usb1_ss_core>;
431};
432
433&usb_2 {
434	status = "okay";
435};
436
437&usb_2_dwc3 {
438	/*
439	 * Though the USB block on SDM845 can support host, there's no vbus
440	 * signal for this port on MTP.  Thus (unless you have a non-compliant
441	 * hub that works without vbus) the only sensible thing is to force
442	 * peripheral mode.
443	 */
444	dr_mode = "peripheral";
445};
446
447&usb_2_hsphy {
448	status = "okay";
449
450	vdd-supply = <&vdda_usb2_ss_core>;
451	vdda-pll-supply = <&vdda_qusb_hs0_1p8>;
452	vdda-phy-dpdm-supply = <&vdda_qusb_hs0_3p1>;
453
454	qcom,imp-res-offset-value = <8>;
455	qcom,hstx-trim-value = <QUSB2_V2_HSTX_TRIM_22_8_MA>;
456};
457
458&usb_2_qmpphy {
459	status = "okay";
460
461	vdda-phy-supply = <&vdda_usb2_ss_1p2>;
462	vdda-pll-supply = <&vdda_usb2_ss_core>;
463};
464
465&wifi {
466	status = "okay";
467	vdd-0.8-cx-mx-supply = <&vreg_l5a_0p8>;
468	vdd-1.8-xo-supply = <&vreg_l7a_1p8>;
469	vdd-1.3-rfa-supply = <&vreg_l17a_1p3>;
470	vdd-3.3-ch0-supply = <&vreg_l25a_3p3>;
471};
472
473/* PINCTRL - additions to nodes defined in sdm845.dtsi */
474
475&qup_i2c10_default {
476	pinconf {
477		pins = "gpio55", "gpio56";
478		drive-strength = <2>;
479		bias-disable;
480	};
481};
482
483&qup_uart9_default {
484	pinconf-tx {
485		pins = "gpio4";
486		drive-strength = <2>;
487		bias-disable;
488	};
489
490	pinconf-rx {
491		pins = "gpio5";
492		drive-strength = <2>;
493		bias-pull-up;
494	};
495};
496
497&tlmm {
498	gpio-reserved-ranges = <0 4>, <81 4>;
499
500	sdc2_clk: sdc2-clk {
501		pinconf {
502			pins = "sdc2_clk";
503			bias-disable;
504
505			/*
506			 * It seems that mmc_test reports errors if drive
507			 * strength is not 16 on clk, cmd, and data pins.
508			 */
509			drive-strength = <16>;
510		};
511	};
512
513	sdc2_cmd: sdc2-cmd {
514		pinconf {
515			pins = "sdc2_cmd";
516			bias-pull-up;
517			drive-strength = <16>;
518		};
519	};
520
521	sdc2_data: sdc2-data {
522		pinconf {
523			pins = "sdc2_data";
524			bias-pull-up;
525			drive-strength = <16>;
526		};
527	};
528
529	sd_card_det_n: sd-card-det-n {
530		pinmux {
531			pins = "gpio126";
532			function = "gpio";
533		};
534
535		pinconf {
536			pins = "gpio126";
537			bias-pull-up;
538		};
539	};
540};
541