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	touchscreen: rmi4-i2c-dev@2c {
151		compatible = "syna,rmi4-i2c";
152		reg = <0x2c>;
153		#address-cells = <1>;
154		#size-cells = <0>;
155
156		interrupt-parent = <&tlmm>;
157		interrupts = <42 IRQ_TYPE_EDGE_FALLING>;
158
159		pinctrl-names = "default";
160		pinctrl-0 = <&ts_int_active &ts_reset_active>;
161
162		vdd-supply = <&pm8994_l22>;
163		vio-supply = <&pm8994_s4>;
164
165		syna,reset-delay-ms = <220>;
166		syna,startup-delay-ms = <220>;
167
168		rmi4-f01@1 {
169			reg = <0x01>;
170			syna,nosleep-mode = <1>;
171		};
172
173		rmi4-f11@11 {
174			reg = <0x11>;
175			syna,sensor-type = <1>;
176		};
177	};
178};
179
180&blsp1_uart2 {
181	status = "okay";
182};
183
184&blsp2_uart2 {
185	status = "okay";
186};
187
188&pmi8994_spmi_regulators {
189	/*
190	 * Yeah, this one *is* managed by RPMPD, but also needs
191	 * to be hacked up as a-o due to the GPU device only accepting a single
192	 * power domain.. which still isn't enough and forces us to bind
193	 * OXILI_CX and OXILI_GX together!
194	 */
195	vdd_gfx: s2@1700 {
196		reg = <0x1700 0x100>;
197		regulator-name = "VDD_GFX";
198		regulator-min-microvolt = <980000>;
199		regulator-max-microvolt = <980000>;
200
201		/* hack until we rig up the gpu consumer */
202		regulator-always-on;
203	};
204};
205
206&rpm_requests {
207	pm8994_regulators: pm8994-regulators {
208		compatible = "qcom,rpm-pm8994-regulators";
209
210		vdd_s1-supply = <&vph_pwr>;
211		vdd_s2-supply = <&vph_pwr>;
212		vdd_s3-supply = <&vph_pwr>;
213		vdd_s4-supply = <&vph_pwr>;
214		vdd_s5-supply = <&vph_pwr>;
215		vdd_s6-supply = <&vph_pwr>;
216		vdd_s7-supply = <&vph_pwr>;
217		vdd_s8-supply = <&vph_pwr>;
218		vdd_s9-supply = <&vph_pwr>;
219		vdd_s10-supply = <&vph_pwr>;
220		vdd_s11-supply = <&vph_pwr>;
221		vdd_s12-supply = <&vph_pwr>;
222		vdd_l1-supply = <&pmi8994_s1>;
223		vdd_l2_l26_l28-supply = <&pm8994_s3>;
224		vdd_l3_l11-supply = <&pm8994_s3>;
225		vdd_l4_l27_l31-supply = <&pm8994_s3>;
226		vdd_l5_l7-supply = <&pm8994_s5>;
227		vdd_l6_l12_l32-supply = <&pm8994_s5>;
228		vdd_l8_l16_l30-supply = <&vph_pwr>;
229		vdd_l9_l10_l18_l22-supply = <&pmi8994_bby>;
230		vdd_l13_l19_l23_l24-supply = <&pmi8994_bby>;
231		vdd_l14_l15-supply = <&pm8994_s5>;
232		vdd_l17_l29-supply = <&pmi8994_bby>;
233		vdd_l20_l21-supply = <&pmi8994_bby>;
234		vdd_l25-supply = <&pm8994_s3>;
235		vdd_lvs1_lvs2-supply = <&pm8994_s4>;
236
237		/* S1, S2, S6 and S12 are managed by RPMPD */
238
239		pm8994_s3: s3 {
240			regulator-min-microvolt = <1300000>;
241			regulator-max-microvolt = <1300000>;
242		};
243
244		pm8994_s4: s4 {
245			regulator-min-microvolt = <1800000>;
246			regulator-max-microvolt = <1800000>;
247			regulator-allow-set-load;
248			regulator-always-on;
249			regulator-system-load = <325000>;
250		};
251
252		pm8994_s5: s5 {
253			regulator-min-microvolt = <2150000>;
254			regulator-max-microvolt = <2150000>;
255		};
256
257		pm8994_s7: s7 {
258			regulator-min-microvolt = <1000000>;
259			regulator-max-microvolt = <1000000>;
260		};
261
262		/*
263		 * S8 - SPMI-managed VDD_APC0
264		 * S9, S10 and S11 (the main one) - SPMI-managed VDD_APC1
265		 */
266
267		pm8994_l1: l1 {
268			regulator-min-microvolt = <1000000>;
269			regulator-max-microvolt = <1000000>;
270		};
271
272		pm8994_l2: l2 {
273			regulator-min-microvolt = <1250000>;
274			regulator-max-microvolt = <1250000>;
275			regulator-allow-set-load;
276			regulator-system-load = <10000>;
277		};
278
279		pm8994_l3: l3 {
280			regulator-min-microvolt = <1100000>;
281			regulator-max-microvolt = <1100000>;
282		};
283
284		pm8994_l4: l4 {
285			regulator-min-microvolt = <1225000>;
286			regulator-max-microvolt = <1225000>;
287		};
288
289		/* L5 is inaccessible from RPM */
290
291		pm8994_l6: l6 {
292			regulator-min-microvolt = <1800000>;
293			regulator-max-microvolt = <1800000>;
294		};
295
296		/* L7 is inaccessible from RPM */
297
298		pm8994_l8: l8 {
299			regulator-min-microvolt = <1800000>;
300			regulator-max-microvolt = <1800000>;
301		};
302
303		pm8994_l9: l9 {
304			regulator-min-microvolt = <1800000>;
305			regulator-max-microvolt = <1800000>;
306		};
307
308		pm8994_l10: l10 {
309			regulator-min-microvolt = <1800000>;
310			regulator-max-microvolt = <1800000>;
311		};
312
313		pm8994_l11: l11 {
314			regulator-min-microvolt = <1200000>;
315			regulator-max-microvolt = <1200000>;
316		};
317
318		pm8994_l12: l12 {
319			regulator-min-microvolt = <1800000>;
320			regulator-max-microvolt = <1800000>;
321			regulator-allow-set-load;
322			regulator-system-load = <10000>;
323		};
324
325		pm8994_l13: l13 {
326			regulator-min-microvolt = <1800000>;
327			regulator-max-microvolt = <2950000>;
328		};
329
330		pm8994_l14: l14 {
331			regulator-min-microvolt = <1800000>;
332			regulator-max-microvolt = <1800000>;
333			regulator-allow-set-load;
334			regulator-system-load = <10000>;
335		};
336
337		pm8994_l15: l15 {
338			regulator-min-microvolt = <1800000>;
339			regulator-max-microvolt = <1800000>;
340		};
341
342		pm8994_l16: l16 {
343			regulator-min-microvolt = <2700000>;
344			regulator-max-microvolt = <2700000>;
345		};
346
347		pm8994_l17: l17 {
348			regulator-min-microvolt = <2200000>;
349			regulator-max-microvolt = <2200000>;
350		};
351
352		pm8994_l18: l18 {
353			regulator-min-microvolt = <2850000>;
354			regulator-max-microvolt = <2850000>;
355			regulator-always-on;
356		};
357
358		pm8994_l19: l19 {
359			regulator-min-microvolt = <2850000>;
360			regulator-max-microvolt = <2850000>;
361		};
362
363		pm8994_l20: l20 {
364			regulator-min-microvolt = <2950000>;
365			regulator-max-microvolt = <2950000>;
366			regulator-always-on;
367			regulator-boot-on;
368			regulator-allow-set-load;
369			regulator-system-load = <570000>;
370		};
371
372		pm8994_l21: l21 {
373			regulator-min-microvolt = <2950000>;
374			regulator-max-microvolt = <2950000>;
375			regulator-always-on;
376			regulator-allow-set-load;
377			regulator-system-load = <800000>;
378		};
379
380		pm8994_l22: l22 {
381			regulator-min-microvolt = <3000000>;
382			regulator-max-microvolt = <3000000>;
383		};
384
385		pm8994_l23: l23 {
386			regulator-min-microvolt = <2800000>;
387			regulator-max-microvolt = <2800000>;
388		};
389
390		pm8994_l24: l24 {
391			regulator-min-microvolt = <3075000>;
392			regulator-max-microvolt = <3150000>;
393		};
394
395		pm8994_l25: l25 {
396			regulator-min-microvolt = <1000000>;
397			regulator-max-microvolt = <1000000>;
398		};
399
400		pm8994_l26: l26 {
401			regulator-min-microvolt = <987500>;
402			regulator-max-microvolt = <987500>;
403		};
404
405		pm8994_l27: l27 {
406			regulator-min-microvolt = <1200000>;
407			regulator-max-microvolt = <1200000>;
408		};
409
410		pm8994_l28: l28 {
411			regulator-min-microvolt = <1000000>;
412			regulator-max-microvolt = <1000000>;
413			regulator-allow-set-load;
414			regulator-system-load = <10000>;
415		};
416
417		pm8994_l29: l29 {
418			regulator-min-microvolt = <2700000>;
419			regulator-max-microvolt = <2700000>;
420		};
421
422		pm8994_l30: l30 {
423			regulator-min-microvolt = <1800000>;
424			regulator-max-microvolt = <1800000>;
425		};
426
427		pm8994_l31: l31 {
428			regulator-min-microvolt = <1200000>;
429			regulator-max-microvolt = <1200000>;
430			regulator-allow-set-load;
431			regulator-system-load = <10000>;
432		};
433
434		pm8994_l32: l32 {
435			regulator-min-microvolt = <1800000>;
436			regulator-max-microvolt = <1800000>;
437		};
438
439		pm8994_lvs1: lvs1 {};
440		pm8994_lvs2: lvs2 {};
441	};
442
443	pmi8994_regulators: pmi8994-regulators {
444		compatible = "qcom,rpm-pmi8994-regulators";
445
446		vdd_s1-supply = <&vph_pwr>;
447		vdd_bst_byp-supply = <&vph_pwr>;
448
449		pmi8994_s1: s1 {
450			regulator-min-microvolt = <1025000>;
451			regulator-max-microvolt = <1025000>;
452		};
453
454		/* S2 & S3 - VDD_GFX */
455
456		pmi8994_bby: boost-bypass {
457			regulator-min-microvolt = <3150000>;
458			regulator-max-microvolt = <3600000>;
459		};
460	};
461};
462
463&sdhc1 {
464	/*
465	 * There is an issue with the eMMC causing permanent
466	 * damage to the card if a quirk isn't addressed.
467	 * Until it's fixed, disable the MMC so as not to brick
468	 * devices.
469	 */
470	status = "disabled";
471
472	/*
473	 * Downstream pushes 2.95V to the sdhci device,
474	 * but upstream driver REALLY wants to make vmmc 1.8v
475	 * cause of the hs400-1_8v mode. MMC works fine without
476	 * that regulator, so let's not use it for now.
477	 * vqmmc is also disabled cause driver stll complains.
478	 *
479	 * vmmc-supply = <&pm8994_l20>;
480	 * vqmmc-supply = <&pm8994_s4>;
481	 */
482};
483
484&sdhc2 {
485	status = "okay";
486
487	cd-gpios = <&tlmm 100 0>;
488	vmmc-supply = <&pm8994_l21>;
489	vqmmc-supply = <&pm8994_l13>;
490};
491
492&tlmm {
493	ts_int_active: ts-int-active {
494		pins = "gpio42";
495		drive-strength = <2>;
496		bias-disable;
497		input-enable;
498	};
499
500	ts_reset_active: ts-reset-active {
501		pins = "gpio109";
502		drive-strength = <2>;
503		bias-disable;
504		output-low;
505	};
506};
507