1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Copyright (c) 2021, Linaro Limited
4 */
5
6/dts-v1/;
7
8#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
9#include <dt-bindings/gpio/gpio.h>
10#include "sa8155p.dtsi"
11#include "pmm8155au_1.dtsi"
12#include "pmm8155au_2.dtsi"
13
14/ {
15	model = "Qualcomm Technologies, Inc. SA8155P ADP";
16	compatible = "qcom,sa8155p-adp", "qcom,sa8155p";
17
18	aliases {
19		serial0 = &uart2;
20		serial1 = &uart9;
21	};
22
23	chosen {
24		stdout-path = "serial0:115200n8";
25	};
26
27	vreg_3p3: vreg-3p3-regulator {
28		compatible = "regulator-fixed";
29		regulator-name = "vreg_3p3";
30		regulator-min-microvolt = <3300000>;
31		regulator-max-microvolt = <3300000>;
32	};
33
34	/*
35	 * S4A is always on and not controllable through RPMh.
36	 * So model it as a fixed regulator.
37	 */
38	vreg_s4a_1p8: smps4 {
39		compatible = "regulator-fixed";
40		regulator-name = "vreg_s4a_1p8";
41
42		regulator-min-microvolt = <1800000>;
43		regulator-max-microvolt = <1800000>;
44
45		regulator-always-on;
46		regulator-boot-on;
47
48		vin-supply = <&vreg_3p3>;
49	};
50};
51
52&apps_rsc {
53	regulators-0 {
54		compatible = "qcom,pmm8155au-rpmh-regulators";
55		qcom,pmic-id = "a";
56
57		vdd-s1-supply = <&vreg_3p3>;
58		vdd-s2-supply = <&vreg_3p3>;
59		vdd-s3-supply = <&vreg_3p3>;
60		vdd-s4-supply = <&vreg_3p3>;
61		vdd-s5-supply = <&vreg_3p3>;
62		vdd-s6-supply = <&vreg_3p3>;
63		vdd-s7-supply = <&vreg_3p3>;
64		vdd-s8-supply = <&vreg_3p3>;
65		vdd-s9-supply = <&vreg_3p3>;
66		vdd-s10-supply = <&vreg_3p3>;
67
68		vdd-l1-l8-l11-supply = <&vreg_s6a_0p92>;
69		vdd-l2-l10-supply = <&vreg_3p3>;
70		vdd-l3-l4-l5-l18-supply = <&vreg_s6a_0p92>;
71		vdd-l6-l9-supply = <&vreg_s6a_0p92>;
72		vdd-l7-l12-l14-l15-supply = <&vreg_s5a_2p04>;
73		vdd-l13-l16-l17-supply = <&vreg_3p3>;
74
75		vreg_s5a_2p04: smps5 {
76			regulator-name = "vreg_s5a_2p04";
77			regulator-min-microvolt = <1904000>;
78			regulator-max-microvolt = <2000000>;
79		};
80
81		vreg_s6a_0p92: smps6 {
82			regulator-name = "vreg_s6a_0p92";
83			regulator-min-microvolt = <920000>;
84			regulator-max-microvolt = <1128000>;
85		};
86
87		vreg_l1a_0p752: ldo1 {
88			regulator-name = "vreg_l1a_0p752";
89			regulator-min-microvolt = <752000>;
90			regulator-max-microvolt = <752000>;
91			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
92		};
93
94		vdda_usb_hs_3p1:
95		vreg_l2a_3p072: ldo2 {
96			regulator-name = "vreg_l2a_3p072";
97			regulator-min-microvolt = <3072000>;
98			regulator-max-microvolt = <3072000>;
99			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
100		};
101
102		vreg_l3a_0p8: ldo3 {
103			regulator-name = "vreg_l3a_0p8";
104			regulator-min-microvolt = <800000>;
105			regulator-max-microvolt = <800000>;
106			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
107		};
108
109		vdd_usb_hs_core:
110		vdda_usb_ss_dp_core_1:
111		vreg_l5a_0p88: ldo5 {
112			regulator-name = "vreg_l5a_0p88";
113			regulator-min-microvolt = <880000>;
114			regulator-max-microvolt = <880000>;
115			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
116			regulator-allow-set-load;
117			regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM
118						   RPMH_REGULATOR_MODE_HPM>;
119		};
120
121		vreg_l7a_1p8: ldo7 {
122			regulator-name = "vreg_l7a_1p8";
123			regulator-min-microvolt = <1800000>;
124			regulator-max-microvolt = <1800000>;
125			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
126		};
127
128		vreg_l10a_2p96: ldo10 {
129			regulator-name = "vreg_l10a_2p96";
130			regulator-min-microvolt = <2504000>;
131			regulator-max-microvolt = <2960000>;
132			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
133			regulator-allow-set-load;
134			regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM
135						   RPMH_REGULATOR_MODE_HPM>;
136		};
137
138		vreg_l11a_0p8: ldo11 {
139			regulator-name = "vreg_l11a_0p8";
140			regulator-min-microvolt = <800000>;
141			regulator-max-microvolt = <800000>;
142			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
143		};
144
145		vdda_usb_hs_1p8:
146		vreg_l12a_1p8: ldo12 {
147			regulator-name = "vreg_l12a_1p8";
148			regulator-min-microvolt = <1800000>;
149			regulator-max-microvolt = <1800000>;
150			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
151		};
152
153		vreg_l13a_2p7: ldo13 {
154			regulator-name = "vreg_l13a_2p7";
155			regulator-min-microvolt = <2704000>;
156			regulator-max-microvolt = <2704000>;
157			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
158		};
159
160		vreg_l15a_1p7: ldo15 {
161			regulator-name = "vreg_l15a_1p7";
162			regulator-min-microvolt = <1704000>;
163			regulator-max-microvolt = <1704000>;
164			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
165		};
166
167		vreg_l16a_2p7: ldo16 {
168			regulator-name = "vreg_l16a_2p7";
169			regulator-min-microvolt = <2704000>;
170			regulator-max-microvolt = <2960000>;
171			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
172		};
173
174		vreg_l17a_2p96: ldo17 {
175			regulator-name = "vreg_l17a_2p96";
176			regulator-min-microvolt = <2504000>;
177			regulator-max-microvolt = <2960000>;
178			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
179		};
180	};
181
182	regulators-1 {
183		compatible = "qcom,pmm8155au-rpmh-regulators";
184		qcom,pmic-id = "c";
185
186		vdd-s1-supply = <&vreg_3p3>;
187		vdd-s2-supply = <&vreg_3p3>;
188		vdd-s3-supply = <&vreg_3p3>;
189		vdd-s4-supply = <&vreg_3p3>;
190		vdd-s5-supply = <&vreg_3p3>;
191		vdd-s6-supply = <&vreg_3p3>;
192		vdd-s7-supply = <&vreg_3p3>;
193		vdd-s8-supply = <&vreg_3p3>;
194		vdd-s9-supply = <&vreg_3p3>;
195		vdd-s10-supply = <&vreg_3p3>;
196
197		vdd-l1-l8-l11-supply = <&vreg_s4c_1p352>;
198		vdd-l2-l10-supply = <&vreg_3p3>;
199		vdd-l3-l4-l5-l18-supply = <&vreg_s4c_1p352>;
200		vdd-l6-l9-supply = <&vreg_s6c_1p128>;
201		vdd-l7-l12-l14-l15-supply = <&vreg_s5c_2p04>;
202		vdd-l13-l16-l17-supply = <&vreg_3p3>;
203
204		vreg_s4c_1p352: smps4 {
205			regulator-name = "vreg_s4c_1p352";
206			regulator-min-microvolt = <1352000>;
207			regulator-max-microvolt = <1352000>;
208		};
209
210		vreg_s5c_2p04: smps5 {
211			regulator-name = "vreg_s5c_2p04";
212			regulator-min-microvolt = <1904000>;
213			regulator-max-microvolt = <2000000>;
214		};
215
216		vreg_s6c_1p128: smps6 {
217			regulator-name = "vreg_s6c_1p128";
218			regulator-min-microvolt = <1128000>;
219			regulator-max-microvolt = <1128000>;
220		};
221
222		vreg_l1c_1p304: ldo1 {
223			regulator-name = "vreg_l1c_1p304";
224			regulator-min-microvolt = <1304000>;
225			regulator-max-microvolt = <1304000>;
226			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
227		};
228
229		vreg_l2c_1p808: ldo2 {
230			regulator-name = "vreg_l2c_1p808";
231			regulator-min-microvolt = <1704000>;
232			regulator-max-microvolt = <2928000>;
233			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
234		};
235
236		vreg_l5c_1p2: ldo5 {
237			regulator-name = "vreg_l5c_1p2";
238			regulator-min-microvolt = <1200000>;
239			regulator-max-microvolt = <1200000>;
240			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
241			regulator-allow-set-load;
242			regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM
243						   RPMH_REGULATOR_MODE_HPM>;
244		};
245
246		vreg_l7c_1p8: ldo7 {
247			regulator-name = "vreg_l7c_1p8";
248			regulator-min-microvolt = <1800000>;
249			regulator-max-microvolt = <1800000>;
250			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
251		};
252
253		vreg_l8c_1p2: ldo8 {
254			regulator-name = "vreg_l8c_1p2";
255			regulator-min-microvolt = <1200000>;
256			regulator-max-microvolt = <1200000>;
257			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
258			regulator-allow-set-load;
259			regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM
260						   RPMH_REGULATOR_MODE_HPM>;
261		};
262
263		vreg_l10c_3p3: ldo10 {
264			regulator-name = "vreg_l10c_3p3";
265			regulator-min-microvolt = <3000000>;
266			regulator-max-microvolt = <3312000>;
267			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
268		};
269
270		vreg_l11c_0p8: ldo11 {
271			regulator-name = "vreg_l11c_0p8";
272			regulator-min-microvolt = <800000>;
273			regulator-max-microvolt = <800000>;
274			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
275		};
276
277		vreg_l12c_1p808: ldo12 {
278			regulator-name = "vreg_l12c_1p808";
279			regulator-min-microvolt = <1704000>;
280			regulator-max-microvolt = <2928000>;
281			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
282		};
283
284		vreg_l13c_2p96: ldo13 {
285			regulator-name = "vreg_l13c_2p96";
286			regulator-min-microvolt = <2504000>;
287			regulator-max-microvolt = <2960000>;
288			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
289		};
290
291		vreg_l15c_1p9: ldo15 {
292			regulator-name = "vreg_l15c_1p9";
293			regulator-min-microvolt = <1704000>;
294			regulator-max-microvolt = <2928000>;
295			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
296		};
297
298		vreg_l16c_3p008: ldo16 {
299			regulator-name = "vreg_l16c_3p008";
300			regulator-min-microvolt = <3008000>;
301			regulator-max-microvolt = <3008000>;
302			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
303		};
304
305		vreg_l18c_0p88: ldo18 {
306			regulator-name = "vreg_l18c_0p88";
307			regulator-min-microvolt = <880000>;
308			regulator-max-microvolt = <880000>;
309			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
310		};
311	};
312};
313
314&ethernet {
315	status = "okay";
316
317	snps,reset-gpio = <&tlmm 79 GPIO_ACTIVE_LOW>;
318	snps,reset-active-low;
319	snps,reset-delays-us = <0 11000 70000>;
320
321	snps,mtl-rx-config = <&mtl_rx_setup>;
322	snps,mtl-tx-config = <&mtl_tx_setup>;
323
324	pinctrl-names = "default";
325	pinctrl-0 = <&ethernet_defaults>;
326
327	phy-handle = <&rgmii_phy>;
328	phy-mode = "rgmii";
329	max-speed = <1000>;
330
331	mdio {
332		compatible = "snps,dwmac-mdio";
333		#address-cells = <1>;
334		#size-cells = <0>;
335
336		/* Micrel KSZ9031RNZ PHY */
337		rgmii_phy: phy@7 {
338			compatible = "ethernet-phy-ieee802.3-c22";
339			reg = <0x7>;
340
341			interrupts-extended = <&tlmm 124 IRQ_TYPE_EDGE_FALLING>;
342			device_type = "ethernet-phy";
343		};
344	};
345
346	mtl_rx_setup: rx-queues-config {
347		snps,rx-queues-to-use = <1>;
348		snps,rx-sched-sp;
349
350		queue0 {
351			snps,dcb-algorithm;
352			snps,map-to-dma-channel = <0x0>;
353			snps,route-up;
354			snps,priority = <0x1>;
355		};
356	};
357
358	mtl_tx_setup: tx-queues-config {
359		snps,tx-queues-to-use = <1>;
360		snps,tx-sched-wrr;
361
362		queue0 {
363			snps,weight = <0x10>;
364			snps,dcb-algorithm;
365			snps,priority = <0x0>;
366		};
367	};
368};
369
370&qupv3_id_1 {
371	status = "okay";
372};
373
374&remoteproc_adsp {
375	status = "okay";
376	firmware-name = "qcom/sa8155p/adsp.mdt";
377};
378
379&remoteproc_cdsp {
380	status = "okay";
381	firmware-name = "qcom/sa8155p/cdsp.mdt";
382};
383
384&sdhc_2 {
385	status = "okay";
386
387	cd-gpios = <&tlmm 4 GPIO_ACTIVE_LOW>;
388	pinctrl-names = "default", "sleep";
389	pinctrl-0 = <&sdc2_on>;
390	pinctrl-1 = <&sdc2_off>;
391	vqmmc-supply = <&vreg_l13c_2p96>; /* IO line power */
392	vmmc-supply = <&vreg_l17a_2p96>;  /* Card power line */
393	bus-width = <4>;
394	no-sdio;
395	no-mmc;
396};
397
398&uart2 {
399	status = "okay";
400};
401
402&uart9 {
403	status = "okay";
404};
405
406&ufs_mem_hc {
407	status = "okay";
408
409	reset-gpios = <&tlmm 175 GPIO_ACTIVE_LOW>;
410
411	vcc-supply = <&vreg_l10a_2p96>;
412	vcc-max-microamp = <750000>;
413	vccq-supply = <&vreg_l5c_1p2>;
414	vccq-max-microamp = <700000>;
415	vccq2-supply = <&vreg_s4a_1p8>;
416	vccq2-max-microamp = <750000>;
417};
418
419&ufs_mem_phy {
420	status = "okay";
421
422	vdda-phy-supply = <&vreg_l8c_1p2>;
423	vdda-pll-supply = <&vreg_l5a_0p88>;
424};
425
426&usb_1 {
427	status = "okay";
428};
429
430&usb_1_dwc3 {
431	dr_mode = "host";
432
433	pinctrl-names = "default";
434	pinctrl-0 = <&usb2phy_ac_en1_default>;
435};
436
437&usb_1_hsphy {
438	status = "okay";
439	vdda-pll-supply = <&vdd_usb_hs_core>;
440	vdda33-supply = <&vdda_usb_hs_3p1>;
441	vdda18-supply = <&vdda_usb_hs_1p8>;
442};
443
444&usb_1_qmpphy {
445	status = "disabled";
446};
447
448&usb_2 {
449	status = "okay";
450};
451
452&usb_2_dwc3 {
453	dr_mode = "host";
454
455	pinctrl-names = "default";
456	pinctrl-0 = <&usb2phy_ac_en2_default>;
457};
458
459&usb_2_hsphy {
460	status = "okay";
461	vdda-pll-supply = <&vdd_usb_hs_core>;
462	vdda33-supply = <&vdda_usb_hs_3p1>;
463	vdda18-supply = <&vdda_usb_hs_1p8>;
464};
465
466&usb_2_qmpphy {
467	status = "okay";
468	vdda-phy-supply = <&vreg_l8c_1p2>;
469	vdda-pll-supply = <&vdda_usb_ss_dp_core_1>;
470};
471
472&pcie0 {
473	status = "okay";
474};
475
476&pcie0_phy {
477	status = "okay";
478	vdda-phy-supply = <&vreg_l18c_0p88>;
479	vdda-pll-supply = <&vreg_l8c_1p2>;
480};
481
482&pcie1_phy {
483	vdda-phy-supply = <&vreg_l18c_0p88>;
484	vdda-pll-supply = <&vreg_l8c_1p2>;
485};
486
487&tlmm {
488	gpio-reserved-ranges = <0 4>;
489
490	sdc2_on: sdc2-on-state {
491		clk-pins {
492			pins = "sdc2_clk";
493			bias-disable;		/* No pull */
494			drive-strength = <16>;	/* 16 MA */
495		};
496
497		cmd-pins {
498			pins = "sdc2_cmd";
499			bias-pull-up;		/* pull up */
500			drive-strength = <16>;	/* 16 MA */
501		};
502
503		data-pins {
504			pins = "sdc2_data";
505			bias-pull-up;		/* pull up */
506			drive-strength = <16>;	/* 16 MA */
507		};
508
509		sd-cd-pins {
510			pins = "gpio96";
511			function = "gpio";
512			bias-pull-up;		/* pull up */
513			drive-strength = <2>;	/* 2 MA */
514		};
515	};
516
517	sdc2_off: sdc2-off-state {
518		clk-pins {
519			pins = "sdc2_clk";
520			bias-disable;		/* No pull */
521			drive-strength = <2>;	/* 2 MA */
522		};
523
524		cmd-pins {
525			pins = "sdc2_cmd";
526			bias-pull-up;		/* pull up */
527			drive-strength = <2>;	/* 2 MA */
528		};
529
530		data-pins {
531			pins = "sdc2_data";
532			bias-pull-up;		/* pull up */
533			drive-strength = <2>;	/* 2 MA */
534		};
535
536		sd-cd-pins {
537			pins = "gpio96";
538			function = "gpio";
539			bias-pull-up;		/* pull up */
540			drive-strength = <2>;	/* 2 MA */
541		};
542	};
543
544	usb2phy_ac_en1_default: usb2phy-ac-en1-default-state {
545		pins = "gpio113";
546		function = "usb2phy_ac";
547		bias-disable;
548		drive-strength = <2>;
549	};
550
551	usb2phy_ac_en2_default: usb2phy-ac-en2-default-state {
552		pins = "gpio123";
553		function = "usb2phy_ac";
554		bias-disable;
555		drive-strength = <2>;
556	};
557
558	ethernet_defaults: ethernet-defaults-state {
559		mdc-pins {
560			pins = "gpio7";
561			function = "rgmii";
562			bias-pull-up;
563		};
564
565		mdio-pins {
566			pins = "gpio59";
567			function = "rgmii";
568			bias-pull-up;
569		};
570
571		rgmii-rx-pins {
572			pins = "gpio117", "gpio118", "gpio119", "gpio120", "gpio115", "gpio116";
573			function = "rgmii";
574			bias-disable;
575			drive-strength = <2>;
576		};
577
578		rgmii-tx-pins {
579			pins = "gpio122", "gpio4", "gpio5", "gpio6", "gpio114", "gpio121";
580			function = "rgmii";
581			bias-pull-up;
582			drive-strength = <16>;
583		};
584
585		phy-intr-pins {
586			pins = "gpio124";
587			function = "emac_phy";
588			bias-disable;
589			drive-strength = <8>;
590		};
591
592		pps-pins {
593			pins = "gpio81";
594			function = "emac_pps";
595			bias-disable;
596			drive-strength = <8>;
597		};
598
599		phy-reset-pins {
600			pins = "gpio79";
601			function = "gpio";
602			bias-pull-up;
603			drive-strength = <16>;
604		};
605	};
606};
607