1// SPDX-License-Identifier: BSD-3-Clause
2/*
3 * Copyright (c) 2020, Konrad Dybcio
4 */
5
6#include "msm8994.dtsi"
7#include "pm8994.dtsi"
8#include "pmi8994.dtsi"
9#include <dt-bindings/gpio/gpio.h>
10#include <dt-bindings/input/gpio-keys.h>
11
12/ {
13	/* required for bootloader to select correct board */
14
15	/*
16	 * We support MSM8994 v2 (0x20000) and v2.1 (0x20001).
17	 * The V1 chip (0x0 and 0x10000) is significantly different
18	 * and requires driver-side changes (including CPR, be warned!!).
19	 * Besides that, it's very rare.
20	 */
21	qcom,msm-id = <207 0x20000>, <207 0x20001>;
22	/* We only use pm8994+pmi8994. */
23	qcom,pmic-id = <0x10009 0x1000a 0x00 0x00>;
24	/* This property is shared across all kitakami devices. */
25	qcom,board-id = <8 0>;
26
27	/* Kitakami firmware doesn't support PSCI */
28	/delete-node/ psci;
29
30	gpio_keys {
31		compatible = "gpio-keys";
32		input-name = "gpio-keys";
33		#address-cells = <1>;
34		#size-cells = <0>;
35		autorepeat;
36
37		button@0 {
38			label = "Volume Down";
39			gpios = <&pm8994_gpios 2 GPIO_ACTIVE_LOW>;
40			linux,input-type = <1>;
41			linux,code = <KEY_VOLUMEDOWN>;
42			wakeup-source;
43			debounce-interval = <15>;
44		};
45
46		button@1 {
47			label = "Volume Up";
48			gpios = <&pm8994_gpios 3 GPIO_ACTIVE_LOW>;
49			linux,input-type = <1>;
50			linux,code = <KEY_VOLUMEUP>;
51			wakeup-source;
52			debounce-interval = <15>;
53		};
54
55		button@2 {
56			label = "Camera Snapshot";
57			gpios = <&pm8994_gpios 4 GPIO_ACTIVE_LOW>;
58			linux,input-type = <1>;
59			linux,code = <KEY_CAMERA>;
60			wakeup-source;
61			debounce-interval = <15>;
62		};
63
64		button@3 {
65			label = "Camera Focus";
66			gpios = <&pm8994_gpios 5 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		/* This is for getting crash logs using Android downstream kernels */
80		ramoops@1fe00000 {
81			compatible = "ramoops";
82			reg = <0x0 0x1fe00000 0x0 0x200000>;
83			console-size = <0x100000>;
84			record-size = <0x10000>;
85			ftrace-size = <0x10000>;
86			pmsg-size = <0x80000>;
87		};
88
89		continuous_splash: framebuffer@3401000{
90			reg = <0x0 0x3401000 0x0 0x2200000>;
91			no-map;
92		};
93
94		dfps_data_mem: dfps_data_mem@3400000 {
95			reg = <0x0 0x3400000 0x0 0x1000>;
96			no-map;
97		};
98
99		peripheral_region: peripheral_region@7400000 {
100			reg = <0x0 0x7400000 0x0 0x1c00000>;
101			no-map;
102		};
103
104		modem_region: modem_region@9000000 {
105			reg = <0x0 0x9000000 0x0 0x5a00000>;
106			no-map;
107		};
108
109		tzapp: modem_region@ea00000 {
110			reg = <0x0 0xea00000 0x0 0x1900000>;
111			no-map;
112		};
113
114		fb_region: fb_region@40000000 {
115			reg = <0x00 0x40000000 0x00 0x1000000>;
116			no-map;
117		};
118	};
119};
120
121&blsp_spi0 {
122	status = "okay";
123
124	/* FPC fingerprint reader */
125};
126
127/* I2C1 is disabled on this board */
128
129&blsp_i2c2 {
130	status = "okay";
131
132	/* NXP PN547 NFC */
133};
134
135&blsp_i2c4 {
136	status = "okay";
137
138	/* Empty but active */
139};
140
141&blsp_i2c5 {
142	status = "okay";
143
144	/* sii8620 HDMI/MHL bridge */
145};
146
147&blsp_i2c6 {
148	status = "okay";
149
150	/* Synaptics touchscreen */
151};
152
153&blsp1_uart2 {
154	status = "okay";
155};
156
157&blsp2_uart2 {
158	status = "okay";
159};
160
161&rpm_requests {
162	pm8994_regulators: pm8994-regulators {
163		compatible = "qcom,rpm-pm8994-regulators";
164
165		vdd_s1-supply = <&vph_pwr>;
166		vdd_s2-supply = <&vph_pwr>;
167		vdd_s3-supply = <&vph_pwr>;
168		vdd_s4-supply = <&vph_pwr>;
169		vdd_s5-supply = <&vph_pwr>;
170		vdd_s6-supply = <&vph_pwr>;
171		vdd_s7-supply = <&vph_pwr>;
172		vdd_s8-supply = <&vph_pwr>;
173		vdd_s9-supply = <&vph_pwr>;
174		vdd_s10-supply = <&vph_pwr>;
175		vdd_s11-supply = <&vph_pwr>;
176		vdd_s12-supply = <&vph_pwr>;
177		vdd_l1-supply = <&pmi8994_s1>;
178		vdd_l2_l26_l28-supply = <&pm8994_s3>;
179		vdd_l3_l11-supply = <&pm8994_s3>;
180		vdd_l4_l27_l31-supply = <&pm8994_s3>;
181		vdd_l5_l7-supply = <&pm8994_s5>;
182		vdd_l6_l12_l32-supply = <&pm8994_s5>;
183		vdd_l8_l16_l30-supply = <&vph_pwr>;
184		vdd_l9_l10_l18_l22-supply = <&pmi8994_bby>;
185		vdd_l13_l19_l23_l24-supply = <&pmi8994_bby>;
186		vdd_l14_l15-supply = <&pm8994_s5>;
187		vdd_l17_l29-supply = <&pmi8994_bby>;
188		vdd_l20_l21-supply = <&pmi8994_bby>;
189		vdd_l25-supply = <&pm8994_s3>;
190		vdd_lvs1_lvs2-supply = <&pm8994_s4>;
191
192		/* S1, S2, S6 and S12 are managed by RPMPD */
193
194		pm8994_s3: s3 {
195			regulator-min-microvolt = <1300000>;
196			regulator-max-microvolt = <1300000>;
197		};
198
199		pm8994_s4: s4 {
200			regulator-min-microvolt = <1800000>;
201			regulator-max-microvolt = <1800000>;
202			regulator-allow-set-load;
203			regulator-always-on;
204			regulator-system-load = <325000>;
205		};
206
207		pm8994_s5: s5 {
208			regulator-min-microvolt = <2150000>;
209			regulator-max-microvolt = <2150000>;
210		};
211
212		pm8994_s7: s7 {
213			regulator-min-microvolt = <1000000>;
214			regulator-max-microvolt = <1000000>;
215		};
216
217		/*
218		 * S8 - SPMI-managed VDD_APC0
219		 * S9, S10 and S11 (the main one) - SPMI-managed VDD_APC1
220		 */
221
222		pm8994_l1: l1 {
223			regulator-min-microvolt = <1000000>;
224			regulator-max-microvolt = <1000000>;
225		};
226
227		pm8994_l2: l2 {
228			regulator-min-microvolt = <1250000>;
229			regulator-max-microvolt = <1250000>;
230			regulator-allow-set-load;
231			regulator-system-load = <10000>;
232		};
233
234		pm8994_l3: l3 {
235			regulator-min-microvolt = <1100000>;
236			regulator-max-microvolt = <1100000>;
237		};
238
239		pm8994_l4: l4 {
240			regulator-min-microvolt = <1225000>;
241			regulator-max-microvolt = <1225000>;
242		};
243
244		/* L5 is inaccessible from RPM */
245
246		pm8994_l6: l6 {
247			regulator-min-microvolt = <1800000>;
248			regulator-max-microvolt = <1800000>;
249		};
250
251		/* L7 is inaccessible from RPM */
252
253		pm8994_l8: l8 {
254			regulator-min-microvolt = <1800000>;
255			regulator-max-microvolt = <1800000>;
256		};
257
258		pm8994_l9: l9 {
259			regulator-min-microvolt = <1800000>;
260			regulator-max-microvolt = <1800000>;
261		};
262
263		pm8994_l10: l10 {
264			regulator-min-microvolt = <1800000>;
265			regulator-max-microvolt = <1800000>;
266		};
267
268		pm8994_l11: l11 {
269			regulator-min-microvolt = <1200000>;
270			regulator-max-microvolt = <1200000>;
271		};
272
273		pm8994_l12: l12 {
274			regulator-min-microvolt = <1800000>;
275			regulator-max-microvolt = <1800000>;
276			regulator-allow-set-load;
277			regulator-system-load = <10000>;
278		};
279
280		pm8994_l13: l13 {
281			regulator-min-microvolt = <1800000>;
282			regulator-max-microvolt = <2950000>;
283		};
284
285		pm8994_l14: l14 {
286			regulator-min-microvolt = <1800000>;
287			regulator-max-microvolt = <1800000>;
288			regulator-allow-set-load;
289			regulator-system-load = <10000>;
290		};
291
292		pm8994_l15: l15 {
293			regulator-min-microvolt = <1800000>;
294			regulator-max-microvolt = <1800000>;
295		};
296
297		pm8994_l16: l16 {
298			regulator-min-microvolt = <2700000>;
299			regulator-max-microvolt = <2700000>;
300		};
301
302		pm8994_l17: l17 {
303			regulator-min-microvolt = <2200000>;
304			regulator-max-microvolt = <2200000>;
305		};
306
307		pm8994_l18: l18 {
308			regulator-min-microvolt = <2850000>;
309			regulator-max-microvolt = <2850000>;
310			regulator-always-on;
311		};
312
313		pm8994_l19: l19 {
314			regulator-min-microvolt = <2850000>;
315			regulator-max-microvolt = <2850000>;
316		};
317
318		pm8994_l20: l20 {
319			regulator-min-microvolt = <2950000>;
320			regulator-max-microvolt = <2950000>;
321			regulator-always-on;
322			regulator-boot-on;
323			regulator-allow-set-load;
324			regulator-system-load = <570000>;
325		};
326
327		pm8994_l21: l21 {
328			regulator-min-microvolt = <2950000>;
329			regulator-max-microvolt = <2950000>;
330			regulator-always-on;
331		};
332
333		pm8994_l22: l22 {
334			regulator-min-microvolt = <3000000>;
335			regulator-max-microvolt = <3000000>;
336		};
337
338		pm8994_l23: l23 {
339			regulator-min-microvolt = <2800000>;
340			regulator-max-microvolt = <2800000>;
341		};
342
343		pm8994_l24: l24 {
344			regulator-min-microvolt = <3075000>;
345			regulator-max-microvolt = <3150000>;
346		};
347
348		pm8994_l25: l25 {
349			regulator-min-microvolt = <1000000>;
350			regulator-max-microvolt = <1000000>;
351		};
352
353		pm8994_l26: l26 {
354			regulator-min-microvolt = <987500>;
355			regulator-max-microvolt = <987500>;
356		};
357
358		pm8994_l27: l27 {
359			regulator-min-microvolt = <1200000>;
360			regulator-max-microvolt = <1200000>;
361		};
362
363		pm8994_l28: l28 {
364			regulator-min-microvolt = <1000000>;
365			regulator-max-microvolt = <1000000>;
366			regulator-allow-set-load;
367			regulator-system-load = <10000>;
368		};
369
370		pm8994_l29: l29 {
371			regulator-min-microvolt = <2700000>;
372			regulator-max-microvolt = <2700000>;
373		};
374
375		pm8994_l30: l30 {
376			regulator-min-microvolt = <1800000>;
377			regulator-max-microvolt = <1800000>;
378		};
379
380		pm8994_l31: l31 {
381			regulator-min-microvolt = <1200000>;
382			regulator-max-microvolt = <1200000>;
383			regulator-allow-set-load;
384			regulator-system-load = <10000>;
385		};
386
387		pm8994_l32: l32 {
388			regulator-min-microvolt = <1800000>;
389			regulator-max-microvolt = <1800000>;
390		};
391
392		pm8994_lvs1: lvs1 {};
393		pm8994_lvs2: lvs2 {};
394	};
395
396	pmi8994_regulators: pmi8994-regulators {
397		compatible = "qcom,rpm-pmi8994-regulators";
398
399		vdd_s1-supply = <&vph_pwr>;
400		vdd_bst_byp-supply = <&vph_pwr>;
401
402		pmi8994_s1: s1 {
403			regulator-min-microvolt = <1025000>;
404			regulator-max-microvolt = <1025000>;
405		};
406
407		/* S2 & S3 - VDD_GFX */
408
409		pmi8994_bby: boost-bypass {
410			regulator-min-microvolt = <3150000>;
411			regulator-max-microvolt = <3600000>;
412		};
413	};
414};
415
416&sdhc1 {
417	/*
418	 * There is an issue with the eMMC causing permanent
419	 * damage to the card if a quirk isn't addressed.
420	 * Until it's fixed, disable the MMC so as not to brick
421	 * devices.
422	 */
423	status = "disabled";
424
425	/*
426	 * Downstream pushes 2.95V to the sdhci device,
427	 * but upstream driver REALLY wants to make vmmc 1.8v
428	 * cause of the hs400-1_8v mode. MMC works fine without
429	 * that regulator, so let's not use it for now.
430	 * vqmmc is also disabled cause driver stll complains.
431	 *
432	 * vmmc-supply = <&pm8994_l20>;
433	 * vqmmc-supply = <&pm8994_s4>;
434	 */
435};
436