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