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/ {
15	model = "Xiaomi Mi 4C";
16	compatible = "xiaomi,libra", "qcom,msm8992";
17	chassis-type = "handset";
18
19	/* required for bootloader to select correct board */
20	qcom,msm-id = <251 0 252 0>;
21	qcom,pmic-id = <65545 65546 0 0>;
22	qcom,board-id = <12 0>;
23
24	/* This enables graphical output via bootloader-enabled display */
25	chosen {
26		bootargs = "earlycon=tty0 console=tty0";
27
28		#address-cells = <2>;
29		#size-cells = <2>;
30		ranges;
31
32		framebuffer0: framebuffer@3404000 {
33			status= "okay";
34			compatible = "simple-framebuffer";
35			reg = <0 0x3404000 0 (1080 * 1920 * 3)>;
36			width = <1080>;
37			height = <1920>;
38			stride = <(1080 * 3)>;
39			format = "r8g8b8";
40		};
41	};
42
43	gpio_keys {
44		compatible = "gpio-keys";
45		input-name = "gpio-keys";
46		#address-cells = <1>;
47		#size-cells = <0>;
48		autorepeat;
49
50		button@0 {
51			label = "Volume Up";
52			gpios = <&pm8994_gpios 3 GPIO_ACTIVE_LOW>;
53			linux,input-type = <1>;
54			linux,code = <KEY_VOLUMEUP>;
55			wakeup-source;
56			debounce-interval = <15>;
57		};
58	};
59
60	reserved-memory {
61		#address-cells = <2>;
62		#size-cells = <2>;
63		ranges;
64
65		/* This is for getting crash logs using Android downstream kernels */
66		ramoops@dfc00000 {
67			compatible = "ramoops";
68			reg = <0x0 0xdfc00000 0x0 0x40000>;
69			console-size = <0x10000>;
70			record-size = <0x10000>;
71			ftrace-size = <0x10000>;
72			pmsg-size = <0x20000>;
73		};
74
75		modem_region: modem_region@9000000 {
76			reg = <0x0 0x9000000 0x0 0x5a00000>;
77			no-map;
78		};
79
80		tzapp: modem_region@ea00000 {
81			reg = <0x0 0xea00000 0x0 0x1900000>;
82			no-map;
83		};
84	};
85};
86
87&blsp1_i2c2 {
88	status = "okay";
89
90	/* Atmel or Synaptics touchscreen */
91};
92
93&blsp1_i2c5 {
94	status = "okay";
95
96	/* ST lsm6db0 gyro/accelerometer */
97};
98
99&blsp1_i2c6 {
100	status = "okay";
101
102	/*
103	 * NXP NCI NFC,
104	 * TI USB320 Type-C controller,
105	 * Pericom 30216a USB (de)mux switch
106	 */
107};
108
109&blsp2_i2c1 {
110	status = "okay";
111
112	/* cm36686 proximity and ambient light sensor */
113};
114
115&blsp2_i2c5 {
116	status = "okay";
117
118	/* Silabs si4705 FM transmitter */
119};
120
121&blsp2_uart2 {
122	status = "okay";
123};
124
125&peripheral_region {
126	reg = <0x0 0x7400000 0x0 0x1c00000>;
127	no-map;
128};
129
130&rpm_requests {
131	pm8994-regulators {
132		compatible = "qcom,rpm-pm8994-regulators";
133
134		vdd_l1-supply = <&pm8994_s7>;
135		vdd_l2_26_28-supply = <&pm8994_s3>;
136		vdd_l3_11-supply = <&pm8994_s3>;
137		vdd_l4_27_31-supply = <&pm8994_s3>;
138		vdd_l5_7-supply = <&pm8994_s3>;
139		vdd_l6_12_32-supply = <&pm8994_s5>;
140		vdd_l8_16_30-supply = <&vph_pwr>;
141		vdd_l9_10_18_22-supply = <&vph_pwr>;
142		vdd_l13_19_23_24-supply = <&vph_pwr>;
143		vdd_l14_15-supply = <&pm8994_s5>;
144		vdd_l17_29-supply = <&vph_pwr>;
145		vdd_l20_21-supply = <&vph_pwr>;
146		vdd_l25-supply = <&pm8994_s5>;
147		vdd_lvs1_2 = <&pm8994_s4>;
148
149		/* S1, S2, S6 and S12 are managed by RPMPD */
150
151		pm8994_s3: s3 {
152			regulator-min-microvolt = <1300000>;
153			regulator-max-microvolt = <1300000>;
154		};
155
156		pm8994_s4: s4 {
157			regulator-min-microvolt = <1800000>;
158			regulator-max-microvolt = <1800000>;
159			regulator-allow-set-load;
160			regulator-always-on;
161			regulator-system-load = <325000>;
162		};
163
164		pm8994_s5: s5 {
165			regulator-min-microvolt = <2150000>;
166			regulator-max-microvolt = <2150000>;
167		};
168
169		pm8994_s7: s7 {
170			regulator-min-microvolt = <1000000>;
171			regulator-max-microvolt = <1000000>;
172		};
173
174		/* S8, S9, S10 and S11 - SPMI-managed VDD_APC */
175
176		pm8994_l1: l1 {
177			regulator-min-microvolt = <1000000>;
178			regulator-max-microvolt = <1000000>;
179		};
180
181		pm8994_l2: l2 {
182			regulator-min-microvolt = <1250000>;
183			regulator-max-microvolt = <1250000>;
184		};
185
186		pm8994_l3: l3 {
187			regulator-min-microvolt = <1200000>;
188			regulator-max-microvolt = <1200000>;
189		};
190
191		pm8994_l4: l4 {
192			regulator-min-microvolt = <1225000>;
193			regulator-max-microvolt = <1225000>;
194		};
195
196		/* L5 is inaccessible from RPM */
197
198		pm8994_l6: l6 {
199			regulator-min-microvolt = <1800000>;
200			regulator-max-microvolt = <1800000>;
201		};
202
203		/* L7 is inaccessible from RPM */
204
205		pm8994_l8: l8 {
206			regulator-min-microvolt = <1800000>;
207			regulator-max-microvolt = <1800000>;
208		};
209
210		pm8994_l9: l9 {
211			regulator-min-microvolt = <1800000>;
212			regulator-max-microvolt = <1800000>;
213		};
214
215		pm8994_l10: l10 {
216			regulator-min-microvolt = <1800000>;
217			regulator-max-microvolt = <1800000>;
218		};
219
220		pm8994_l11: l11 {
221			regulator-min-microvolt = <1200000>;
222			regulator-max-microvolt = <1200000>;
223		};
224
225		pm8994_l12: l12 {
226			regulator-min-microvolt = <1800000>;
227			regulator-max-microvolt = <1800000>;
228		};
229
230		pm8994_l13: l13 {
231			regulator-min-microvolt = <1800000>;
232			regulator-max-microvolt = <2950000>;
233		};
234
235		pm8994_l14: l14 {
236			regulator-min-microvolt = <1800000>;
237			regulator-max-microvolt = <1800000>;
238		};
239
240		pm8994_l15: l15 {
241			regulator-min-microvolt = <1800000>;
242			regulator-max-microvolt = <1800000>;
243		};
244
245		pm8994_l16: l16 {
246			regulator-min-microvolt = <2700000>;
247			regulator-max-microvolt = <2700000>;
248		};
249
250		pm8994_l17: l17 {
251			regulator-min-microvolt = <2700000>;
252			regulator-max-microvolt = <2700000>;
253		};
254
255		pm8994_l18: l18 {
256			regulator-min-microvolt = <2850000>;
257			regulator-max-microvolt = <2850000>;
258			regulator-always-on;
259		};
260
261		pm8994_l19: l19 {
262			regulator-min-microvolt = <2800000>;
263			regulator-max-microvolt = <2800000>;
264		};
265
266		pm8994_l20: l20 {
267			regulator-min-microvolt = <2950000>;
268			regulator-max-microvolt = <2950000>;
269			regulator-always-on;
270			regulator-boot-on;
271			regulator-allow-set-load;
272			regulator-system-load = <570000>;
273		};
274
275		pm8994_l21: l21 {
276			regulator-min-microvolt = <2950000>;
277			regulator-max-microvolt = <2950000>;
278			regulator-always-on;
279		};
280
281		pm8994_l22: l22 {
282			regulator-min-microvolt = <3000000>;
283			regulator-max-microvolt = <3000000>;
284		};
285
286		pm8994_l23: l23 {
287			regulator-min-microvolt = <2800000>;
288			regulator-max-microvolt = <2800000>;
289		};
290
291		pm8994_l24: l24 {
292			regulator-min-microvolt = <3075000>;
293			regulator-max-microvolt = <3150000>;
294		};
295
296		pm8994_l25: l25 {
297			regulator-min-microvolt = <1000000>;
298			regulator-max-microvolt = <1000000>;
299		};
300
301		pm8994_l26: l26 {
302			regulator-min-microvolt = <987500>;
303			regulator-max-microvolt = <987500>;
304
305		};
306
307		pm8994_l27: l27 {
308			regulator-min-microvolt = <1050000>;
309			regulator-max-microvolt = <1050000>;
310		};
311
312		pm8994_l28: l28 {
313			regulator-min-microvolt = <1000000>;
314			regulator-max-microvolt = <1000000>;
315		};
316
317		pm8994_l29: l29 {
318			regulator-min-microvolt = <2800000>;
319			regulator-max-microvolt = <2800000>;
320		};
321
322		pm8994_l30: l30 {
323			regulator-min-microvolt = <1800000>;
324			regulator-max-microvolt = <1800000>;
325		};
326
327		pm8994_l31: l31 {
328			regulator-min-microvolt = <1262500>;
329			regulator-max-microvolt = <1262500>;
330		};
331
332		pm8994_l32: l32 {
333			regulator-min-microvolt = <1800000>;
334			regulator-max-microvolt = <1800000>;
335		};
336
337		pm8994_lvs1: lvs1 {};
338		pm8994_lvs2: lvs2 {};
339	};
340
341	pmi8994_regulators: pmi8994-regulators {
342		compatible = "qcom,rpm-pmi8994-regulators";
343		vdd_s1-supply = <&vph_pwr>;
344		vdd_bst_byp-supply = <&vph_pwr>;
345
346		pmi8994_s1: s1 {
347			regulator-min-microvolt = <1025000>;
348			regulator-max-microvolt = <1025000>;
349		};
350
351		/* S2 & S3 - VDD_GFX */
352
353		pmi8994_bby: boost-bypass {
354			regulator-min-microvolt = <3150000>;
355			regulator-max-microvolt = <3600000>;
356		};
357	};
358};
359
360&sdhc1 {
361	status = "okay";
362
363	mmc-hs400-1_8v;
364	vmmc-supply = <&pm8994_l20>;
365	vqmmc-supply = <&pm8994_s4>;
366};
367