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		qseecom_mem: qseecom@cb400000 {
113			reg = <0 0xcb400000 0 0x1c00000>;
114			no-mem;
115		};
116
117		adsp_rfsa_mem: adsp-rfsa@cd000000 {
118			reg = <0 0xcd000000 0 0x10000>;
119			no-map;
120		};
121
122		sensor_rfsa_mem: sensor-rfsa@cd010000 {
123			reg = <0 0xcd010000 0 0x10000>;
124			no-map;
125		};
126
127		ramoops@dfc00000 {
128			compatible = "ramoops";
129			reg = <0 0xdfc00000 0 0x40000>;
130			console-size = <0x10000>;
131			record-size = <0x10000>;
132			ftrace-size = <0x10000>;
133			pmsg-size = <0x20000>;
134		};
135	};
136};
137
138&blsp1_i2c2 {
139	status = "okay";
140
141	/* Atmel or Synaptics touchscreen */
142};
143
144&blsp1_i2c5 {
145	status = "okay";
146
147	/* ST lsm6db0 gyro/accelerometer */
148};
149
150&blsp1_i2c6 {
151	status = "okay";
152
153	/*
154	 * NXP NCI NFC,
155	 * TI USB320 Type-C controller,
156	 * Pericom 30216a USB (de)mux switch
157	 */
158};
159
160&blsp2_i2c1 {
161	status = "okay";
162
163	/* cm36686 proximity and ambient light sensor */
164};
165
166&blsp2_i2c5 {
167	status = "okay";
168
169	/* Silabs si4705 FM transmitter */
170};
171
172&blsp2_uart2 {
173	status = "okay";
174};
175
176&pm8994_spmi_regulators {
177	VDD_APC0: s8 {
178		regulator-min-microvolt = <680000>;
179		regulator-max-microvolt = <1180000>;
180		regulator-always-on;
181		regulator-boot-on;
182	};
183
184	/* APC1 is 3-phase, but quoting downstream, s11 is "the gang leader" */
185	VDD_APC1: s11 {
186		regulator-min-microvolt = <700000>;
187		regulator-max-microvolt = <1225000>;
188		regulator-always-on;
189		regulator-boot-on;
190	};
191};
192
193&rpm_requests {
194	regulators-0 {
195		compatible = "qcom,rpm-pm8994-regulators";
196
197		vdd_l1-supply = <&pm8994_s7>;
198		vdd_l2_26_28-supply = <&pm8994_s3>;
199		vdd_l3_11-supply = <&pm8994_s3>;
200		vdd_l4_27_31-supply = <&pm8994_s3>;
201		vdd_l5_7-supply = <&pm8994_s3>;
202		vdd_l6_12_32-supply = <&pm8994_s5>;
203		vdd_l8_16_30-supply = <&vph_pwr>;
204		vdd_l9_10_18_22-supply = <&vph_pwr>;
205		vdd_l13_19_23_24-supply = <&vph_pwr>;
206		vdd_l14_15-supply = <&pm8994_s5>;
207		vdd_l17_29-supply = <&vph_pwr>;
208		vdd_l20_21-supply = <&vph_pwr>;
209		vdd_l25-supply = <&pm8994_s5>;
210		vdd_lvs1_2-supply = <&pm8994_s4>;
211
212		/* S1, S2, S6 and S12 are managed by RPMPD */
213
214		pm8994_s3: s3 {
215			regulator-min-microvolt = <1300000>;
216			regulator-max-microvolt = <1300000>;
217		};
218
219		pm8994_s4: s4 {
220			regulator-min-microvolt = <1800000>;
221			regulator-max-microvolt = <1800000>;
222			regulator-allow-set-load;
223			regulator-always-on;
224			regulator-system-load = <325000>;
225		};
226
227		pm8994_s5: s5 {
228			regulator-min-microvolt = <2150000>;
229			regulator-max-microvolt = <2150000>;
230		};
231
232		pm8994_s7: s7 {
233			regulator-min-microvolt = <1000000>;
234			regulator-max-microvolt = <1000000>;
235		};
236
237		/* S8, S9, S10 and S11 - SPMI-managed VDD_APC */
238
239		pm8994_l1: l1 {
240			regulator-min-microvolt = <1000000>;
241			regulator-max-microvolt = <1000000>;
242		};
243
244		pm8994_l2: l2 {
245			regulator-min-microvolt = <1250000>;
246			regulator-max-microvolt = <1250000>;
247		};
248
249		pm8994_l3: l3 {
250			regulator-min-microvolt = <1200000>;
251			regulator-max-microvolt = <1200000>;
252		};
253
254		pm8994_l4: l4 {
255			regulator-min-microvolt = <1225000>;
256			regulator-max-microvolt = <1225000>;
257		};
258
259		/* L5 is inaccessible from RPM */
260
261		pm8994_l6: l6 {
262			regulator-min-microvolt = <1800000>;
263			regulator-max-microvolt = <1800000>;
264		};
265
266		/* L7 is inaccessible from RPM */
267
268		pm8994_l8: l8 {
269			regulator-min-microvolt = <1800000>;
270			regulator-max-microvolt = <1800000>;
271		};
272
273		pm8994_l9: l9 {
274			regulator-min-microvolt = <1800000>;
275			regulator-max-microvolt = <1800000>;
276		};
277
278		pm8994_l10: l10 {
279			regulator-min-microvolt = <1800000>;
280			regulator-max-microvolt = <1800000>;
281		};
282
283		pm8994_l11: l11 {
284			regulator-min-microvolt = <1200000>;
285			regulator-max-microvolt = <1200000>;
286		};
287
288		pm8994_l12: l12 {
289			regulator-min-microvolt = <1800000>;
290			regulator-max-microvolt = <1800000>;
291		};
292
293		pm8994_l13: l13 {
294			regulator-min-microvolt = <1800000>;
295			regulator-max-microvolt = <2950000>;
296		};
297
298		pm8994_l14: l14 {
299			regulator-min-microvolt = <1800000>;
300			regulator-max-microvolt = <1800000>;
301		};
302
303		pm8994_l15: l15 {
304			regulator-min-microvolt = <1800000>;
305			regulator-max-microvolt = <1800000>;
306		};
307
308		pm8994_l16: l16 {
309			regulator-min-microvolt = <2700000>;
310			regulator-max-microvolt = <2700000>;
311		};
312
313		pm8994_l17: l17 {
314			regulator-min-microvolt = <2700000>;
315			regulator-max-microvolt = <2700000>;
316		};
317
318		pm8994_l18: l18 {
319			regulator-min-microvolt = <2850000>;
320			regulator-max-microvolt = <2850000>;
321			regulator-always-on;
322		};
323
324		pm8994_l19: l19 {
325			regulator-min-microvolt = <2800000>;
326			regulator-max-microvolt = <2800000>;
327		};
328
329		pm8994_l20: l20 {
330			regulator-min-microvolt = <2950000>;
331			regulator-max-microvolt = <2950000>;
332			regulator-always-on;
333			regulator-boot-on;
334			regulator-allow-set-load;
335			regulator-system-load = <570000>;
336		};
337
338		pm8994_l21: l21 {
339			regulator-min-microvolt = <2950000>;
340			regulator-max-microvolt = <2950000>;
341			regulator-always-on;
342		};
343
344		pm8994_l22: l22 {
345			regulator-min-microvolt = <3000000>;
346			regulator-max-microvolt = <3000000>;
347		};
348
349		pm8994_l23: l23 {
350			regulator-min-microvolt = <2800000>;
351			regulator-max-microvolt = <2800000>;
352		};
353
354		pm8994_l24: l24 {
355			regulator-min-microvolt = <3075000>;
356			regulator-max-microvolt = <3150000>;
357		};
358
359		pm8994_l25: l25 {
360			regulator-min-microvolt = <1000000>;
361			regulator-max-microvolt = <1000000>;
362		};
363
364		pm8994_l26: l26 {
365			regulator-min-microvolt = <987500>;
366			regulator-max-microvolt = <987500>;
367
368		};
369
370		pm8994_l27: l27 {
371			regulator-min-microvolt = <1050000>;
372			regulator-max-microvolt = <1050000>;
373		};
374
375		pm8994_l28: l28 {
376			regulator-min-microvolt = <1000000>;
377			regulator-max-microvolt = <1000000>;
378		};
379
380		pm8994_l29: l29 {
381			regulator-min-microvolt = <2800000>;
382			regulator-max-microvolt = <2800000>;
383		};
384
385		pm8994_l30: l30 {
386			regulator-min-microvolt = <1800000>;
387			regulator-max-microvolt = <1800000>;
388		};
389
390		pm8994_l31: l31 {
391			regulator-min-microvolt = <1262500>;
392			regulator-max-microvolt = <1262500>;
393		};
394
395		pm8994_l32: l32 {
396			regulator-min-microvolt = <1800000>;
397			regulator-max-microvolt = <1800000>;
398		};
399
400		pm8994_lvs1: lvs1 {};
401		pm8994_lvs2: lvs2 {};
402	};
403
404	pmi8994_regulators: regulators-1 {
405		compatible = "qcom,rpm-pmi8994-regulators";
406		vdd_s1-supply = <&vph_pwr>;
407		vdd_bst_byp-supply = <&vph_pwr>;
408
409		pmi8994_s1: s1 {
410			regulator-min-microvolt = <1025000>;
411			regulator-max-microvolt = <1025000>;
412		};
413
414		/* S2 & S3 - VDD_GFX */
415
416		pmi8994_bby: boost-bypass {
417			regulator-min-microvolt = <3150000>;
418			regulator-max-microvolt = <3600000>;
419		};
420	};
421};
422
423&sdhc1 {
424	status = "okay";
425
426	mmc-hs400-1_8v;
427	vmmc-supply = <&pm8994_l20>;
428	vqmmc-supply = <&pm8994_s4>;
429};
430