1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Copyright (c) 2022, Konrad Dybcio <konrad.dybcio@somainline.org>
4 */
5
6#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
7#include "sm8450.dtsi"
8
9/delete-node/ &adsp_mem;
10/delete-node/ &rmtfs_mem;
11/delete-node/ &video_mem;
12
13/ {
14	chassis-type = "handset";
15
16	aliases {
17		serial0 = &uart7;
18	};
19
20	chosen {
21		stdout-path = "serial0:115200n8";
22	};
23
24	reserved-memory {
25		adsp_mem: memory@85700000 {
26			reg = <0x0 0x85700000 0x0 0x2800000>;
27			no-map;
28		};
29
30		video_mem: memory@9fd00000 {
31			reg = <0x0 0x9fd00000 0x0 0x700000>;
32			no-map;
33		};
34
35		rmtfs_mem: memory@f3300000 {
36			compatible = "qcom,rmtfs-mem";
37			reg = <0x0 0xf3300000 0x0 0x280000>;
38			no-map;
39
40			qcom,client-id = <1>;
41			qcom,vmid = <15>;
42		};
43
44		ramoops@ffc00000 {
45			compatible = "ramoops";
46			reg = <0 0xffc00000 0 0x200000>;
47			console-size = <0x40000>;
48			record-size = <0x1000>;
49			ecc-size = <16>;
50			no-map;
51		};
52	};
53
54	/* Sadly, the voltages for these GPIO regulators are unknown. */
55	imx650_vana_vreg: imx650-vana-regulator {
56		compatible = "regulator-fixed";
57		regulator-name = "imx650_vana_vreg";
58		gpio = <&tlmm 23 GPIO_ACTIVE_HIGH>;
59		enable-active-high;
60	};
61
62	vph_pwr: vph-pwr-regulator {
63		compatible = "regulator-fixed";
64		regulator-name = "vph_pwr";
65		regulator-min-microvolt = <3700000>;
66		regulator-max-microvolt = <3700000>;
67
68		regulator-always-on;
69		regulator-boot-on;
70	};
71};
72
73&apps_rsc {
74	pm8350-rpmh-regulators {
75		compatible = "qcom,pm8350-rpmh-regulators";
76		qcom,pmic-id = "b";
77
78		vdd-s1-supply = <&vph_pwr>;
79		vdd-s2-supply = <&vph_pwr>;
80		vdd-s3-supply = <&vph_pwr>;
81		vdd-s4-supply = <&vph_pwr>;
82		vdd-s5-supply = <&vph_pwr>;
83		vdd-s6-supply = <&vph_pwr>;
84		vdd-s7-supply = <&vph_pwr>;
85		vdd-s8-supply = <&vph_pwr>;
86		vdd-s9-supply = <&vph_pwr>;
87		vdd-s10-supply = <&vph_pwr>;
88		vdd-s11-supply = <&vph_pwr>;
89		vdd-s12-supply = <&vph_pwr>;
90
91		vdd-l1-l4-supply = <&pm8350_s11>;
92		vdd-l2-l7-supply = <&vreg_bob>;
93		vdd-l3-l5-supply = <&vreg_bob>;
94		vdd-l6-l9-l10-supply = <&pm8350_s12>;
95
96		/*
97		 * ARC regulators:
98		 * s5 - gfx.lvl
99		 * l8 - lcx.lvl
100		 */
101
102		pm8350_s10: smps10 {
103			regulator-name = "pm8350_s10";
104			regulator-min-microvolt = <1800000>;
105			regulator-max-microvolt = <1800000>;
106		};
107
108		pm8350_s11: smps11 {
109			regulator-name = "pm8350_s11";
110			regulator-min-microvolt = <848000>;
111			regulator-max-microvolt = <1104000>;
112		};
113
114		pm8350_s12: smps12 {
115			regulator-name = "pm8350_s12";
116			regulator-min-microvolt = <1224000>;
117			regulator-max-microvolt = <1400000>;
118		};
119
120		pm8350_l1: ldo1 {
121			regulator-name = "pm8350_l1";
122			regulator-min-microvolt = <912000>;
123			regulator-max-microvolt = <920000>;
124			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
125		};
126
127		pm8350_l2: ldo2 {
128			regulator-name = "pm8350_l2";
129			regulator-min-microvolt = <3072000>;
130			regulator-max-microvolt = <3072000>;
131			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
132		};
133
134		pm8350_l3: ldo3 {
135			regulator-name = "pm8350_l3";
136			regulator-min-microvolt = <904000>;
137			regulator-max-microvolt = <904000>;
138			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
139		};
140
141		pm8350_l5: ldo5 {
142			regulator-name = "pm8350_l5";
143			regulator-min-microvolt = <880000>;
144			regulator-max-microvolt = <912000>;
145			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
146		};
147
148		pm8350_l6: ldo6 {
149			regulator-name = "pm8350_l6";
150			regulator-min-microvolt = <1200000>;
151			regulator-max-microvolt = <1200000>;
152			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
153		};
154
155		pm8350_l7: ldo7 {
156			regulator-name = "pm8350_l7";
157			regulator-min-microvolt = <2504000>;
158			regulator-max-microvolt = <2504000>;
159			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
160		};
161
162		pm8350_l9: ldo9 {
163			regulator-name = "pm8350_l9";
164			regulator-min-microvolt = <1200000>;
165			regulator-max-microvolt = <1200000>;
166			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
167		};
168	};
169
170	pm8350c-rpmh-regulators {
171		compatible = "qcom,pm8350c-rpmh-regulators";
172		qcom,pmic-id = "c";
173
174		vdd-s1-supply = <&vph_pwr>;
175		vdd-s2-supply = <&vph_pwr>;
176		vdd-s3-supply = <&vph_pwr>;
177		vdd-s4-supply = <&vph_pwr>;
178		vdd-s5-supply = <&vph_pwr>;
179		vdd-s6-supply = <&vph_pwr>;
180		vdd-s7-supply = <&vph_pwr>;
181		vdd-s8-supply = <&vph_pwr>;
182		vdd-s9-supply = <&vph_pwr>;
183		vdd-s10-supply = <&vph_pwr>;
184
185		vdd-l1-l12-supply = <&vreg_bob>;
186		vdd-l2-l8-supply = <&vreg_bob>;
187		vdd-l3-l4-l5-l7-l13-supply = <&vreg_bob>;
188		vdd-l6-l9-l11-supply = <&vreg_bob>;
189		vdd-l10-supply = <&pm8350_s12>;
190
191		vdd-bob-supply = <&vph_pwr>;
192
193		/*
194		 * ARC regulators:
195		 * s2 - mxc.lvl
196		 * s4 - mss.lvl
197		 * s6 - cx.lvl
198		 */
199
200		pm8350c_s1: smps1 {
201			regulator-name = "pm8350c_s1";
202			regulator-min-microvolt = <1800000>;
203			regulator-max-microvolt = <2024000>;
204		};
205
206		pm8350c_s10: smps10 {
207			regulator-name = "pm8350c_s10";
208			regulator-min-microvolt = <1000000>;
209			regulator-max-microvolt = <1100000>;
210		};
211
212		vreg_bob: bob {
213			regulator-name = "vreg_bob";
214			regulator-min-microvolt = <3400000>;
215			regulator-max-microvolt = <3960000>;
216			regulator-initial-mode = <RPMH_REGULATOR_MODE_AUTO>;
217		};
218
219		pm8350c_l1: ldo1 {
220			regulator-name = "pm8350c_l1";
221			regulator-min-microvolt = <1800000>;
222			regulator-max-microvolt = <1800000>;
223			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
224		};
225
226		pm8350c_l2: ldo2 {
227			regulator-name = "pm8350c_l2";
228			regulator-min-microvolt = <1800000>;
229			regulator-max-microvolt = <1800000>;
230			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
231		};
232
233		pm8350c_l3: ldo3 {
234			regulator-name = "pm8350c_l3";
235			regulator-min-microvolt = <3296000>;
236			regulator-max-microvolt = <3304000>;
237			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
238		};
239
240		pm8350c_l4: ldo4 {
241			regulator-name = "pm8350c_l4";
242			regulator-min-microvolt = <1704000>;
243			regulator-max-microvolt = <3000000>;
244			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
245		};
246
247		pm8350c_l5: ldo5 {
248			regulator-name = "pm8350c_l5";
249			regulator-min-microvolt = <1704000>;
250			regulator-max-microvolt = <3000000>;
251			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
252		};
253
254		pm8350c_l6: ldo6 {
255			regulator-name = "pm8350c_l6";
256			regulator-min-microvolt = <2960000>;
257			/* Originally max = 3008000 but SDHCI expects 2960000 */
258			regulator-max-microvolt = <2960000>;
259			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
260		};
261
262		pm8350c_l7: ldo7 {
263			regulator-name = "pm8350c_l7";
264			regulator-min-microvolt = <3008000>;
265			regulator-max-microvolt = <3008000>;
266			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
267		};
268
269		pm8350c_l8: ldo8 {
270			regulator-name = "pm8350c_l8";
271			regulator-min-microvolt = <1800000>;
272			regulator-max-microvolt = <1800000>;
273			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
274		};
275
276		pm8350c_l9: ldo9 {
277			regulator-name = "pm8350c_l9";
278			regulator-min-microvolt = <2960000>;
279			/* Originally max = 3008000 but SDHCI expects 2960000 */
280			regulator-max-microvolt = <2960000>;
281			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
282		};
283
284		pm8350c_l10: ldo10 {
285			regulator-name = "pm8350c_l10";
286			regulator-min-microvolt = <1200000>;
287			regulator-max-microvolt = <1200000>;
288			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
289		};
290
291		pm8350c_l12: ldo12 {
292			regulator-name = "pm8350c_l12";
293			regulator-min-microvolt = <1800000>;
294			regulator-max-microvolt = <1968000>;
295			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
296		};
297
298		pm8350c_l13: ldo13 {
299			regulator-name = "pm8350c_l13";
300			regulator-min-microvolt = <3000000>;
301			regulator-max-microvolt = <3000000>;
302			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
303		};
304	};
305
306	pm8450-rpmh-regulators {
307		compatible = "qcom,pm8450-rpmh-regulators";
308		qcom,pmic-id = "h";
309
310		vdd-s1-supply = <&vph_pwr>;
311		vdd-s2-supply = <&vph_pwr>;
312		vdd-s3-supply = <&vph_pwr>;
313		vdd-s4-supply = <&vph_pwr>;
314		vdd-s5-supply = <&vph_pwr>;
315		vdd-s6-supply = <&vph_pwr>;
316
317		vdd-l2-supply = <&vreg_bob>;
318		vdd-l3-supply = <&vreg_bob>;
319		vdd-l4-supply = <&vreg_bob>;
320
321		/*
322		 * ARC regulators:
323		 * S2 - ebi.lvl
324		 * S4 - mmcx.lvl
325		 * S6 - mx.lvl
326		 * L1 - lmx.lvl
327		 */
328
329		pm8450_s3: smps3 {
330			regulator-name = "pm8450_s3";
331			regulator-min-microvolt = <500000>;
332			regulator-max-microvolt = <600000>;
333		};
334
335		pm8450_l2: ldo2 {
336			regulator-name = "pm8450_l2";
337			regulator-min-microvolt = <880000>;
338			regulator-max-microvolt = <912000>;
339			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
340		};
341
342		pm8450_l3: ldo3 {
343			regulator-name = "pm8450_l3";
344			regulator-min-microvolt = <912000>;
345			regulator-max-microvolt = <912000>;
346			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
347		};
348	};
349
350	pmr735a-rpmh-regulators {
351		compatible = "qcom,pmr735a-rpmh-regulators";
352		qcom,pmic-id = "e";
353
354		vdd-s1-supply = <&vph_pwr>;
355		vdd-s2-supply = <&vph_pwr>;
356		vdd-s3-supply = <&vph_pwr>;
357
358		vdd-l1-l2-supply = <&pmr735a_s2>;
359		vdd-l3-supply = <&pmr735a_s1>;
360		vdd-l4-supply = <&pm8350c_s1>;
361		vdd-l5-l6-supply = <&pm8350c_s1>;
362		vdd-l7-bob-supply = <&vreg_bob>;
363
364		pmr735a_s1: smps1 {
365			regulator-name = "pmr735a_s1";
366			regulator-min-microvolt = <1200000>;
367			regulator-max-microvolt = <1296000>;
368		};
369
370		pmr735a_s2: smps2 {
371			regulator-name = "pmr735a_s2";
372			regulator-min-microvolt = <500000>;
373			regulator-max-microvolt = <1040000>;
374		};
375
376		pmr735a_s3: smps3 {
377			regulator-name = "pmr735a_s3";
378			regulator-min-microvolt = <435000>;
379			regulator-max-microvolt = <2352000>;
380		};
381
382		pmr735a_l1: ldo1 {
383			regulator-name = "pmr735a_l1";
384			regulator-min-microvolt = <800000>;
385			regulator-max-microvolt = <800000>;
386		};
387
388		pmr735a_l2: ldo2 {
389			regulator-name = "pmr735a_l2";
390			regulator-min-microvolt = <480000>;
391			regulator-max-microvolt = <912000>;
392		};
393
394		pmr735a_l3: ldo3 {
395			regulator-name = "pmr735a_l3";
396			regulator-min-microvolt = <1200000>;
397			regulator-max-microvolt = <1200000>;
398		};
399
400		pmr735a_l4: ldo4 {
401			regulator-name = "pmr735a_l4";
402			regulator-min-microvolt = <1776000>;
403			regulator-max-microvolt = <1776000>;
404		};
405
406		pmr735a_l5: ldo5 {
407			regulator-name = "pmr735a_l5";
408			regulator-min-microvolt = <880000>;
409			regulator-max-microvolt = <880000>;
410		};
411
412		pmr735a_l6: ldo6 {
413			regulator-name = "pmr735a_l6";
414			regulator-min-microvolt = <1200000>;
415			regulator-max-microvolt = <1200000>;
416		};
417
418		pmr735a_l7: ldo7 {
419			regulator-name = "pmr735a_l7";
420			regulator-min-microvolt = <2800000>;
421			regulator-max-microvolt = <2800000>;
422		};
423	};
424};
425
426&gpi_dma0 {
427	status = "okay";
428};
429
430&gpi_dma1 {
431	status = "okay";
432};
433
434&gpi_dma2 {
435	status = "okay";
436};
437
438&i2c4 {
439	clock-frequency = <400000>;
440	status = "okay";
441
442	touchscreen@48 {
443		compatible = "samsung,s6sy761";
444		reg = <0x48>;
445		interrupt-parent = <&tlmm>;
446		interrupts = <21 0x2008>;
447		vdd-supply = <&pm8350c_l2>;
448		avdd-supply = <&pm8350c_l3>;
449
450		pinctrl-names = "default";
451		pinctrl-0 = <&ts_reset_default &ts_int_default>;
452	};
453};
454
455&i2c5 {
456	clock-frequency = <400000>;
457	status = "okay";
458
459	/* Dialog SLG51000 CMIC @ 75 */
460};
461
462&i2c9 {
463	clock-frequency = <400000>;
464	status = "okay";
465
466	/* NXP SN1X0 NFC @ 28 */
467};
468
469&i2c13 {
470	clock-frequency = <400000>;
471	status = "okay";
472
473	/* Richwave RTC6226 FM Radio Receiver @ 64 */
474};
475
476&i2c14 {
477	clock-frequency = <1000000>;
478	status = "okay";
479
480	cs35l41_l: speaker-amp@40 {
481		compatible = "cirrus,cs35l41";
482		reg = <0x40>;
483		interrupt-parent = <&tlmm>;
484		interrupts = <182 IRQ_TYPE_LEVEL_LOW>;
485		reset-gpios = <&tlmm 183 GPIO_ACTIVE_HIGH>;
486		cirrus,boost-peak-milliamp = <4000>;
487		cirrus,boost-ind-nanohenry = <1000>;
488		cirrus,boost-cap-microfarad = <15>;
489		cirrus,gpio2-src-select = <2>;
490		cirrus,gpio2-output-enable;
491		cirrus,asp-sdout-hiz = <3>;
492		#sound-dai-cells = <1>;
493	};
494
495	cs35l41_r: speaker-amp@41 {
496		compatible = "cirrus,cs35l41";
497		reg = <0x41>;
498		interrupt-parent = <&tlmm>;
499		interrupts = <182 IRQ_TYPE_LEVEL_LOW>;
500		reset-gpios = <&tlmm 183 GPIO_ACTIVE_HIGH>;
501		cirrus,boost-peak-milliamp = <4000>;
502		cirrus,boost-ind-nanohenry = <1000>;
503		cirrus,boost-cap-microfarad = <15>;
504		cirrus,gpio2-src-select = <2>;
505		cirrus,gpio2-output-enable;
506		cirrus,asp-sdout-hiz = <3>;
507		#sound-dai-cells = <1>;
508	};
509};
510
511&i2c15 {
512	clock-frequency = <400000>;
513	status = "okay";
514
515	/* AMS TCS3490 RGB+IR color sensor @ 72 */
516};
517
518&i2c19 {
519	clock-frequency = <1000000>;
520	status = "okay";
521
522	/* Cirrus Logic CS40L25A boosted haptics driver @ 40 */
523};
524
525&pcie0 {
526	max-link-speed = <2>;
527	status = "okay";
528};
529
530&pcie0_phy {
531	vdda-phy-supply = <&pm8350_l5>;
532	vdda-pll-supply = <&pm8350_l6>;
533	status = "okay";
534};
535
536&remoteproc_adsp {
537	firmware-name = "qcom/sm8350/Sony/nagara/adsp.mbn";
538	status = "okay";
539};
540
541&remoteproc_cdsp {
542	firmware-name = "qcom/sm8350/Sony/nagara/cdsp.mbn";
543	status = "okay";
544};
545
546&remoteproc_slpi {
547	firmware-name = "qcom/sm8350/Sony/nagara/slpi.mbn";
548	status = "okay";
549};
550
551&qupv3_id_0 {
552	status = "okay";
553};
554
555&qupv3_id_1 {
556	status = "okay";
557};
558
559&qupv3_id_2 {
560	status = "okay";
561};
562
563&sdhc_2 {
564	cd-gpios = <&tlmm 92 GPIO_ACTIVE_HIGH>;
565	pinctrl-names = "default", "sleep";
566	pinctrl-0 = <&sdc2_default_state &sdc2_card_det_n>;
567	pinctrl-1 = <&sdc2_sleep_state &sdc2_card_det_n>;
568	vmmc-supply = <&pm8350c_l9>;
569	vqmmc-supply = <&pm8350c_l6>;
570	no-sdio;
571	no-mmc;
572	status = "okay";
573};
574
575&spi10 {
576	status = "okay";
577
578	/* NXP SN1X0 NFC Secure Element @ 0 */
579};
580
581&tlmm {
582	gpio-reserved-ranges = <28 4>;
583
584	ts_reset_default: ts-reset-default-state {
585		pins = "gpio20";
586		function = "gpio";
587		drive-strength = <2>;
588		bias-disable;
589		output-high;
590	};
591
592	ts_int_default: ts-int-default-state {
593		pins = "gpio21";
594		function = "gpio";
595		drive-strength = <2>;
596		bias-disable;
597		input-enable;
598	};
599
600	sdc2_card_det_n: sd-card-det-n-state {
601		pins = "gpio92";
602		function = "gpio";
603		drive-strength = <2>;
604		bias-pull-up;
605	};
606};
607
608&uart7 {
609	status = "okay";
610};
611
612&usb_1 {
613	status = "okay";
614};
615
616&usb_1_dwc3 {
617	dr_mode = "peripheral";
618};
619
620&usb_1_hsphy {
621	vdda-pll-supply = <&pm8350_l5>;
622	vdda18-supply = <&pm8350c_l1>;
623	vdda33-supply = <&pm8350_l2>;
624	status = "okay";
625};
626
627&usb_1_qmpphy {
628	vdda-phy-supply = <&pm8350_l6>;
629	vdda-pll-supply = <&pm8350_l1>;
630	status = "okay";
631};
632