1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Copyright (c) 2020, Konrad Dybcio
4 */
5
6/dts-v1/;
7
8#include "msm8992.dtsi"
9#include "pm8994.dtsi"
10#include "pmi8994.dtsi"
11#include <dt-bindings/gpio/gpio.h>
12#include <dt-bindings/input/gpio-keys.h>
13
14/delete-node/ &adsp_mem;
15/delete-node/ &audio_mem;
16/delete-node/ &mpss_mem;
17/delete-node/ &peripheral_region;
18/delete-node/ &rmtfs_mem;
19
20/ {
21	model = "Xiaomi Mi 4C";
22	compatible = "xiaomi,libra", "qcom,msm8992";
23	chassis-type = "handset";
24
25	/* required for bootloader to select correct board */
26	qcom,msm-id = <251 0>, <252 0>;
27	qcom,pmic-id = <65545 65546 0 0>;
28	qcom,board-id = <12 0>;
29
30	/* This enables graphical output via bootloader-enabled display */
31	chosen {
32		bootargs = "earlycon=tty0 console=tty0 maxcpus=1";
33
34		#address-cells = <2>;
35		#size-cells = <2>;
36		ranges;
37
38		framebuffer0: framebuffer@3400000 {
39			compatible = "simple-framebuffer";
40			reg = <0 0x3400000 0 (1080 * 1920 * 3)>;
41			width = <1080>;
42			height = <1920>;
43			stride = <(1080 * 3)>;
44			format = "r8g8b8";
45			/*
46			 * That's a lot of clocks, but it's necessary due
47			 * to unused clk cleanup & no panel driver yet..
48			 */
49			clocks = <&mmcc MDSS_AHB_CLK>,
50				 <&mmcc MDSS_AXI_CLK>,
51				 <&mmcc MDSS_VSYNC_CLK>,
52				 <&mmcc MDSS_MDP_CLK>,
53				 <&mmcc MDSS_BYTE0_CLK>,
54				 <&mmcc MDSS_PCLK0_CLK>,
55				 <&mmcc MDSS_ESC0_CLK>;
56			power-domains = <&mmcc MDSS_GDSC>;
57		};
58	};
59
60	gpio-keys {
61		compatible = "gpio-keys";
62		autorepeat;
63
64		button {
65			label = "Volume Up";
66			gpios = <&pm8994_gpios 3 GPIO_ACTIVE_LOW>;
67			linux,input-type = <1>;
68			linux,code = <KEY_VOLUMEUP>;
69			wakeup-source;
70			debounce-interval = <15>;
71		};
72	};
73
74	reserved-memory {
75		#address-cells = <2>;
76		#size-cells = <2>;
77		ranges;
78
79		memory_hole: hole@6400000 {
80			reg = <0 0x06400000 0 0x600000>;
81			no-map;
82		};
83
84		memory_hole2: hole2@6c00000 {
85			reg = <0 0x06c00000 0 0x2400000>;
86			no-map;
87		};
88
89		mpss_mem: mpss@9000000 {
90			reg = <0 0x09000000 0 0x5a00000>;
91			no-map;
92		};
93
94		tzapp: tzapp@ea00000 {
95			reg = <0 0x0ea00000 0 0x1900000>;
96			no-map;
97		};
98
99		mdm_rfsa_mem: mdm-rfsa@ca0b0000 {
100			reg = <0 0xca0b0000 0 0x10000>;
101			no-map;
102		};
103
104		rmtfs_mem: rmtfs@ca100000 {
105			compatible = "qcom,rmtfs-mem";
106			reg = <0 0xca100000 0 0x180000>;
107			no-map;
108
109			qcom,client-id = <1>;
110		};
111
112		audio_mem: audio@cb400000 {
113			reg = <0 0xcb000000 0 0x400000>;
114			no-mem;
115		};
116
117		qseecom_mem: qseecom@cb400000 {
118			reg = <0 0xcb400000 0 0x1c00000>;
119			no-mem;
120		};
121
122		adsp_rfsa_mem: adsp-rfsa@cd000000 {
123			reg = <0 0xcd000000 0 0x10000>;
124			no-map;
125		};
126
127		sensor_rfsa_mem: sensor-rfsa@cd010000 {
128			reg = <0 0xcd010000 0 0x10000>;
129			no-map;
130		};
131
132		ramoops@dfc00000 {
133			compatible = "ramoops";
134			reg = <0 0xdfc00000 0 0x40000>;
135			console-size = <0x10000>;
136			record-size = <0x10000>;
137			ftrace-size = <0x10000>;
138			pmsg-size = <0x20000>;
139		};
140	};
141};
142
143&blsp1_i2c2 {
144	status = "okay";
145
146	/* Atmel or Synaptics touchscreen */
147};
148
149&blsp1_i2c5 {
150	status = "okay";
151
152	/* ST lsm6db0 gyro/accelerometer */
153};
154
155&blsp1_i2c6 {
156	status = "okay";
157
158	/*
159	 * NXP NCI NFC,
160	 * TI USB320 Type-C controller,
161	 * Pericom 30216a USB (de)mux switch
162	 */
163};
164
165&blsp2_i2c1 {
166	status = "okay";
167
168	/* cm36686 proximity and ambient light sensor */
169};
170
171&blsp2_i2c5 {
172	status = "okay";
173
174	/* Silabs si4705 FM transmitter */
175};
176
177&blsp2_uart2 {
178	status = "okay";
179};
180
181&pm8994_spmi_regulators {
182	VDD_APC0: s8 {
183		regulator-min-microvolt = <680000>;
184		regulator-max-microvolt = <1180000>;
185		regulator-always-on;
186		regulator-boot-on;
187	};
188
189	/* APC1 is 3-phase, but quoting downstream, s11 is "the gang leader" */
190	VDD_APC1: s11 {
191		regulator-min-microvolt = <700000>;
192		regulator-max-microvolt = <1225000>;
193		regulator-always-on;
194		regulator-boot-on;
195	};
196};
197
198&rpm_requests {
199	regulators-0 {
200		compatible = "qcom,rpm-pm8994-regulators";
201
202		vdd_l1-supply = <&pm8994_s7>;
203		vdd_l2_26_28-supply = <&pm8994_s3>;
204		vdd_l3_11-supply = <&pm8994_s3>;
205		vdd_l4_27_31-supply = <&pm8994_s3>;
206		vdd_l5_7-supply = <&pm8994_s3>;
207		vdd_l6_12_32-supply = <&pm8994_s5>;
208		vdd_l8_16_30-supply = <&vph_pwr>;
209		vdd_l9_10_18_22-supply = <&vph_pwr>;
210		vdd_l13_19_23_24-supply = <&vph_pwr>;
211		vdd_l14_15-supply = <&pm8994_s5>;
212		vdd_l17_29-supply = <&vph_pwr>;
213		vdd_l20_21-supply = <&vph_pwr>;
214		vdd_l25-supply = <&pm8994_s5>;
215		vdd_lvs1_2-supply = <&pm8994_s4>;
216
217		/* S1, S2, S6 and S12 are managed by RPMPD */
218
219		pm8994_s3: s3 {
220			regulator-min-microvolt = <1300000>;
221			regulator-max-microvolt = <1300000>;
222		};
223
224		pm8994_s4: s4 {
225			regulator-min-microvolt = <1800000>;
226			regulator-max-microvolt = <1800000>;
227			regulator-allow-set-load;
228			regulator-always-on;
229			regulator-system-load = <325000>;
230		};
231
232		pm8994_s5: s5 {
233			regulator-min-microvolt = <2150000>;
234			regulator-max-microvolt = <2150000>;
235		};
236
237		pm8994_s7: s7 {
238			regulator-min-microvolt = <1000000>;
239			regulator-max-microvolt = <1000000>;
240		};
241
242		/* S8, S9, S10 and S11 - SPMI-managed VDD_APC */
243
244		pm8994_l1: l1 {
245			regulator-min-microvolt = <1000000>;
246			regulator-max-microvolt = <1000000>;
247		};
248
249		pm8994_l2: l2 {
250			regulator-min-microvolt = <1250000>;
251			regulator-max-microvolt = <1250000>;
252		};
253
254		pm8994_l3: l3 {
255			regulator-min-microvolt = <1200000>;
256			regulator-max-microvolt = <1200000>;
257		};
258
259		pm8994_l4: l4 {
260			regulator-min-microvolt = <1225000>;
261			regulator-max-microvolt = <1225000>;
262		};
263
264		/* L5 is inaccessible from RPM */
265
266		pm8994_l6: l6 {
267			regulator-min-microvolt = <1800000>;
268			regulator-max-microvolt = <1800000>;
269		};
270
271		/* L7 is inaccessible from RPM */
272
273		pm8994_l8: l8 {
274			regulator-min-microvolt = <1800000>;
275			regulator-max-microvolt = <1800000>;
276		};
277
278		pm8994_l9: l9 {
279			regulator-min-microvolt = <1800000>;
280			regulator-max-microvolt = <1800000>;
281		};
282
283		pm8994_l10: l10 {
284			regulator-min-microvolt = <1800000>;
285			regulator-max-microvolt = <1800000>;
286		};
287
288		pm8994_l11: l11 {
289			regulator-min-microvolt = <1200000>;
290			regulator-max-microvolt = <1200000>;
291		};
292
293		pm8994_l12: l12 {
294			regulator-min-microvolt = <1800000>;
295			regulator-max-microvolt = <1800000>;
296		};
297
298		pm8994_l13: l13 {
299			regulator-min-microvolt = <1800000>;
300			regulator-max-microvolt = <2950000>;
301		};
302
303		pm8994_l14: l14 {
304			regulator-min-microvolt = <1800000>;
305			regulator-max-microvolt = <1800000>;
306		};
307
308		pm8994_l15: l15 {
309			regulator-min-microvolt = <1800000>;
310			regulator-max-microvolt = <1800000>;
311		};
312
313		pm8994_l16: l16 {
314			regulator-min-microvolt = <2700000>;
315			regulator-max-microvolt = <2700000>;
316		};
317
318		pm8994_l17: l17 {
319			regulator-min-microvolt = <2700000>;
320			regulator-max-microvolt = <2700000>;
321		};
322
323		pm8994_l18: l18 {
324			regulator-min-microvolt = <2850000>;
325			regulator-max-microvolt = <2850000>;
326			regulator-always-on;
327		};
328
329		pm8994_l19: l19 {
330			regulator-min-microvolt = <2800000>;
331			regulator-max-microvolt = <2800000>;
332		};
333
334		pm8994_l20: l20 {
335			regulator-min-microvolt = <2950000>;
336			regulator-max-microvolt = <2950000>;
337			regulator-always-on;
338			regulator-boot-on;
339			regulator-allow-set-load;
340			regulator-system-load = <570000>;
341		};
342
343		pm8994_l21: l21 {
344			regulator-min-microvolt = <2950000>;
345			regulator-max-microvolt = <2950000>;
346			regulator-always-on;
347		};
348
349		pm8994_l22: l22 {
350			regulator-min-microvolt = <3000000>;
351			regulator-max-microvolt = <3000000>;
352		};
353
354		pm8994_l23: l23 {
355			regulator-min-microvolt = <2800000>;
356			regulator-max-microvolt = <2800000>;
357		};
358
359		pm8994_l24: l24 {
360			regulator-min-microvolt = <3075000>;
361			regulator-max-microvolt = <3150000>;
362		};
363
364		pm8994_l25: l25 {
365			regulator-min-microvolt = <1000000>;
366			regulator-max-microvolt = <1000000>;
367		};
368
369		pm8994_l26: l26 {
370			regulator-min-microvolt = <987500>;
371			regulator-max-microvolt = <987500>;
372
373		};
374
375		pm8994_l27: l27 {
376			regulator-min-microvolt = <1050000>;
377			regulator-max-microvolt = <1050000>;
378		};
379
380		pm8994_l28: l28 {
381			regulator-min-microvolt = <1000000>;
382			regulator-max-microvolt = <1000000>;
383		};
384
385		pm8994_l29: l29 {
386			regulator-min-microvolt = <2800000>;
387			regulator-max-microvolt = <2800000>;
388		};
389
390		pm8994_l30: l30 {
391			regulator-min-microvolt = <1800000>;
392			regulator-max-microvolt = <1800000>;
393		};
394
395		pm8994_l31: l31 {
396			regulator-min-microvolt = <1262500>;
397			regulator-max-microvolt = <1262500>;
398		};
399
400		pm8994_l32: l32 {
401			regulator-min-microvolt = <1800000>;
402			regulator-max-microvolt = <1800000>;
403		};
404
405		pm8994_lvs1: lvs1 {};
406		pm8994_lvs2: lvs2 {};
407	};
408
409	pmi8994_regulators: regulators-1 {
410		compatible = "qcom,rpm-pmi8994-regulators";
411		vdd_s1-supply = <&vph_pwr>;
412		vdd_bst_byp-supply = <&vph_pwr>;
413
414		pmi8994_s1: s1 {
415			regulator-min-microvolt = <1025000>;
416			regulator-max-microvolt = <1025000>;
417		};
418
419		/* S2 & S3 - VDD_GFX */
420
421		pmi8994_bby: boost-bypass {
422			regulator-min-microvolt = <3150000>;
423			regulator-max-microvolt = <3600000>;
424		};
425	};
426};
427
428&sdhc1 {
429	status = "okay";
430
431	mmc-hs400-1_8v;
432	vmmc-supply = <&pm8994_l20>;
433	vqmmc-supply = <&pm8994_s4>;
434};
435