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 is used, it hosts a Samsung touchscreen, but GPI DMA is broken.. */
439
440&i2c5 {
441	clock-frequency = <400000>;
442	status = "okay";
443
444	/* Dialog SLG51000 CMIC @ 75 */
445};
446
447&i2c9 {
448	clock-frequency = <400000>;
449	status = "okay";
450
451	/* NXP SN1X0 NFC @ 28 */
452};
453
454&i2c13 {
455	clock-frequency = <400000>;
456	status = "okay";
457
458	/* Richwave RTC6226 FM Radio Receiver @ 64 */
459};
460
461&i2c14 {
462	clock-frequency = <1000000>;
463	status = "okay";
464
465	cs35l41_l: speaker-amp@40 {
466		compatible = "cirrus,cs35l41";
467		reg = <0x40>;
468		interrupt-parent = <&tlmm>;
469		interrupts = <182 IRQ_TYPE_LEVEL_LOW>;
470		reset-gpios = <&tlmm 183 GPIO_ACTIVE_HIGH>;
471		cirrus,boost-peak-milliamp = <4000>;
472		cirrus,boost-ind-nanohenry = <1000>;
473		cirrus,boost-cap-microfarad = <15>;
474		cirrus,gpio2-src-select = <2>;
475		cirrus,gpio2-output-enable;
476		cirrus,asp-sdout-hiz = <3>;
477		#sound-dai-cells = <1>;
478	};
479
480	cs35l41_r: speaker-amp@41 {
481		compatible = "cirrus,cs35l41";
482		reg = <0x41>;
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
496&i2c15 {
497	clock-frequency = <400000>;
498	status = "okay";
499
500	/* AMS TCS3490 RGB+IR color sensor @ 72 */
501};
502
503&i2c19 {
504	clock-frequency = <1000000>;
505	status = "okay";
506
507	/* Cirrus Logic CS40L25A boosted haptics driver @ 40 */
508};
509
510&pcie0 {
511	max-link-speed = <2>;
512	status = "okay";
513};
514
515&pcie0_phy {
516	vdda-phy-supply = <&pm8350_l5>;
517	vdda-pll-supply = <&pm8350_l6>;
518	status = "okay";
519};
520
521&remoteproc_adsp {
522	firmware-name = "qcom/sm8350/Sony/nagara/adsp.mbn";
523	status = "okay";
524};
525
526&remoteproc_cdsp {
527	firmware-name = "qcom/sm8350/Sony/nagara/cdsp.mbn";
528	status = "okay";
529};
530
531&remoteproc_slpi {
532	firmware-name = "qcom/sm8350/Sony/nagara/slpi.mbn";
533	status = "okay";
534};
535
536&qupv3_id_0 {
537	status = "okay";
538};
539
540&qupv3_id_1 {
541	status = "okay";
542};
543
544&qupv3_id_2 {
545	status = "okay";
546};
547
548&sdhc_2 {
549	cd-gpios = <&tlmm 92 GPIO_ACTIVE_HIGH>;
550	pinctrl-names = "default", "sleep";
551	pinctrl-0 = <&sdc2_default_state &sdc2_card_det_n>;
552	pinctrl-1 = <&sdc2_sleep_state &sdc2_card_det_n>;
553	vmmc-supply = <&pm8350c_l9>;
554	vqmmc-supply = <&pm8350c_l6>;
555	no-sdio;
556	no-mmc;
557	status = "okay";
558};
559
560&spi10 {
561	status = "okay";
562
563	/* NXP SN1X0 NFC Secure Element @ 0 */
564};
565
566&tlmm {
567	gpio-reserved-ranges = <28 4>;
568
569	ts_int_default: ts-int-default-state {
570		pins = "gpio23";
571		function = "gpio";
572		drive-strength = <2>;
573		bias-disable;
574		input-enable;
575	};
576
577	sdc2_card_det_n: sd-card-det-n-state {
578		pins = "gpio92";
579		function = "gpio";
580		drive-strength = <2>;
581		bias-pull-up;
582	};
583};
584
585&uart7 {
586	status = "okay";
587};
588
589&usb_1 {
590	status = "okay";
591};
592
593&usb_1_dwc3 {
594	dr_mode = "peripheral";
595};
596
597&usb_1_hsphy {
598	vdda-pll-supply = <&pm8350_l5>;
599	vdda18-supply = <&pm8350c_l1>;
600	vdda33-supply = <&pm8350_l2>;
601	status = "okay";
602};
603
604&usb_1_qmpphy {
605	vdda-phy-supply = <&pm8350_l6>;
606	vdda-pll-supply = <&pm8350_l1>;
607	status = "okay";
608};
609