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