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