1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Copyright (c) 2021, Konrad Dybcio <konrad.dybcio@somainline.org>
4 */
5
6#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
7#include "sm8250.dtsi"
8#include "pm8150.dtsi"
9#include "pm8150b.dtsi"
10#include "pm8150l.dtsi"
11#include "pm8009.dtsi"
12
13/delete-node/ &adsp_mem;
14/delete-node/ &spss_mem;
15/delete-node/ &cdsp_secure_heap;
16
17/ {
18	qcom,msm-id = <356 0x20001>; /* SM8250 v2.1 */
19	qcom,board-id = <0x10008 0>;
20
21	chosen {
22		#address-cells = <2>;
23		#size-cells = <2>;
24		ranges;
25
26		framebuffer: framebuffer@9c000000 {
27			compatible = "simple-framebuffer";
28			reg = <0 0x9c000000 0 0x2300000>;
29			/* pdx203 BL initializes in 2.5k mode, not 4k */
30			width = <1096>;
31			height = <2560>;
32			stride = <(1096 * 4)>;
33			format = "a8r8g8b8";
34			/*
35			 * That's a lot of clocks, but it's necessary due
36			 * to unused clk cleanup & no panel driver yet..
37			 */
38			clocks = <&dispcc DISP_CC_MDSS_AHB_CLK>,
39				 <&gcc GCC_DISP_HF_AXI_CLK>,
40				 <&gcc GCC_DISP_SF_AXI_CLK>,
41				 <&dispcc DISP_CC_MDSS_VSYNC_CLK>,
42				 <&dispcc DISP_CC_MDSS_MDP_CLK>,
43				 <&dispcc DISP_CC_MDSS_BYTE0_CLK>,
44				 <&dispcc DISP_CC_MDSS_BYTE0_INTF_CLK>,
45				 <&dispcc DISP_CC_MDSS_PCLK0_CLK>,
46				 <&dispcc DISP_CC_MDSS_ESC0_CLK>;
47			power-domains = <&dispcc MDSS_GDSC>;
48		};
49	};
50
51	gpio_keys: gpio-keys {
52		compatible = "gpio-keys";
53
54		/*
55		 * Camera focus (light press) and camera snapshot (full press)
56		 * seem not to work properly.. Adding the former one stalls the CPU
57		 * and the latter kills the volume down key for whatever reason. In any
58		 * case, they are both on &pm8150b_gpios: camera focus(2), camera snapshot(1).
59		 */
60
61		key-vol-down {
62			label = "Volume Down";
63			linux,code = <KEY_VOLUMEDOWN>;
64			gpios = <&pm8150_gpios 1 GPIO_ACTIVE_LOW>;
65			debounce-interval = <15>;
66			linux,can-disable;
67			wakeup-source;
68		};
69	};
70
71	vph_pwr: vph-pwr-regulator {
72		compatible = "regulator-fixed";
73		regulator-name = "vph_pwr";
74		regulator-min-microvolt = <3700000>;
75		regulator-max-microvolt = <3700000>;
76	};
77
78	/* S6c is really ebi.lvl but it's there for supply map completeness sake. */
79	vreg_s6c_0p88: smpc6-regulator {
80		compatible = "regulator-fixed";
81		regulator-name = "vreg_s6c_0p88";
82
83		regulator-min-microvolt = <880000>;
84		regulator-max-microvolt = <880000>;
85		regulator-always-on;
86		vin-supply = <&vph_pwr>;
87	};
88
89	reserved-memory {
90		adsp_mem: memory@8a100000 {
91			reg = <0x0 0x8a100000 0x0 0x2500000>;
92			no-map;
93		};
94
95		spss_mem: memory@8c600000 {
96			reg = <0x0 0x8c600000 0x0 0x100000>;
97			no-map;
98		};
99
100		cdsp_secure_heap: memory@8c700000 {
101			reg = <0x0 0x8c700000 0x0 0x4600000>;
102			no-map;
103		};
104
105		cont_splash_mem: memory@9c000000 {
106			reg = <0x0 0x9c000000 0x0 0x2300000>;
107			no-map;
108		};
109
110		ramoops@ffc00000 {
111			compatible = "ramoops";
112			reg = <0x0 0xffc00000 0x0 0x100000>;
113			record-size = <0x1000>;
114			console-size = <0x40000>;
115			msg-size = <0x20000 0x20000>;
116			ecc-size = <16>;
117			no-map;
118		};
119	};
120};
121
122&adsp {
123	status = "okay";
124};
125
126&apps_rsc {
127	regulators-0 {
128		compatible = "qcom,pm8150-rpmh-regulators";
129		qcom,pmic-id = "a";
130
131		vdd-s1-supply = <&vph_pwr>;
132		vdd-s2-supply = <&vph_pwr>;
133		vdd-s3-supply = <&vph_pwr>;
134		vdd-s4-supply = <&vph_pwr>;
135		vdd-s5-supply = <&vph_pwr>;
136		vdd-s6-supply = <&vph_pwr>;
137		vdd-s7-supply = <&vph_pwr>;
138		vdd-s8-supply = <&vph_pwr>;
139		vdd-s9-supply = <&vph_pwr>;
140		vdd-s10-supply = <&vph_pwr>;
141		vdd-l1-l8-l11-supply = <&vreg_s6c_0p88>;
142		vdd-l2-l10-supply = <&vreg_bob>;
143		vdd-l3-l4-l5-l18-supply = <&vreg_s6a_0p6>;
144		vdd-l6-l9-supply = <&vreg_s8c_1p2>;
145		vdd-l7-l12-l14-l15-supply = <&vreg_s5a_1p9>;
146		vdd-l13-l16-l17-supply = <&vreg_bob>;
147
148		/* (S1+S2+S3) - cx.lvl (ARC) */
149
150		vreg_s4a_1p8: smps4 {
151			regulator-name = "vreg_s4a_1p8";
152			regulator-min-microvolt = <1800000>;
153			regulator-max-microvolt = <1920000>;
154			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
155		};
156
157		vreg_s5a_1p9: smps5 {
158			regulator-name = "vreg_s5a_1p9";
159			regulator-min-microvolt = <1824000>;
160			regulator-max-microvolt = <2040000>;
161			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
162		};
163
164		vreg_s6a_0p6: smps6 {
165			regulator-name = "vreg_s6a_0p6";
166			regulator-min-microvolt = <600000>;
167			regulator-max-microvolt = <1128000>;
168			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
169		};
170
171		vreg_l2a_3p1: ldo2 {
172			regulator-name = "vreg_l2a_3p1";
173			regulator-min-microvolt = <3072000>;
174			regulator-max-microvolt = <3072000>;
175			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
176		};
177
178		vreg_l3a_0p9: ldo3 {
179			regulator-name = "vreg_l3a_0p9";
180			regulator-min-microvolt = <928000>;
181			regulator-max-microvolt = <932000>;
182			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
183		};
184
185		/* L4 - lmx.lvl (ARC) */
186
187		vreg_l5a_0p88: ldo5 {
188			regulator-name = "vreg_l5a_0p88";
189			regulator-min-microvolt = <880000>;
190			regulator-max-microvolt = <880000>;
191			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
192		};
193
194		vreg_l6a_1p2: ldo6 {
195			regulator-name = "vreg_l6a_1p2";
196			regulator-min-microvolt = <1200000>;
197			regulator-max-microvolt = <1200000>;
198			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
199		};
200
201		/* L7 is unused. */
202
203		vreg_l9a_1p2: ldo9 {
204			regulator-name = "vreg_l9a_1p2";
205			regulator-min-microvolt = <1200000>;
206			regulator-max-microvolt = <1200000>;
207			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
208		};
209
210		/* L10 is unused, L11 - lcx.lvl (ARC) */
211
212		vreg_l12a_1p8: ldo12 {
213			regulator-name = "vreg_l12a_1p8";
214			regulator-min-microvolt = <1800000>;
215			regulator-max-microvolt = <1800000>;
216			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
217		};
218
219		/* L13 is unused. */
220
221		vreg_l14a_1p8: ldo14 {
222			regulator-name = "vreg_l14a_1p8";
223			regulator-min-microvolt = <1800000>;
224			regulator-max-microvolt = <1880000>;
225			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
226		};
227
228		/* L15 & L16 are unused. */
229
230		vreg_l17a_3p0: ldo17 {
231			regulator-name = "vreg_l17a_3p0";
232			regulator-min-microvolt = <2496000>;
233			regulator-max-microvolt = <3008000>;
234			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
235		};
236
237		vreg_l18a_0p9: ldo18 {
238			regulator-name = "vreg_l18a_0p9";
239			regulator-min-microvolt = <800000>;
240			regulator-max-microvolt = <920000>;
241			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
242		};
243	};
244
245	/*
246	 * Remaining regulators that are not yet supported:
247	 * OLEDB: 4925000-8100000
248	 * ab: 4600000-6100000
249	 * ibb: 800000-5400000
250	 */
251	regulators-1 {
252		compatible = "qcom,pm8150l-rpmh-regulators";
253		qcom,pmic-id = "c";
254
255		vdd-s1-supply = <&vph_pwr>;
256		vdd-s2-supply = <&vph_pwr>;
257		vdd-s3-supply = <&vph_pwr>;
258		vdd-s4-supply = <&vph_pwr>;
259		vdd-s5-supply = <&vph_pwr>;
260		vdd-s6-supply = <&vph_pwr>;
261		vdd-s7-supply = <&vph_pwr>;
262		vdd-s8-supply = <&vph_pwr>;
263		vdd-l1-l8-supply = <&vreg_s4a_1p8>;
264		vdd-l2-l3-supply = <&vreg_s8c_1p2>;
265		vdd-l4-l5-l6-supply = <&vreg_bob>;
266		vdd-l7-l11-supply = <&vreg_bob>;
267		vdd-l9-l10-supply = <&vreg_bob>;
268		vdd-bob-supply = <&vph_pwr>;
269
270		vreg_bob: bob {
271			regulator-name = "vreg_bob";
272			regulator-min-microvolt = <3350000>;
273			regulator-max-microvolt = <3960000>;
274			regulator-initial-mode = <RPMH_REGULATOR_MODE_AUTO>;
275		};
276
277		/*
278		 * S1-S6 are ARCs:
279		 * (S1+S2) - gfx.lvl,
280		 * S3 - mx.lvl,
281		 * (S4+S5) - mmcx.lvl,
282		 * S6 - ebi.lvl
283		 */
284
285		vreg_s7c_0p35: smps7 {
286			regulator-name = "vreg_s7c_0p35";
287			regulator-min-microvolt = <348000>;
288			regulator-max-microvolt = <1000000>;
289			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
290		};
291
292		vreg_s8c_1p2: smps8 {
293			regulator-name = "vreg_s8c_1p2";
294			regulator-min-microvolt = <1200000>;
295			regulator-max-microvolt = <1400000>;
296			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
297		};
298
299		vreg_l1c_1p8: ldo1 {
300			regulator-name = "vreg_l1c_1p8";
301			regulator-min-microvolt = <1800000>;
302			regulator-max-microvolt = <1800000>;
303			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
304		};
305
306		/* L2-4 are unused. */
307
308		vreg_l5c_1p8: ldo5 {
309			regulator-name = "vreg_l5c_1p8";
310			regulator-min-microvolt = <1800000>;
311			regulator-max-microvolt = <2800000>;
312			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
313		};
314
315		vreg_l6c_2p9: ldo6 {
316			regulator-name = "vreg_l6c_2p9";
317			regulator-min-microvolt = <1800000>;
318			regulator-max-microvolt = <2960000>;
319			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
320			regulator-allow-set-load;
321			regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM
322						   RPMH_REGULATOR_MODE_HPM>;
323		};
324
325		vreg_l7c_2p85: ldo7 {
326			regulator-name = "vreg_l7c_2p85";
327			regulator-min-microvolt = <2856000>;
328			regulator-max-microvolt = <3104000>;
329			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
330		};
331
332		vreg_l8c_1p8: ldo8 {
333			regulator-name = "vreg_l8c_1p8";
334			regulator-min-microvolt = <1800000>;
335			regulator-max-microvolt = <1800000>;
336			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
337		};
338
339		vreg_l9c_2p9: ldo9 {
340			regulator-name = "vreg_l9c_2p9";
341			regulator-min-microvolt = <2704000>;
342			regulator-max-microvolt = <2960000>;
343			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
344			regulator-allow-set-load;
345			regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM
346						   RPMH_REGULATOR_MODE_HPM>;
347		};
348
349		vreg_l10c_3p3: ldo10 {
350			regulator-name = "vreg_l10c_3p3";
351			regulator-min-microvolt = <3296000>;
352			regulator-max-microvolt = <3296000>;
353			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
354		};
355
356		vreg_l11c_3p0: ldo11 {
357			regulator-name = "vreg_l11c_3p0";
358			regulator-min-microvolt = <3000000>;
359			regulator-max-microvolt = <3000000>;
360			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
361		};
362	};
363
364	regulators-2 {
365		compatible = "qcom,pm8009-rpmh-regulators";
366		qcom,pmic-id = "f";
367
368		vdd-s1-supply = <&vph_pwr>;
369		vdd-s2-supply = <&vreg_bob>;
370		vdd-l2-supply = <&vreg_s8c_1p2>;
371		vdd-l5-l6-supply = <&vreg_bob>;
372		vdd-l7-supply = <&vreg_s4a_1p8>;
373
374		vreg_s1f_1p2: smps1 {
375			regulator-name = "vreg_s1f_1p2";
376			regulator-min-microvolt = <1200000>;
377			regulator-max-microvolt = <1200000>;
378			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
379		};
380
381		vreg_s2f_0p5: smps2 {
382			regulator-name = "vreg_s2f_0p5";
383			regulator-min-microvolt = <512000>;
384			regulator-max-microvolt = <1100000>;
385			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
386		};
387
388		/* L1 is unused. */
389
390		vreg_l2f_1p3: ldo2 {
391			regulator-name = "vreg_l2f_1p3";
392			regulator-min-microvolt = <1304000>;
393			regulator-max-microvolt = <1304000>;
394			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
395		};
396
397		/* L3 & L4 are unused. */
398
399		vreg_l5f_2p8: ldo5 {
400			regulator-name = "vreg_l5f_2p85";
401			regulator-min-microvolt = <2800000>;
402			regulator-max-microvolt = <2800000>;
403			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
404		};
405
406		vreg_l6f_2p8: ldo6 {
407			regulator-name = "vreg_l6f_2p8";
408			regulator-min-microvolt = <2800000>;
409			regulator-max-microvolt = <2800000>;
410			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
411		};
412
413		vreg_l7f_1p8: ldo7 {
414			regulator-name = "vreg_l7f_1p8";
415			regulator-min-microvolt = <1800000>;
416			regulator-max-microvolt = <1800000>;
417			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
418		};
419	};
420};
421
422&cdsp {
423	status = "okay";
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&i2c1 {
439	status = "okay";
440	clock-frequency = <400000>;
441
442	nfc@28 {
443		compatible = "nxp,nxp-nci-i2c";
444		reg = <0x28>;
445
446		interrupt-parent = <&tlmm>;
447		interrupts = <111 IRQ_TYPE_EDGE_RISING>;
448
449		enable-gpios = <&tlmm 6 GPIO_ACTIVE_HIGH>;
450		firmware-gpios = <&tlmm 110 GPIO_ACTIVE_HIGH>;
451	};
452};
453
454&i2c2 {
455	status = "okay";
456	clock-frequency = <1000000>;
457
458	cs35l41_l: speaker-amp@40 {
459		compatible = "cirrus,cs35l41";
460		reg = <0x40>;
461		interrupt-parent = <&tlmm>;
462		interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
463		reset-gpios = <&tlmm 10 GPIO_ACTIVE_HIGH>;
464		cirrus,boost-peak-milliamp = <4000>;
465		cirrus,boost-ind-nanohenry = <1000>;
466		cirrus,boost-cap-microfarad = <15>;
467		cirrus,asp-sdout-hiz = <3>;
468		cirrus,gpio2-src-select = <2>;
469		cirrus,gpio2-output-enable;
470		#sound-dai-cells = <1>;
471	};
472
473	cs35l41_r: speaker-amp@41 {
474		compatible = "cirrus,cs35l41";
475		reg = <0x41>;
476		interrupt-parent = <&tlmm>;
477		interrupts = <11 IRQ_TYPE_LEVEL_LOW>;
478		reset-gpios = <&tlmm 10 GPIO_ACTIVE_HIGH>;
479		cirrus,boost-peak-milliamp = <4000>;
480		cirrus,boost-ind-nanohenry = <1000>;
481		cirrus,boost-cap-microfarad = <15>;
482		cirrus,asp-sdout-hiz = <3>;
483		cirrus,gpio2-src-select = <2>;
484		cirrus,gpio2-output-enable;
485		#sound-dai-cells = <1>;
486	};
487};
488
489&i2c5 {
490	status = "okay";
491	clock-frequency = <400000>;
492
493	/* Dialog SLG51000 CMIC @ 75 */
494};
495
496&i2c9 {
497	status = "okay";
498	clock-frequency = <400000>;
499
500	/* AMS TCS3490 RGB+IR color sensor @ 72 */
501};
502
503&i2c13 {
504	status = "okay";
505	clock-frequency = <400000>;
506
507	touchscreen@48 {
508		compatible = "samsung,s6sy761";
509		reg = <0x48>;
510		interrupt-parent = <&tlmm>;
511		interrupts = <39 0x2008>;
512		/* It's "vddio" downstream but it works anyway! */
513		vdd-supply = <&vreg_l1c_1p8>;
514		avdd-supply = <&vreg_l10c_3p3>;
515
516		pinctrl-names = "default";
517		pinctrl-0 = <&ts_int_default>;
518	};
519};
520
521&i2c15 {
522	status = "okay";
523	clock-frequency = <400000>;
524
525	/* Qcom SMB1390 @ 10 */
526	/* Qcom SMB1390_slave @ 18 */
527	/* HALO HL6111R Qi charger @ 25 */
528};
529
530&pcie0 {
531	status = "okay";
532};
533
534&pcie0_phy {
535	status = "okay";
536
537	vdda-phy-supply = <&vreg_l5a_0p88>;
538	vdda-pll-supply = <&vreg_l9a_1p2>;
539};
540
541&pcie2 {
542	status = "okay";
543
544	pinctrl-0 = <&pcie2_default_state &mdm2ap_default &ap2mdm_default>;
545};
546
547&pcie2_phy {
548	status = "okay";
549
550	vdda-phy-supply = <&vreg_l5a_0p88>;
551	vdda-pll-supply = <&vreg_l9a_1p2>;
552};
553
554&pon_pwrkey {
555	status = "okay";
556};
557
558&pon_resin {
559	status = "okay";
560
561	linux,code = <KEY_VOLUMEUP>;
562};
563
564&qupv3_id_0 {
565	status = "okay";
566};
567
568&qupv3_id_1 {
569	status = "okay";
570};
571
572&qupv3_id_2 {
573	status = "okay";
574};
575
576&sdhc_2 {
577	status = "okay";
578
579	cd-gpios = <&tlmm 77 GPIO_ACTIVE_HIGH>;
580	pinctrl-names = "default", "sleep";
581	pinctrl-0 = <&sdc2_default_state &sdc2_card_det_n>;
582	pinctrl-1 = <&sdc2_sleep_state &sdc2_card_det_n>;
583	vmmc-supply = <&vreg_l9c_2p9>;
584	vqmmc-supply = <&vreg_l6c_2p9>;
585	bus-width = <4>;
586	no-sdio;
587	no-mmc;
588};
589
590&slpi {
591	status = "okay";
592};
593
594&tlmm {
595	gpio-reserved-ranges = <40 4>, <52 4>;
596
597	sdc2_default_state: sdc2-default-state {
598		clk-pins {
599			pins = "sdc2_clk";
600			drive-strength = <16>;
601			bias-disable;
602		};
603
604		cmd-pins {
605			pins = "sdc2_cmd";
606			drive-strength = <16>;
607			bias-pull-up;
608		};
609
610		data-pins {
611			pins = "sdc2_data";
612			drive-strength = <16>;
613			bias-pull-up;
614		};
615	};
616
617	mdm2ap_default: mdm2ap-default-state {
618		pins = "gpio1", "gpio3";
619		function = "gpio";
620		drive-strength = <8>;
621		bias-disable;
622	};
623
624	ts_int_default: ts-int-default-state {
625		pins = "gpio39";
626		function = "gpio";
627		drive-strength = <2>;
628		bias-disable;
629	};
630
631	ap2mdm_default: ap2mdm-default-state {
632		pins = "gpio56", "gpio57";
633		function = "gpio";
634		drive-strength = <16>;
635		bias-disable;
636	};
637
638	sdc2_card_det_n: sd-card-det-n-state {
639		pins = "gpio77";
640		function = "gpio";
641		bias-pull-up;
642		drive-strength = <2>;
643	};
644};
645
646&uart12 {
647	status = "okay";
648};
649
650/* BIG WARNING! DO NOT TOUCH UFS, YOUR DEVICE WILL DIE! */
651&ufs_mem_hc { status = "disabled"; };
652&ufs_mem_phy { status = "disabled"; };
653
654&usb_1 {
655	status = "okay";
656};
657
658&usb_1_dwc3 {
659	dr_mode = "peripheral";
660};
661
662&usb_1_hsphy {
663	status = "okay";
664
665	vdda-pll-supply = <&vreg_l5a_0p88>;
666	vdda18-supply = <&vreg_l12a_1p8>;
667	vdda33-supply = <&vreg_l2a_3p1>;
668};
669
670&usb_1_qmpphy {
671	status = "okay";
672
673	vdda-phy-supply = <&vreg_l9a_1p2>;
674	vdda-pll-supply = <&vreg_l18a_0p9>;
675};
676
677&venus {
678	firmware-name = "qcom/sm8250/Sony/edo/venus.mbn";
679	status = "okay";
680};
681