• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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-pll-supply = <&vreg_l10a_1p8>;
111	vdda-phy-dpdm-supply = <&vreg_l7b_3p125>;
112};
113
114&rpm_requests {
115	regulators-0 {
116		compatible = "qcom,rpm-pm660l-regulators";
117
118		vdd_s1-supply = <&vph_pwr>;
119		vdd_s2-supply = <&vph_pwr>;
120		vdd_s3_s4-supply = <&vph_pwr>;
121		vdd_s5-supply = <&vph_pwr>;
122		vdd_s6-supply = <&vph_pwr>;
123
124		vdd_l1_l9_l10-supply = <&vreg_s2b_1p05>;
125		vdd_l2-supply = <&vreg_bob>;
126		vdd_l3_l5_l7_l8-supply = <&vreg_bob>;
127		vdd_l4_l6-supply = <&vreg_bob>;
128		vdd_bob-supply = <&vph_pwr>;
129
130		vreg_s1b_1p125: s1 {
131			regulator-min-microvolt = <1125000>;
132			regulator-max-microvolt = <1125000>;
133			regulator-enable-ramp-delay = <200>;
134		};
135
136		vreg_s2b_1p05: s2 {
137			regulator-min-microvolt = <1050000>;
138			regulator-max-microvolt = <1050000>;
139			regulator-enable-ramp-delay = <200>;
140		};
141
142		/* LDOs */
143		vreg_l1b_0p925: l1 {
144			regulator-min-microvolt = <800000>;
145			regulator-max-microvolt = <925000>;
146			regulator-enable-ramp-delay = <250>;
147			regulator-allow-set-load;
148		};
149
150		/* SDHCI 3.3V signal doesn't seem to be supported. */
151		vreg_l2b_2p95: l2 {
152			regulator-min-microvolt = <1648000>;
153			regulator-max-microvolt = <2696000>;
154			regulator-enable-ramp-delay = <250>;
155			regulator-allow-set-load;
156		};
157
158		vreg_l3b_3p3: l3 {
159			regulator-min-microvolt = <1700000>;
160			regulator-max-microvolt = <3300000>;
161			regulator-enable-ramp-delay = <250>;
162			regulator-allow-set-load;
163		};
164
165		vreg_l4b_2p95: l4 {
166			regulator-min-microvolt = <2944000>;
167			regulator-max-microvolt = <2952000>;
168			regulator-enable-ramp-delay = <250>;
169
170			regulator-min-microamp = <200>;
171			regulator-max-microamp = <600000>;
172			regulator-system-load = <570000>;
173			regulator-allow-set-load;
174		};
175
176		/*
177		 * Downstream specifies a range of 1721-3600mV,
178		 * but the only assigned consumers are SDHCI2 VMMC
179		 * and Coresight QPDI that both request pinned 2.95V.
180		 * Tighten the range to 1.8-3.328 (closest to 3.3) to
181		 * make the mmc driver happy.
182		 */
183		vreg_l5b_2p95: l5 {
184			regulator-min-microvolt = <1800000>;
185			regulator-max-microvolt = <3328000>;
186			regulator-enable-ramp-delay = <250>;
187			regulator-allow-set-load;
188			regulator-system-load = <800000>;
189		};
190
191		vreg_l7b_3p125: l7 {
192			regulator-min-microvolt = <2700000>;
193			regulator-max-microvolt = <3125000>;
194			regulator-enable-ramp-delay = <250>;
195		};
196
197		vreg_l8b_3p3: l8 {
198			regulator-min-microvolt = <3200000>;
199			regulator-max-microvolt = <3400000>;
200			regulator-enable-ramp-delay = <250>;
201		};
202
203		vreg_bob: bob {
204			regulator-min-microvolt = <3300000>;
205			regulator-max-microvolt = <3600000>;
206			regulator-enable-ramp-delay = <500>;
207		};
208	};
209
210	regulators-1 {
211		compatible = "qcom,rpm-pm660-regulators";
212
213		vdd_s1-supply = <&vph_pwr>;
214		vdd_s2-supply = <&vph_pwr>;
215		vdd_s3-supply = <&vph_pwr>;
216		vdd_s4-supply = <&vph_pwr>;
217		vdd_s5-supply = <&vph_pwr>;
218		vdd_s6-supply = <&vph_pwr>;
219
220		vdd_l1_l6_l7-supply = <&vreg_s5a_1p35>;
221		vdd_l2_l3-supply = <&vreg_s2b_1p05>;
222		vdd_l5-supply = <&vreg_s2b_1p05>;
223		vdd_l8_l9_l10_l11_l12_l13_l14-supply = <&vreg_s4a_2p04>;
224		vdd_l15_l16_l17_l18_l19-supply = <&vreg_bob>;
225
226		/*
227		 * S1A (FTAPC0), S2A (FTAPC1), S3A (HFAPC1) are managed
228		 * by the Core Power Reduction hardened (CPRh) and the
229		 * Operating State Manager (OSM) HW automatically.
230		 */
231
232		vreg_s4a_2p04: s4 {
233			regulator-min-microvolt = <1805000>;
234			regulator-max-microvolt = <2040000>;
235			regulator-enable-ramp-delay = <200>;
236			regulator-always-on;
237		};
238
239		vreg_s5a_1p35: s5 {
240			regulator-min-microvolt = <1224000>;
241			regulator-max-microvolt = <1350000>;
242			regulator-enable-ramp-delay = <200>;
243		};
244
245		vreg_s6a_0p87: s6 {
246			regulator-min-microvolt = <504000>;
247			regulator-max-microvolt = <992000>;
248			regulator-enable-ramp-delay = <150>;
249		};
250
251		/* LDOs */
252		vreg_l1a_1p225: l1 {
253			regulator-min-microvolt = <1150000>;
254			regulator-max-microvolt = <1250000>;
255			regulator-enable-ramp-delay = <250>;
256			regulator-allow-set-load;
257		};
258
259		vreg_l2a_1p0: l2 {
260			regulator-min-microvolt = <950000>;
261			regulator-max-microvolt = <1010000>;
262			regulator-enable-ramp-delay = <250>;
263		};
264
265		vreg_l3a_1p0: l3 {
266			regulator-min-microvolt = <950000>;
267			regulator-max-microvolt = <1010000>;
268			regulator-enable-ramp-delay = <250>;
269		};
270
271		vreg_l5a_0p848: l5 {
272			regulator-min-microvolt = <525000>;
273			regulator-max-microvolt = <950000>;
274			regulator-enable-ramp-delay = <250>;
275		};
276
277		vreg_l6a_1p3: l6 {
278			regulator-min-microvolt = <1200000>;
279			regulator-max-microvolt = <1370000>;
280			regulator-allow-set-load;
281			regulator-enable-ramp-delay = <250>;
282		};
283
284		vreg_l7a_1p2: l7 {
285			regulator-min-microvolt = <1200000>;
286			regulator-max-microvolt = <1200000>;
287			regulator-enable-ramp-delay = <250>;
288		};
289
290		vreg_l8a_1p8: l8 {
291			regulator-min-microvolt = <1750000>;
292			regulator-max-microvolt = <1800000>;
293			regulator-enable-ramp-delay = <250>;
294			regulator-system-load = <325000>;
295			regulator-allow-set-load;
296		};
297
298		vreg_l9a_1p8: l9 {
299			regulator-min-microvolt = <1750000>;
300			regulator-max-microvolt = <1900000>;
301			regulator-enable-ramp-delay = <250>;
302			regulator-allow-set-load;
303		};
304
305		vreg_l10a_1p8: l10 {
306			regulator-min-microvolt = <1780000>;
307			regulator-max-microvolt = <1950000>;
308			regulator-enable-ramp-delay = <250>;
309			regulator-allow-set-load;
310		};
311
312		vreg_l11a_1p8: l11 {
313			regulator-min-microvolt = <1780000>;
314			regulator-max-microvolt = <1950000>;
315			regulator-enable-ramp-delay = <250>;
316		};
317
318		vreg_l12a_1p8: l12 {
319			regulator-min-microvolt = <1780000>;
320			regulator-max-microvolt = <1950000>;
321			regulator-enable-ramp-delay = <250>;
322		};
323
324		/* This gives power to the LPDDR4: never turn it off! */
325		vreg_l13a_1p8: l13 {
326			regulator-min-microvolt = <1780000>;
327			regulator-max-microvolt = <1950000>;
328			regulator-enable-ramp-delay = <250>;
329			regulator-boot-on;
330			regulator-always-on;
331		};
332
333		vreg_l14a_1p8: l14 {
334			regulator-min-microvolt = <1710000>;
335			regulator-max-microvolt = <1900000>;
336			regulator-enable-ramp-delay = <250>;
337		};
338
339		vreg_l15a_1p8: l15 {
340			regulator-min-microvolt = <1650000>;
341			regulator-max-microvolt = <2950000>;
342			regulator-enable-ramp-delay = <250>;
343		};
344
345		vreg_l16a_2p7: l16 {
346			regulator-min-microvolt = <2800000>;
347			regulator-max-microvolt = <2800000>;
348			regulator-enable-ramp-delay = <250>;
349			regulator-always-on;
350		};
351
352		vreg_l17a_1p8: l17 {
353			regulator-min-microvolt = <1648000>;
354			regulator-max-microvolt = <2952000>;
355			regulator-enable-ramp-delay = <250>;
356		};
357
358		vreg_l19a_3p3: l19 {
359			regulator-min-microvolt = <3312000>;
360			regulator-max-microvolt = <3400000>;
361			regulator-enable-ramp-delay = <250>;
362			regulator-allow-set-load;
363		};
364	};
365};
366
367&pm660l_wled {
368	status = "okay";
369
370	qcom,switching-freq = <800>;
371	qcom,current-limit-microamp = <20000>;
372	qcom,num-strings = <2>;
373};
374
375&sdc2_state_on {
376	sd-cd-pins {
377		pins = "gpio54";
378		function = "gpio";
379		bias-pull-up;
380		drive-strength = <2>;
381	};
382};
383
384&sdc2_state_off {
385	sd-cd-pins {
386		pins = "gpio54";
387		function = "gpio";
388		bias-disable;
389		drive-strength = <2>;
390	};
391};
392
393&sdhc_1 {
394	status = "okay";
395	supports-cqe;
396
397	mmc-hs200-1_8v;
398	mmc-hs400-1_8v;
399	mmc-hs400-enhanced-strobe;
400
401	vmmc-supply = <&vreg_l4b_2p95>;
402	vqmmc-supply = <&vreg_l8a_1p8>;
403};
404
405&sdhc_2 {
406	status = "okay";
407
408	cd-gpios = <&tlmm 54 GPIO_ACTIVE_HIGH>;
409
410	vmmc-supply = <&vreg_l5b_2p95>;
411	vqmmc-supply = <&vreg_l2b_2p95>;
412};
413
414&tlmm {
415	gpio-reserved-ranges = <8 4>;
416};
417
418&usb3 {
419	status = "okay";
420};
421
422&usb3_dwc3 {
423	dr_mode = "peripheral";
424	extcon = <&extcon_usb>;
425};
426