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&gpu {
295	status = "okay";
296
297	zap-shader {
298		memory-region = <&gpu_mem>;
299		firmware-name = "qcom/sc8180x/qcdxkmsuc8180.mbn";
300	};
301};
302
303&i2c1 {
304	clock-frequency = <100000>;
305
306	pinctrl-names = "default";
307	pinctrl-0 = <&ts_i2c_active_state>;
308
309	status = "okay";
310
311	touchscreen@10 {
312		compatible = "hid-over-i2c";
313		reg = <0x10>;
314		hid-descr-addr = <0x1>;
315
316		vdd-supply = <&vreg_l4c_3p3>;
317		vddl-supply = <&vreg_l12e>;
318
319		post-power-on-delay-ms = <20>;
320
321		interrupts-extended = <&tlmm 122 IRQ_TYPE_LEVEL_LOW>;
322
323		pinctrl-names = "default";
324		pinctrl-0 = <&ts_active_state>;
325	};
326};
327
328&i2c7 {
329	clock-frequency = <100000>;
330
331	pinctrl-names = "default";
332	pinctrl-0 = <&aux_i2c_active_state>;
333
334	status = "okay";
335
336	touchpad@15 {
337		compatible = "hid-over-i2c";
338		reg = <0x15>;
339		hid-descr-addr = <0x1>;
340
341		interrupts-extended = <&tlmm 24 IRQ_TYPE_LEVEL_LOW>;
342
343		pinctrl-names = "default";
344		pinctrl-0 = <&tp_int_active_state>;
345
346		vdd-supply = <&vdd_kb_tp_3v3>;
347	};
348
349	keyboard@3a {
350		compatible = "hid-over-i2c";
351		reg = <0x3a>;
352		hid-descr-addr = <0x1>;
353		interrupts-extended = <&tlmm 37 IRQ_TYPE_LEVEL_LOW>;
354
355		pinctrl-names = "default";
356		pinctrl-0 = <&kb_int_active_state>;
357
358		vdd-supply = <&vdd_kb_tp_3v3>;
359	};
360};
361
362&mdss {
363	status = "okay";
364};
365
366&mdss_edp {
367	data-lanes = <0 1 2 3>;
368
369	pinctrl-names = "default";
370	pinctrl-0 = <&edp_hpd_active>;
371
372	status = "okay";
373
374	aux-bus {
375		panel {
376			compatible = "edp-panel";
377
378			backlight = <&backlight>;
379
380			ports {
381				port {
382					auo_b133han05_in: endpoint {
383						remote-endpoint = <&mdss_edp_out>;
384					};
385				};
386			};
387		};
388	};
389
390	ports {
391		port@1 {
392			reg = <1>;
393			mdss_edp_out: endpoint {
394				remote-endpoint = <&auo_b133han05_in>;
395			};
396		};
397	};
398};
399
400&pcie1 {
401	perst-gpio = <&tlmm 175 GPIO_ACTIVE_LOW>;
402	wake-gpio = <&tlmm 177 GPIO_ACTIVE_HIGH>;
403	pinctrl-names = "default";
404	pinctrl-0 = <&pcie2_default_state>;
405
406	status = "okay";
407};
408
409&pcie1_phy {
410	vdda-phy-supply = <&vreg_l5e_0p88>;
411	vdda-pll-supply = <&vreg_l3c_1p2>;
412
413	status = "okay";
414};
415
416&pmc8180c_lpg {
417	status = "okay";
418};
419
420&qupv3_id_0 {
421	status = "okay";
422};
423
424&qupv3_id_1 {
425	status = "okay";
426};
427
428&qupv3_id_2 {
429	status = "okay";
430};
431
432&remoteproc_adsp {
433	memory-region = <&adsp_mem>;
434	firmware-name = "qcom/sc8180x/qcadsp8180.mbn";
435
436	status = "okay";
437};
438
439&remoteproc_mpss {
440	memory-region = <&mpss_mem>;
441	firmware-name = "qcom/sc8180x/qcmpss8180.mbn";
442
443	status = "okay";
444};
445
446&uart12 {
447	compatible = "qcom,geni-debug-uart";
448	status = "okay";
449};
450
451&uart13 {
452	pinctrl-names = "default";
453	pinctrl-0 = <&uart13_state>;
454
455	status = "okay";
456
457	bluetooth {
458		compatible = "qcom,wcn3998-bt";
459
460		vddio-supply = <&vreg_s4a_1p8>;
461		vddxo-supply = <&vreg_l7a_1p8>;
462		vddrf-supply = <&vreg_l9a_1p3>;
463		vddch0-supply = <&vreg_l11c_3p3>;
464		max-speed = <3200000>;
465	};
466};
467
468&ufs_mem_hc {
469	reset-gpios = <&tlmm 190 GPIO_ACTIVE_LOW>;
470
471	vcc-supply = <&vreg_l10e_2p9>;
472	vcc-max-microamp = <155000>;
473
474	vccq2-supply = <&vreg_l7e_1p8>;
475	vccq2-max-microamp = <425000>;
476
477	status = "okay";
478};
479
480&ufs_mem_phy {
481	vdda-phy-supply = <&vreg_l5e_0p88>;
482	vdda-pll-supply = <&vreg_l3c_1p2>;
483
484	status = "okay";
485};
486
487&usb_prim_hsphy {
488	vdda-pll-supply = <&vreg_l5e_0p88>;
489	vdda18-supply = <&vreg_l12a_1p8>;
490	vdda33-supply = <&vreg_l16e_3p0>;
491
492	status = "okay";
493};
494
495&usb_prim_qmpphy {
496	vdda-phy-supply = <&vreg_l3c_1p2>;
497	vdda-pll-supply = <&vreg_l5e_0p88>;
498
499	status = "okay";
500};
501
502&usb_prim {
503	status = "okay";
504};
505
506&usb_prim_dwc3 {
507	dr_mode = "host";
508};
509
510&usb_sec_hsphy {
511	vdda-pll-supply = <&vreg_l5e_0p88>;
512	vdda18-supply = <&vreg_l12a_1p8>;
513	vdda33-supply = <&vreg_l16e_3p0>;
514
515	status = "okay";
516};
517
518&usb_sec_qmpphy {
519	vdda-phy-supply = <&vreg_l3c_1p2>;
520	vdda-pll-supply = <&vreg_l5e_0p88>;
521
522	status = "okay";
523};
524
525&usb_sec {
526	status = "okay";
527};
528
529&usb_sec_dwc3 {
530	dr_mode = "host";
531};
532
533&wifi {
534	memory-region = <&wlan_mem>;
535
536	vdd-0.8-cx-mx-supply = <&vreg_l1e_0p75>;
537	vdd-1.8-xo-supply = <&vreg_l7a_1p8>;
538	vdd-1.3-rfa-supply = <&vreg_l9a_1p3>;
539	vdd-3.3-ch0-supply = <&vreg_l11c_3p3>;
540	vdd-3.3-ch1-supply = <&vreg_l10c_3p3>;
541
542	status = "okay";
543};
544
545&xo_board_clk {
546	clock-frequency = <38400000>;
547};
548
549/* PINCTRL */
550
551&pmc8180c_gpios {
552	bl_pwm_default: bl-pwm-default-state {
553		en-pins {
554			pins = "gpio8";
555			function = "normal";
556		};
557
558		pwm-pins {
559			pins = "gpio10";
560			function = "func1";
561		};
562	};
563};
564
565&tlmm {
566	gpio-reserved-ranges = <0 4>, <47 4>, <126 4>;
567
568	aux_i2c_active_state: aux-i2c-active-state {
569		pins = "gpio98", "gpio99";
570		function = "qup7";
571
572		bias-disable;
573		drive-strength = <16>;
574	};
575
576	edp_hpd_active: epd-hpd-active-state {
577		pins = "gpio10";
578		function = "edp_hot";
579	};
580
581	hall_int_active_state: hall-int-active-state {
582		pins = "gpio121";
583		function = "gpio";
584
585		input-enable;
586		bias-disable;
587	};
588
589	kb_int_active_state: kb-int-active-state {
590		int-n-pins {
591			pins = "gpio37";
592			function = "gpio";
593
594			bias-pull-up;
595			intput-enable;
596		};
597
598		kp-disable-pins {
599			pins = "gpio135";
600			function = "gpio";
601
602			output-high;
603		};
604	};
605
606	kb_tp_3v3_en_active_state: kb-tp-3v3-en-active-state {
607		pins = "gpio4";
608		function = "gpio";
609
610		bias-disable;
611	};
612
613	pcie2_default_state: pcie2-default-state {
614		clkreq-pins {
615			pins = "gpio176";
616			function = "pci_e2";
617			bias-pull-up;
618		};
619
620		reset-n-pins {
621			pins = "gpio175";
622			function = "gpio";
623
624			drive-strength = <2>;
625			output-low;
626			bias-pull-down;
627		};
628
629		wake-n-pins {
630			pins = "gpio177";
631			function = "gpio";
632
633			drive-strength = <2>;
634			bias-pull-up;
635		};
636	};
637
638	tp_int_active_state: tp-int-active-state {
639		tp-int-pins {
640			pins = "gpio24";
641			function = "gpio";
642
643			bias-disable;
644			input-enable;
645		};
646
647		tp-close-n-pins {
648			pins = "gpio116";
649			function = "gpio";
650
651			bias-disable;
652			input-enable;
653		};
654	};
655
656	ts_active_state: ts-active-state {
657		int-n-pins {
658			pins = "gpio122";
659			function = "gpio";
660
661			input-enable;
662			bias-disable;
663		};
664
665		reset-n-pins {
666			pins = "gpio54";
667			function = "gpio";
668
669			output-high;
670		};
671	};
672
673	ts_i2c_active_state: ts-i2c-active-state {
674		pins = "gpio114", "gpio115";
675		function = "qup1";
676
677		/* External pull up */
678		bias-disable;
679		drive-strength = <2>;
680	};
681
682	uart13_state: uart13-state {
683		cts-pins {
684			pins = "gpio43";
685			function = "qup13";
686			bias-pull-down;
687		};
688
689		rts-tx-pins {
690			pins = "gpio44", "gpio45";
691			function = "qup13";
692			drive-strength = <2>;
693			bias-disable;
694		};
695
696		rx-pins {
697			pins = "gpio46";
698			function = "qup13";
699			bias-pull-up;
700		};
701	};
702};
703