1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Copyright (c) 2017-2019, The Linux Foundation. All rights reserved.
4 * Copyright (c) 2020-2023, Linaro Limited
5 */
6
7/dts-v1/;
8
9#include <dt-bindings/gpio/gpio.h>
10#include <dt-bindings/input/gpio-keys.h>
11#include <dt-bindings/input/input.h>
12#include <dt-bindings/regulator/qcom,rpmh-regulator.h>
13#include "sc8180x.dtsi"
14#include "sc8180x-pmics.dtsi"
15
16/ {
17	model = "Qualcomm SC8180x Primus";
18	compatible = "qcom,sc8180x-primus", "qcom,sc8180x";
19
20	aliases {
21		serial0 = &uart12;
22		serial1 = &uart13;
23	};
24
25	backlight: backlight {
26		compatible = "pwm-backlight";
27		pwms = <&pmc8180c_lpg 4 1000000>;
28		enable-gpios = <&pmc8180c_gpios 8 GPIO_ACTIVE_HIGH>;
29
30		pinctrl-names = "default";
31		pinctrl-0 = <&bl_pwm_default>;
32	};
33
34	chosen {
35		stdout-path = "serial0:115200n8";
36	};
37
38	gpio-keys {
39		compatible = "gpio-keys";
40
41		pinctrl-names = "default";
42		pinctrl-0 = <&hall_int_active_state>;
43
44		lid-switch {
45			gpios = <&tlmm 121 GPIO_ACTIVE_HIGH>;
46			linux,input-type = <EV_SW>;
47			linux,code = <SW_LID>;
48			wakeup-source;
49			wakeup-event-action = <EV_ACT_DEASSERTED>;
50		};
51	};
52
53	reserved-memory {
54		rmtfs_mem: rmtfs-region@85500000 {
55			compatible = "qcom,rmtfs-mem";
56			reg = <0x0 0x85500000 0x0 0x200000>;
57			no-map;
58
59			qcom,client-id = <1>;
60			qcom,vmid = <15>;
61		};
62
63		wlan_mem: wlan-region@8bc00000 {
64			reg = <0x0 0x8bc00000 0x0 0x180000>;
65			no-map;
66		};
67
68		adsp_mem: adsp-region@96e00000 {
69			reg = <0x0 0x96e00000 0x0 0x1c00000>;
70			no-map;
71		};
72
73		mpss_mem: mpss-region@8d800000 {
74			reg = <0x0 0x8d800000 0x0 0x9600000>;
75			no-map;
76		};
77
78		gpu_mem: gpu-region@98a00000 {
79			reg = <0x0 0x98a00000 0x0 0x2000>;
80			no-map;
81		};
82
83		reserved-region@9a500000 {
84			reg = <0x0 0x9a500000 0x0 0x600000>;
85			no-map;
86		};
87	};
88
89	vreg_nvme_0p9: nvme-0p9-regulator {
90		compatible = "regulator-fixed";
91		regulator-name = "vreg_nvme_0p9";
92
93		regulator-min-microvolt = <900000>;
94		regulator-max-microvolt = <900000>;
95
96		regulator-always-on;
97	};
98
99	vreg_nvme_3p3: nvme-3p3-regulator {
100		compatible = "regulator-fixed";
101		regulator-name = "vreg_nvme_3p3";
102
103		regulator-min-microvolt = <3300000>;
104		regulator-max-microvolt = <3300000>;
105
106		gpio = <&pmc8180c_gpios 11 0>;
107		enable-active-high;
108
109		regulator-always-on;
110	};
111
112	vdd_kb_tp_3v3: vdd-kb-tp-3v3-regulator {
113		compatible = "regulator-fixed";
114		regulator-name = "vdd_kb_tp_3v3";
115		regulator-min-microvolt = <3300000>;
116		regulator-max-microvolt = <3300000>;
117
118		gpio = <&tlmm 4 GPIO_ACTIVE_HIGH>;
119		enable-active-high;
120
121		regulator-always-on;
122
123		pinctrl-names = "default";
124		pinctrl-0 = <&kb_tp_3v3_en_active_state>;
125	};
126
127	vph_pwr: vph-pwr-regulator {
128		compatible = "regulator-fixed";
129		regulator-name = "vph_pwr";
130		regulator-min-microvolt = <3700000>;
131		regulator-max-microvolt = <3700000>;
132	};
133
134	vreg_s4a_1p8: pm8150-s4 {
135		compatible = "regulator-fixed";
136		regulator-name = "vreg_s4a_1p8";
137
138		regulator-min-microvolt = <1800000>;
139		regulator-max-microvolt = <1800000>;
140
141		regulator-always-on;
142		regulator-boot-on;
143
144		vin-supply = <&vph_pwr>;
145	};
146};
147
148&apps_rsc {
149	regulators-0 {
150		compatible = "qcom,pmc8180-rpmh-regulators";
151		qcom,pmic-id = "a";
152
153		vdd-s5-supply = <&vph_pwr>;
154		vdd-l7-l12-l14-l15-supply = <&vreg_s5a_2p0>;
155
156		vreg_s5a_2p0: smps5 {
157			regulator-min-microvolt = <2040000>;
158			regulator-max-microvolt = <2100000>;
159		};
160
161		vreg_l7a_1p8: ldo7 {
162			regulator-min-microvolt = <1800000>;
163			regulator-max-microvolt = <1800000>;
164			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
165		};
166
167		vreg_l9a_1p3: ldo9 {
168			regulator-min-microvolt = <1296000>;
169			regulator-max-microvolt = <1304000>;
170			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
171		};
172
173		vreg_l12a_1p8: ldo12 {
174			regulator-min-microvolt = <1800000>;
175			regulator-max-microvolt = <1800000>;
176			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
177		};
178	};
179
180	regulators-1 {
181		compatible = "qcom,pmc8180c-rpmh-regulators";
182		qcom,pmic-id = "c";
183
184		vdd-s6-supply = <&vph_pwr>;
185		vdd-s8-supply = <&vph_pwr>;
186		vdd-l2-l3-supply = <&vreg_s6c_1p35>;
187		vdd-bob-supply = <&vph_pwr>;
188
189		vreg_s6c_1p35: smps6 {
190			regulator-min-microvolt = <1350000>;
191			regulator-max-microvolt = <1372000>;
192			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
193		};
194
195		vreg_s8c_1p8: smps8 {
196			regulator-min-microvolt = <1800000>;
197			regulator-max-microvolt = <1800000>;
198			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
199			regulator-always-on;
200		};
201
202		vreg_l3c_1p2: ldo3 {
203			regulator-min-microvolt = <1200000>;
204			regulator-max-microvolt = <1200000>;
205			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
206		};
207
208		vreg_l4c_3p3: ldo4 {
209			regulator-min-microvolt = <3008000>;
210			regulator-max-microvolt = <3008000>;
211			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
212		};
213
214		vreg_l10c_3p3: ldo10 {
215			regulator-min-microvolt = <3000000>;
216			regulator-max-microvolt = <3312000>;
217			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
218		};
219
220		vreg_l11c_3p3: ldo11 {
221			regulator-min-microvolt = <3296000>;
222			regulator-max-microvolt = <3304000>;
223			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
224		};
225
226		vreg_bob: bob {
227			regulator-min-microvolt = <3296000>;
228			regulator-max-microvolt = <3350000>;
229			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
230		};
231	};
232
233	regulators-2 {
234		compatible = "qcom,pmc8180-rpmh-regulators";
235		qcom,pmic-id = "e";
236
237		vdd-s4-supply = <&vph_pwr>;
238		vdd-s5-supply = <&vph_pwr>;
239		vdd-l2-l10-supply = <&vreg_bob>;
240		vdd-l3-l4-l5-l18-supply = <&vreg_s4e_0p98>;
241		vdd-l7-l12-l14-l15-supply = <&vreg_s5e_2p05>;
242		vdd-l13-l16-l17-supply = <&vreg_bob>;
243
244		vreg_s4e_0p98: smps4 {
245			regulator-min-microvolt = <992000>;
246			regulator-max-microvolt = <992000>;
247			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
248		};
249
250		vreg_s5e_2p05: smps5 {
251			regulator-min-microvolt = <2040000>;
252			regulator-max-microvolt = <2040000>;
253			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
254		};
255
256		vreg_l1e_0p75: ldo1 {
257			regulator-min-microvolt = <752000>;
258			regulator-max-microvolt = <752000>;
259			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
260		};
261
262		vreg_l5e_0p88: ldo5 {
263			regulator-min-microvolt = <880000>;
264			regulator-max-microvolt = <880000>;
265			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
266		};
267
268		vreg_l7e_1p8: ldo7 {
269			regulator-min-microvolt = <1800000>;
270			regulator-max-microvolt = <1800000>;
271			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
272		};
273
274		vreg_l10e_2p9: ldo10 {
275			regulator-min-microvolt = <2904000>;
276			regulator-max-microvolt = <2904000>;
277			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
278		};
279
280		vreg_l12e: ldo12 {
281			regulator-min-microvolt = <1800000>;
282			regulator-max-microvolt = <1800000>;
283			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
284		};
285
286		vreg_l16e_3p0: ldo16 {
287			regulator-min-microvolt = <3072000>;
288			regulator-max-microvolt = <3072000>;
289			regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>;
290		};
291	};
292};
293
294&dispcc {
295	status = "okay";
296};
297
298&gpu {
299	status = "okay";
300
301	zap-shader {
302		memory-region = <&gpu_mem>;
303		firmware-name = "qcom/sc8180x/qcdxkmsuc8180.mbn";
304	};
305};
306
307&i2c1 {
308	clock-frequency = <100000>;
309
310	pinctrl-names = "default";
311	pinctrl-0 = <&ts_i2c_active_state>;
312
313	status = "okay";
314
315	touchscreen@10 {
316		compatible = "hid-over-i2c";
317		reg = <0x10>;
318		hid-descr-addr = <0x1>;
319
320		vdd-supply = <&vreg_l4c_3p3>;
321		vddl-supply = <&vreg_l12e>;
322
323		post-power-on-delay-ms = <20>;
324
325		interrupts-extended = <&tlmm 122 IRQ_TYPE_LEVEL_LOW>;
326
327		pinctrl-names = "default";
328		pinctrl-0 = <&ts_active_state>;
329	};
330};
331
332&i2c7 {
333	clock-frequency = <100000>;
334
335	pinctrl-names = "default";
336	pinctrl-0 = <&aux_i2c_active_state>;
337
338	status = "okay";
339
340	touchpad@15 {
341		compatible = "hid-over-i2c";
342		reg = <0x15>;
343		hid-descr-addr = <0x1>;
344
345		interrupts-extended = <&tlmm 24 IRQ_TYPE_LEVEL_LOW>;
346
347		pinctrl-names = "default";
348		pinctrl-0 = <&tp_int_active_state>;
349
350		vdd-supply = <&vdd_kb_tp_3v3>;
351	};
352
353	keyboard@3a {
354		compatible = "hid-over-i2c";
355		reg = <0x3a>;
356		hid-descr-addr = <0x1>;
357		interrupts-extended = <&tlmm 37 IRQ_TYPE_LEVEL_LOW>;
358
359		pinctrl-names = "default";
360		pinctrl-0 = <&kb_int_active_state>;
361
362		vdd-supply = <&vdd_kb_tp_3v3>;
363	};
364};
365
366&mdss {
367	status = "okay";
368};
369
370&mdss_edp {
371	data-lanes = <0 1 2 3>;
372
373	pinctrl-names = "default";
374	pinctrl-0 = <&edp_hpd_active>;
375
376	status = "okay";
377
378	aux-bus {
379		panel {
380			compatible = "edp-panel";
381
382			backlight = <&backlight>;
383
384			ports {
385				port {
386					auo_b133han05_in: endpoint {
387						remote-endpoint = <&mdss_edp_out>;
388					};
389				};
390			};
391		};
392	};
393
394	ports {
395		port@1 {
396			reg = <1>;
397			mdss_edp_out: endpoint {
398				remote-endpoint = <&auo_b133han05_in>;
399			};
400		};
401	};
402};
403
404&pcie1 {
405	perst-gpio = <&tlmm 175 GPIO_ACTIVE_LOW>;
406	wake-gpio = <&tlmm 177 GPIO_ACTIVE_HIGH>;
407	pinctrl-names = "default";
408	pinctrl-0 = <&pcie2_default_state>;
409
410	status = "okay";
411};
412
413&pcie1_phy {
414	vdda-phy-supply = <&vreg_l5e_0p88>;
415	vdda-pll-supply = <&vreg_l3c_1p2>;
416
417	status = "okay";
418};
419
420&pmc8180c_lpg {
421	status = "okay";
422};
423
424&qupv3_id_0 {
425	status = "okay";
426};
427
428&qupv3_id_1 {
429	status = "okay";
430};
431
432&qupv3_id_2 {
433	status = "okay";
434};
435
436&remoteproc_adsp {
437	memory-region = <&adsp_mem>;
438	firmware-name = "qcom/sc8180x/qcadsp8180.mbn";
439
440	status = "okay";
441};
442
443&remoteproc_mpss {
444	memory-region = <&mpss_mem>;
445	firmware-name = "qcom/sc8180x/qcmpss8180.mbn";
446
447	status = "okay";
448};
449
450&uart12 {
451	compatible = "qcom,geni-debug-uart";
452	status = "okay";
453};
454
455&uart13 {
456	pinctrl-names = "default";
457	pinctrl-0 = <&uart13_state>;
458
459	status = "okay";
460
461	bluetooth {
462		compatible = "qcom,wcn3998-bt";
463
464		vddio-supply = <&vreg_s4a_1p8>;
465		vddxo-supply = <&vreg_l7a_1p8>;
466		vddrf-supply = <&vreg_l9a_1p3>;
467		vddch0-supply = <&vreg_l11c_3p3>;
468		max-speed = <3200000>;
469	};
470};
471
472&ufs_mem_hc {
473	reset-gpios = <&tlmm 190 GPIO_ACTIVE_LOW>;
474
475	vcc-supply = <&vreg_l10e_2p9>;
476	vcc-max-microamp = <155000>;
477
478	vccq2-supply = <&vreg_l7e_1p8>;
479	vccq2-max-microamp = <425000>;
480
481	status = "okay";
482};
483
484&ufs_mem_phy {
485	vdda-phy-supply = <&vreg_l5e_0p88>;
486	vdda-pll-supply = <&vreg_l3c_1p2>;
487
488	status = "okay";
489};
490
491&usb_prim_hsphy {
492	vdda-pll-supply = <&vreg_l5e_0p88>;
493	vdda18-supply = <&vreg_l12a_1p8>;
494	vdda33-supply = <&vreg_l16e_3p0>;
495
496	status = "okay";
497};
498
499&usb_prim_qmpphy {
500	vdda-phy-supply = <&vreg_l3c_1p2>;
501	vdda-pll-supply = <&vreg_l5e_0p88>;
502
503	status = "okay";
504};
505
506&usb_prim {
507	status = "okay";
508};
509
510&usb_prim_dwc3 {
511	dr_mode = "host";
512};
513
514&usb_sec_hsphy {
515	vdda-pll-supply = <&vreg_l5e_0p88>;
516	vdda18-supply = <&vreg_l12a_1p8>;
517	vdda33-supply = <&vreg_l16e_3p0>;
518
519	status = "okay";
520};
521
522&usb_sec_qmpphy {
523	vdda-phy-supply = <&vreg_l3c_1p2>;
524	vdda-pll-supply = <&vreg_l5e_0p88>;
525
526	status = "okay";
527};
528
529&usb_sec {
530	status = "okay";
531};
532
533&usb_sec_dwc3 {
534	dr_mode = "host";
535};
536
537&wifi {
538	memory-region = <&wlan_mem>;
539
540	vdd-0.8-cx-mx-supply = <&vreg_l1e_0p75>;
541	vdd-1.8-xo-supply = <&vreg_l7a_1p8>;
542	vdd-1.3-rfa-supply = <&vreg_l9a_1p3>;
543	vdd-3.3-ch0-supply = <&vreg_l11c_3p3>;
544	vdd-3.3-ch1-supply = <&vreg_l10c_3p3>;
545
546	status = "okay";
547};
548
549&xo_board_clk {
550	clock-frequency = <38400000>;
551};
552
553/* PINCTRL */
554
555&pmc8180c_gpios {
556	bl_pwm_default: bl-pwm-default-state {
557		en-pins {
558			pins = "gpio8";
559			function = "normal";
560		};
561
562		pwm-pins {
563			pins = "gpio10";
564			function = "func1";
565		};
566	};
567};
568
569&tlmm {
570	gpio-reserved-ranges = <0 4>, <47 4>, <126 4>;
571
572	aux_i2c_active_state: aux-i2c-active-state {
573		pins = "gpio98", "gpio99";
574		function = "qup7";
575
576		bias-disable;
577		drive-strength = <16>;
578	};
579
580	edp_hpd_active: epd-hpd-active-state {
581		pins = "gpio10";
582		function = "edp_hot";
583	};
584
585	hall_int_active_state: hall-int-active-state {
586		pins = "gpio121";
587		function = "gpio";
588
589		input-enable;
590		bias-disable;
591	};
592
593	kb_int_active_state: kb-int-active-state {
594		int-n-pins {
595			pins = "gpio37";
596			function = "gpio";
597
598			bias-pull-up;
599			intput-enable;
600		};
601
602		kp-disable-pins {
603			pins = "gpio135";
604			function = "gpio";
605
606			output-high;
607		};
608	};
609
610	kb_tp_3v3_en_active_state: kb-tp-3v3-en-active-state {
611		pins = "gpio4";
612		function = "gpio";
613
614		bias-disable;
615	};
616
617	pcie2_default_state: pcie2-default-state {
618		clkreq-pins {
619			pins = "gpio176";
620			function = "pci_e2";
621			bias-pull-up;
622		};
623
624		reset-n-pins {
625			pins = "gpio175";
626			function = "gpio";
627
628			drive-strength = <2>;
629			output-low;
630			bias-pull-down;
631		};
632
633		wake-n-pins {
634			pins = "gpio177";
635			function = "gpio";
636
637			drive-strength = <2>;
638			bias-pull-up;
639		};
640	};
641
642	tp_int_active_state: tp-int-active-state {
643		tp-int-pins {
644			pins = "gpio24";
645			function = "gpio";
646
647			bias-disable;
648			input-enable;
649		};
650
651		tp-close-n-pins {
652			pins = "gpio116";
653			function = "gpio";
654
655			bias-disable;
656			input-enable;
657		};
658	};
659
660	ts_active_state: ts-active-state {
661		int-n-pins {
662			pins = "gpio122";
663			function = "gpio";
664
665			input-enable;
666			bias-disable;
667		};
668
669		reset-n-pins {
670			pins = "gpio54";
671			function = "gpio";
672
673			output-high;
674		};
675	};
676
677	ts_i2c_active_state: ts-i2c-active-state {
678		pins = "gpio114", "gpio115";
679		function = "qup1";
680
681		/* External pull up */
682		bias-disable;
683		drive-strength = <2>;
684	};
685
686	uart13_state: uart13-state {
687		cts-pins {
688			pins = "gpio43";
689			function = "qup13";
690			bias-pull-down;
691		};
692
693		rts-tx-pins {
694			pins = "gpio44", "gpio45";
695			function = "qup13";
696			drive-strength = <2>;
697			bias-disable;
698		};
699
700		rx-pins {
701			pins = "gpio46";
702			function = "qup13";
703			bias-pull-up;
704		};
705	};
706};
707