xref: /linux/arch/arm64/boot/dts/qcom/sdm660-xiaomi-lavender.dts (revision 7340c6df49df1b261892d287444c255d0a378063)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (c) 2020, Alexey Minnekhanov <alexey.min@gmail.com>
4 * Copyright (c) 2021, Dang Huynh <danct12@riseup.net>
5 */
6
7/dts-v1/;
8
9#include "sdm660.dtsi"
10#include "pm660.dtsi"
11#include "pm660l.dtsi"
12#include <dt-bindings/input/input.h>
13#include <dt-bindings/input/gpio-keys.h>
14
15/ {
16	model = "Xiaomi Redmi Note 7";
17	compatible = "xiaomi,lavender", "qcom,sdm660";
18	chassis-type = "handset";
19
20	aliases {
21		serial0 = &blsp1_uart2;
22	};
23
24	chosen {
25		#address-cells = <2>;
26		#size-cells = <2>;
27		ranges;
28
29		stdout-path = "serial0:115200n8";
30
31		framebuffer0: framebuffer@9d400000 {
32			compatible = "simple-framebuffer";
33			reg = <0 0x9d400000 0 (1080 * 2340 * 4)>;
34			width = <1080>;
35			height = <2340>;
36			stride = <(1080 * 4)>;
37			format = "a8r8g8b8";
38		};
39	};
40
41	vph_pwr: vph-pwr-regulator {
42		compatible = "regulator-fixed";
43		regulator-name = "vph_pwr";
44		regulator-min-microvolt = <3700000>;
45		regulator-max-microvolt = <3700000>;
46
47		regulator-always-on;
48		regulator-boot-on;
49	};
50
51	gpio-keys {
52		compatible = "gpio-keys";
53
54		key-volup {
55			label = "Volume Up";
56			gpios = <&pm660l_gpios 7 GPIO_ACTIVE_LOW>;
57			linux,code = <KEY_VOLUMEUP>;
58			debounce-interval = <15>;
59		};
60	};
61
62	reserved-memory {
63		#address-cells = <2>;
64		#size-cells = <2>;
65		ranges;
66
67		ramoops@a0000000 {
68			compatible = "ramoops";
69			reg = <0x0 0xa0000000 0x0 0x400000>;
70			console-size = <0x20000>;
71			record-size = <0x20000>;
72			ftrace-size = <0x0>;
73			pmsg-size = <0x20000>;
74		};
75
76		framebuffer_mem: memory@9d400000 {
77			reg = <0x0 0x9d400000 0x0 0x23ff000>;
78			no-map;
79		};
80	};
81
82	/*
83	 * Until we hook up type-c detection, we
84	 * have to stick with this. But it works.
85	 */
86	extcon_usb: extcon-usb {
87		compatible = "linux,extcon-usb-gpio";
88		id-gpios = <&tlmm 58 GPIO_ACTIVE_HIGH>;
89	};
90};
91
92&blsp1_uart2 {
93	status = "okay";
94};
95
96&pon_pwrkey {
97	status = "okay";
98};
99
100&pon_resin {
101	status = "okay";
102
103	linux,code = <KEY_VOLUMEDOWN>;
104};
105
106&qusb2phy0 {
107	status = "okay";
108
109	vdd-supply = <&vreg_l1b_0p925>;
110	vdda-phy-dpdm-supply = <&vreg_l7b_3p125>;
111};
112
113&rpm_requests {
114	regulators-0 {
115		compatible = "qcom,rpm-pm660l-regulators";
116
117		vdd_s1-supply = <&vph_pwr>;
118		vdd_s2-supply = <&vph_pwr>;
119		vdd_s3_s4-supply = <&vph_pwr>;
120		vdd_s5-supply = <&vph_pwr>;
121		vdd_s6-supply = <&vph_pwr>;
122
123		vdd_l1_l9_l10-supply = <&vreg_s2b_1p05>;
124		vdd_l2-supply = <&vreg_bob>;
125		vdd_l3_l5_l7_l8-supply = <&vreg_bob>;
126		vdd_l4_l6-supply = <&vreg_bob>;
127		vdd_bob-supply = <&vph_pwr>;
128
129		vreg_s1b_1p125: s1 {
130			regulator-min-microvolt = <1125000>;
131			regulator-max-microvolt = <1125000>;
132			regulator-enable-ramp-delay = <200>;
133		};
134
135		vreg_s2b_1p05: s2 {
136			regulator-min-microvolt = <1050000>;
137			regulator-max-microvolt = <1050000>;
138			regulator-enable-ramp-delay = <200>;
139		};
140
141		/* LDOs */
142		vreg_l1b_0p925: l1 {
143			regulator-min-microvolt = <800000>;
144			regulator-max-microvolt = <925000>;
145			regulator-enable-ramp-delay = <250>;
146			regulator-allow-set-load;
147		};
148
149		/* SDHCI 3.3V signal doesn't seem to be supported. */
150		vreg_l2b_2p95: l2 {
151			regulator-min-microvolt = <1648000>;
152			regulator-max-microvolt = <2696000>;
153			regulator-enable-ramp-delay = <250>;
154			regulator-allow-set-load;
155		};
156
157		vreg_l3b_3p3: l3 {
158			regulator-min-microvolt = <1700000>;
159			regulator-max-microvolt = <3300000>;
160			regulator-enable-ramp-delay = <250>;
161			regulator-allow-set-load;
162		};
163
164		vreg_l4b_2p95: l4 {
165			regulator-min-microvolt = <2944000>;
166			regulator-max-microvolt = <2952000>;
167			regulator-enable-ramp-delay = <250>;
168
169			regulator-min-microamp = <200>;
170			regulator-max-microamp = <600000>;
171			regulator-system-load = <570000>;
172			regulator-allow-set-load;
173		};
174
175		/*
176		 * Downstream specifies a range of 1721-3600mV,
177		 * but the only assigned consumers are SDHCI2 VMMC
178		 * and Coresight QPDI that both request pinned 2.95V.
179		 * Tighten the range to 1.8-3.328 (closest to 3.3) to
180		 * make the mmc driver happy.
181		 */
182		vreg_l5b_2p95: l5 {
183			regulator-min-microvolt = <1800000>;
184			regulator-max-microvolt = <3328000>;
185			regulator-enable-ramp-delay = <250>;
186			regulator-allow-set-load;
187			regulator-system-load = <800000>;
188		};
189
190		vreg_l7b_3p125: l7 {
191			regulator-min-microvolt = <2700000>;
192			regulator-max-microvolt = <3125000>;
193			regulator-enable-ramp-delay = <250>;
194		};
195
196		vreg_l8b_3p3: l8 {
197			regulator-min-microvolt = <3200000>;
198			regulator-max-microvolt = <3400000>;
199			regulator-enable-ramp-delay = <250>;
200		};
201
202		vreg_bob: bob {
203			regulator-min-microvolt = <3300000>;
204			regulator-max-microvolt = <3600000>;
205			regulator-enable-ramp-delay = <500>;
206		};
207	};
208
209	regulators-1 {
210		compatible = "qcom,rpm-pm660-regulators";
211
212		vdd_s1-supply = <&vph_pwr>;
213		vdd_s2-supply = <&vph_pwr>;
214		vdd_s3-supply = <&vph_pwr>;
215		vdd_s4-supply = <&vph_pwr>;
216		vdd_s5-supply = <&vph_pwr>;
217		vdd_s6-supply = <&vph_pwr>;
218
219		vdd_l1_l6_l7-supply = <&vreg_s5a_1p35>;
220		vdd_l2_l3-supply = <&vreg_s2b_1p05>;
221		vdd_l5-supply = <&vreg_s2b_1p05>;
222		vdd_l8_l9_l10_l11_l12_l13_l14-supply = <&vreg_s4a_2p04>;
223		vdd_l15_l16_l17_l18_l19-supply = <&vreg_bob>;
224
225		/*
226		 * S1A (FTAPC0), S2A (FTAPC1), S3A (HFAPC1) are managed
227		 * by the Core Power Reduction hardened (CPRh) and the
228		 * Operating State Manager (OSM) HW automatically.
229		 */
230
231		vreg_s4a_2p04: s4 {
232			regulator-min-microvolt = <1805000>;
233			regulator-max-microvolt = <2040000>;
234			regulator-enable-ramp-delay = <200>;
235			regulator-always-on;
236		};
237
238		vreg_s5a_1p35: s5 {
239			regulator-min-microvolt = <1224000>;
240			regulator-max-microvolt = <1350000>;
241			regulator-enable-ramp-delay = <200>;
242		};
243
244		vreg_s6a_0p87: s6 {
245			regulator-min-microvolt = <504000>;
246			regulator-max-microvolt = <992000>;
247			regulator-enable-ramp-delay = <150>;
248		};
249
250		/* LDOs */
251		vreg_l1a_1p225: l1 {
252			regulator-min-microvolt = <1150000>;
253			regulator-max-microvolt = <1250000>;
254			regulator-enable-ramp-delay = <250>;
255			regulator-allow-set-load;
256		};
257
258		vreg_l2a_1p0: l2 {
259			regulator-min-microvolt = <950000>;
260			regulator-max-microvolt = <1010000>;
261			regulator-enable-ramp-delay = <250>;
262		};
263
264		vreg_l3a_1p0: l3 {
265			regulator-min-microvolt = <950000>;
266			regulator-max-microvolt = <1010000>;
267			regulator-enable-ramp-delay = <250>;
268		};
269
270		vreg_l5a_0p848: l5 {
271			regulator-min-microvolt = <525000>;
272			regulator-max-microvolt = <950000>;
273			regulator-enable-ramp-delay = <250>;
274		};
275
276		vreg_l6a_1p3: l6 {
277			regulator-min-microvolt = <1200000>;
278			regulator-max-microvolt = <1370000>;
279			regulator-allow-set-load;
280			regulator-enable-ramp-delay = <250>;
281		};
282
283		vreg_l7a_1p2: l7 {
284			regulator-min-microvolt = <1200000>;
285			regulator-max-microvolt = <1200000>;
286			regulator-enable-ramp-delay = <250>;
287		};
288
289		vreg_l8a_1p8: l8 {
290			regulator-min-microvolt = <1750000>;
291			regulator-max-microvolt = <1800000>;
292			regulator-enable-ramp-delay = <250>;
293			regulator-system-load = <325000>;
294			regulator-allow-set-load;
295		};
296
297		vreg_l9a_1p8: l9 {
298			regulator-min-microvolt = <1750000>;
299			regulator-max-microvolt = <1900000>;
300			regulator-enable-ramp-delay = <250>;
301			regulator-allow-set-load;
302		};
303
304		vreg_l10a_1p8: l10 {
305			regulator-min-microvolt = <1780000>;
306			regulator-max-microvolt = <1950000>;
307			regulator-enable-ramp-delay = <250>;
308			regulator-allow-set-load;
309		};
310
311		vreg_l11a_1p8: l11 {
312			regulator-min-microvolt = <1780000>;
313			regulator-max-microvolt = <1950000>;
314			regulator-enable-ramp-delay = <250>;
315		};
316
317		vreg_l12a_1p8: l12 {
318			regulator-min-microvolt = <1780000>;
319			regulator-max-microvolt = <1950000>;
320			regulator-enable-ramp-delay = <250>;
321		};
322
323		/* This gives power to the LPDDR4: never turn it off! */
324		vreg_l13a_1p8: l13 {
325			regulator-min-microvolt = <1780000>;
326			regulator-max-microvolt = <1950000>;
327			regulator-enable-ramp-delay = <250>;
328			regulator-boot-on;
329			regulator-always-on;
330		};
331
332		vreg_l14a_1p8: l14 {
333			regulator-min-microvolt = <1710000>;
334			regulator-max-microvolt = <1900000>;
335			regulator-enable-ramp-delay = <250>;
336		};
337
338		vreg_l15a_1p8: l15 {
339			regulator-min-microvolt = <1650000>;
340			regulator-max-microvolt = <2950000>;
341			regulator-enable-ramp-delay = <250>;
342		};
343
344		vreg_l16a_2p7: l16 {
345			regulator-min-microvolt = <2800000>;
346			regulator-max-microvolt = <2800000>;
347			regulator-enable-ramp-delay = <250>;
348			regulator-always-on;
349		};
350
351		vreg_l17a_1p8: l17 {
352			regulator-min-microvolt = <1648000>;
353			regulator-max-microvolt = <2952000>;
354			regulator-enable-ramp-delay = <250>;
355		};
356
357		vreg_l19a_3p3: l19 {
358			regulator-min-microvolt = <3312000>;
359			regulator-max-microvolt = <3400000>;
360			regulator-enable-ramp-delay = <250>;
361			regulator-allow-set-load;
362		};
363	};
364};
365
366&pm660l_wled {
367	status = "okay";
368
369	qcom,switching-freq = <800>;
370	qcom,current-limit-microamp = <20000>;
371	qcom,num-strings = <2>;
372};
373
374&sdc2_state_on {
375	sd-cd-pins {
376		pins = "gpio54";
377		function = "gpio";
378		bias-pull-up;
379		drive-strength = <2>;
380	};
381};
382
383&sdc2_state_off {
384	sd-cd-pins {
385		pins = "gpio54";
386		function = "gpio";
387		bias-disable;
388		drive-strength = <2>;
389	};
390};
391
392&sdhc_1 {
393	status = "okay";
394	supports-cqe;
395
396	mmc-hs200-1_8v;
397	mmc-hs400-1_8v;
398	mmc-hs400-enhanced-strobe;
399
400	vmmc-supply = <&vreg_l4b_2p95>;
401	vqmmc-supply = <&vreg_l8a_1p8>;
402};
403
404&sdhc_2 {
405	status = "okay";
406
407	vmmc-supply = <&vreg_l5b_2p95>;
408	vqmmc-supply = <&vreg_l2b_2p95>;
409};
410
411&tlmm {
412	gpio-reserved-ranges = <8 4>;
413};
414
415&usb3 {
416	status = "okay";
417};
418
419&usb3_dwc3 {
420	dr_mode = "peripheral";
421	extcon = <&extcon_usb>;
422};
423