1// SPDX-License-Identifier: GPL-2.0-only
2// Copyright (C) 2019 Stephan Gerhold
3
4/dts-v1/;
5
6#include "msm8916-pm8916.dtsi"
7#include <dt-bindings/gpio/gpio.h>
8#include <dt-bindings/input/input.h>
9#include <dt-bindings/interrupt-controller/irq.h>
10
11/*
12 * NOTE: The original firmware from Samsung can only boot ARM32 kernels.
13 * Unfortunately, the firmware is signed and cannot be replaced easily.
14 * There seems to be no way to boot ARM64 kernels on this device at the moment,
15 * even though the hardware would support it.
16 *
17 * However, it is possible to use this device tree by compiling an ARM32 kernel
18 * instead. For clarity and build testing this device tree is maintained next
19 * to the other MSM8916 device trees. However, it is actually used through
20 *   arch/arm/boot/dts/qcom-msm8916-samsung-serranove.dts
21 */
22
23/ {
24	model = "Samsung Galaxy S4 Mini Value Edition";
25	compatible = "samsung,serranove", "qcom,msm8916";
26
27	aliases {
28		serial0 = &blsp1_uart2;
29	};
30
31	chosen {
32		stdout-path = "serial0";
33	};
34
35	reserved-memory {
36		/* Additional memory used by Samsung firmware modifications */
37		tz-apps@85500000 {
38			reg = <0x0 0x85500000 0x0 0xb00000>;
39			no-map;
40		};
41	};
42
43	gpio-keys {
44		compatible = "gpio-keys";
45
46		pinctrl-names = "default";
47		pinctrl-0 = <&gpio_keys_default>;
48
49		label = "GPIO Buttons";
50
51		volume-up {
52			label = "Volume Up";
53			gpios = <&msmgpio 107 GPIO_ACTIVE_LOW>;
54			linux,code = <KEY_VOLUMEUP>;
55		};
56
57		home {
58			label = "Home";
59			gpios = <&msmgpio 109 GPIO_ACTIVE_LOW>;
60			linux,code = <KEY_HOMEPAGE>;
61		};
62	};
63
64	gpio-hall-sensor {
65		compatible = "gpio-keys";
66
67		pinctrl-names = "default";
68		pinctrl-0 = <&gpio_hall_sensor_default>;
69
70		label = "GPIO Hall Effect Sensor";
71
72		hall-sensor {
73			label = "Hall Effect Sensor";
74			gpios = <&msmgpio 52 GPIO_ACTIVE_LOW>;
75			linux,input-type = <EV_SW>;
76			linux,code = <SW_LID>;
77			linux,can-disable;
78		};
79	};
80
81	reg_vdd_tsp: regulator-vdd-tsp {
82		compatible = "regulator-fixed";
83		regulator-name = "vdd_tsp";
84		regulator-min-microvolt = <3300000>;
85		regulator-max-microvolt = <3300000>;
86
87		gpio = <&msmgpio 73 GPIO_ACTIVE_HIGH>;
88		enable-active-high;
89
90		pinctrl-names = "default";
91		pinctrl-0 = <&tsp_en_default>;
92	};
93
94	reg_touch_key: regulator-touch-key {
95		compatible = "regulator-fixed";
96		regulator-name = "touch_key";
97		regulator-min-microvolt = <2800000>;
98		regulator-max-microvolt = <2800000>;
99
100		gpio = <&msmgpio 86 GPIO_ACTIVE_HIGH>;
101		enable-active-high;
102
103		pinctrl-names = "default";
104		pinctrl-0 = <&tkey_en_default>;
105	};
106
107	reg_key_led: regulator-key-led {
108		compatible = "regulator-fixed";
109		regulator-name = "key_led";
110		regulator-min-microvolt = <3300000>;
111		regulator-max-microvolt = <3300000>;
112
113		gpio = <&msmgpio 60 GPIO_ACTIVE_HIGH>;
114		enable-active-high;
115
116		pinctrl-names = "default";
117		pinctrl-0 = <&tkey_led_en_default>;
118	};
119
120	i2c-muic {
121		compatible = "i2c-gpio";
122		sda-gpios = <&msmgpio 105 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
123		scl-gpios = <&msmgpio 106 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
124
125		pinctrl-names = "default";
126		pinctrl-0 = <&muic_i2c_default>;
127
128		#address-cells = <1>;
129		#size-cells = <0>;
130
131		muic: extcon@14 {
132			compatible = "siliconmitus,sm5504-muic";
133			reg = <0x14>;
134
135			interrupt-parent = <&msmgpio>;
136			interrupts = <12 IRQ_TYPE_EDGE_FALLING>;
137
138			pinctrl-names = "default";
139			pinctrl-0 = <&muic_irq_default>;
140		};
141	};
142
143	i2c-tkey {
144		compatible = "i2c-gpio";
145		sda-gpios = <&msmgpio 16 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
146		scl-gpios = <&msmgpio 17 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
147
148		pinctrl-names = "default";
149		pinctrl-0 = <&tkey_i2c_default>;
150
151		#address-cells = <1>;
152		#size-cells = <0>;
153
154		touchkey@20 {
155			compatible = "coreriver,tc360-touchkey";
156			reg = <0x20>;
157
158			interrupt-parent = <&msmgpio>;
159			interrupts = <98 IRQ_TYPE_EDGE_FALLING>;
160
161			vcc-supply = <&reg_touch_key>;
162			vdd-supply = <&reg_key_led>;
163			vddio-supply = <&pm8916_l6>;
164
165			linux,keycodes = <KEY_APPSELECT KEY_BACK>;
166
167			pinctrl-names = "default";
168			pinctrl-0 = <&tkey_default>;
169		};
170	};
171
172	i2c-nfc {
173		compatible = "i2c-gpio";
174		sda-gpios = <&msmgpio 0 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
175		scl-gpios = <&msmgpio 1 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
176
177		pinctrl-names = "default";
178		pinctrl-0 = <&nfc_i2c_default>;
179
180		#address-cells = <1>;
181		#size-cells = <0>;
182
183		nfc@2b {
184			compatible = "nxp,pn547", "nxp,nxp-nci-i2c";
185			reg = <0x2b>;
186
187			interrupt-parent = <&msmgpio>;
188			interrupts = <21 IRQ_TYPE_EDGE_RISING>;
189
190			enable-gpios = <&msmgpio 20 GPIO_ACTIVE_HIGH>;
191			firmware-gpios = <&msmgpio 49 GPIO_ACTIVE_HIGH>;
192
193			pinctrl-names = "default";
194			pinctrl-0 = <&nfc_default>;
195		};
196	};
197};
198
199&blsp_i2c2 {
200	status = "okay";
201
202	imu@6b {
203		compatible = "st,lsm6ds3";
204		reg = <0x6b>;
205
206		interrupt-parent = <&msmgpio>;
207		interrupts = <115 IRQ_TYPE_EDGE_RISING>;
208
209		pinctrl-names = "default";
210		pinctrl-0 = <&imu_irq_default>;
211	};
212};
213
214&blsp_i2c4 {
215	status = "okay";
216
217	battery@35 {
218		compatible = "richtek,rt5033-battery";
219		reg = <0x35>;
220
221		interrupt-parent = <&msmgpio>;
222		interrupts = <121 IRQ_TYPE_EDGE_FALLING>;
223
224		pinctrl-names = "default";
225		pinctrl-0 = <&fg_alert_default>;
226	};
227};
228
229&blsp_i2c5 {
230	status = "okay";
231
232	touchscreen@20 {
233		compatible = "zinitix,bt541";
234		reg = <0x20>;
235
236		interrupt-parent = <&msmgpio>;
237		interrupts = <13 IRQ_TYPE_EDGE_FALLING>;
238
239		touchscreen-size-x = <540>;
240		touchscreen-size-y = <960>;
241
242		vdd-supply = <&reg_vdd_tsp>;
243		vddo-supply = <&pm8916_l6>;
244
245		pinctrl-names = "default";
246		pinctrl-0 = <&tsp_irq_default>;
247	};
248};
249
250&blsp1_uart2 {
251	status = "okay";
252};
253
254&pm8916_resin {
255	status = "okay";
256	linux,code = <KEY_VOLUMEDOWN>;
257};
258
259&pm8916_vib {
260	status = "okay";
261};
262
263&pronto {
264	status = "okay";
265
266	iris {
267		compatible = "qcom,wcn3660b";
268	};
269};
270
271&sdhc_1 {
272	status = "okay";
273
274	pinctrl-names = "default", "sleep";
275	pinctrl-0 = <&sdc1_clk_on &sdc1_cmd_on &sdc1_data_on>;
276	pinctrl-1 = <&sdc1_clk_off &sdc1_cmd_off &sdc1_data_off>;
277};
278
279&sdhc_2 {
280	status = "okay";
281
282	pinctrl-names = "default", "sleep";
283	pinctrl-0 = <&sdc2_clk_on &sdc2_cmd_on &sdc2_data_on>;
284	pinctrl-1 = <&sdc2_clk_off &sdc2_cmd_off &sdc2_data_off>;
285
286	non-removable;
287
288	/*
289	 * FIXME: Disable UHS-I modes since tuning fails with:
290	 *
291	 * sdhci_msm 7864900.sdhci: mmc1: No tuning point found
292	 * mmc1: tuning execution failed: -5
293	 * mmc1: error -5 whilst initialising SD card
294	 *
295	 * This is the quirk used on downstream, which suggests this is
296	 * a hardware limitation. However, probing a card using DDR50 works
297	 * (without tuning), so maybe only tuning is broken?
298	 */
299	no-1-8-v;
300};
301
302&usb {
303	status = "okay";
304	extcon = <&muic>, <&muic>;
305};
306
307&usb_hs_phy {
308	extcon = <&muic>;
309};
310
311&smd_rpm_regulators {
312	vdd_l1_l2_l3-supply = <&pm8916_s3>;
313	vdd_l4_l5_l6-supply = <&pm8916_s4>;
314	vdd_l7-supply = <&pm8916_s4>;
315
316	s3 {
317		regulator-min-microvolt = <1200000>;
318		regulator-max-microvolt = <1300000>;
319	};
320
321	s4 {
322		regulator-min-microvolt = <1800000>;
323		regulator-max-microvolt = <2100000>;
324	};
325
326	l1 {
327		regulator-min-microvolt = <1225000>;
328		regulator-max-microvolt = <1225000>;
329	};
330
331	l2 {
332		regulator-min-microvolt = <1200000>;
333		regulator-max-microvolt = <1200000>;
334	};
335
336	l4 {
337		regulator-min-microvolt = <2050000>;
338		regulator-max-microvolt = <2050000>;
339	};
340
341	l5 {
342		regulator-min-microvolt = <1800000>;
343		regulator-max-microvolt = <1800000>;
344	};
345
346	l6 {
347		regulator-min-microvolt = <1800000>;
348		regulator-max-microvolt = <1800000>;
349	};
350
351	l7 {
352		regulator-min-microvolt = <1800000>;
353		regulator-max-microvolt = <1800000>;
354	};
355
356	l8 {
357		regulator-min-microvolt = <2850000>;
358		regulator-max-microvolt = <2900000>;
359	};
360
361	l9 {
362		regulator-min-microvolt = <3300000>;
363		regulator-max-microvolt = <3300000>;
364	};
365
366	l10 {
367		regulator-min-microvolt = <2700000>;
368		regulator-max-microvolt = <2800000>;
369	};
370
371	l11 {
372		regulator-min-microvolt = <1800000>;
373		regulator-max-microvolt = <2950000>;
374		regulator-allow-set-load;
375		regulator-system-load = <200000>;
376	};
377
378	l12 {
379		regulator-min-microvolt = <1800000>;
380		regulator-max-microvolt = <2950000>;
381	};
382
383	l13 {
384		regulator-min-microvolt = <3075000>;
385		regulator-max-microvolt = <3075000>;
386	};
387
388	l14 {
389		regulator-min-microvolt = <1800000>;
390		regulator-max-microvolt = <3300000>;
391	};
392
393	l15 {
394		regulator-min-microvolt = <1800000>;
395		regulator-max-microvolt = <3300000>;
396	};
397
398	l16 {
399		regulator-min-microvolt = <1800000>;
400		regulator-max-microvolt = <3300000>;
401	};
402
403	l17 {
404		regulator-min-microvolt = <2850000>;
405		regulator-max-microvolt = <2850000>;
406	};
407
408	l18 {
409		regulator-min-microvolt = <2700000>;
410		regulator-max-microvolt = <2700000>;
411	};
412};
413
414&msmgpio {
415	fg_alert_default: fg-alert-default {
416		pins = "gpio121";
417		function = "gpio";
418
419		drive-strength = <2>;
420		bias-disable;
421	};
422
423	gpio_keys_default: gpio-keys-default {
424		pins = "gpio107", "gpio109";
425		function = "gpio";
426
427		drive-strength = <2>;
428		bias-pull-up;
429	};
430
431	gpio_hall_sensor_default: gpio-hall-sensor-default {
432		pins = "gpio52";
433		function = "gpio";
434
435		drive-strength = <2>;
436		bias-disable;
437	};
438
439	imu_irq_default: imu-irq-default {
440		pins = "gpio115";
441		function = "gpio";
442
443		drive-strength = <2>;
444		bias-disable;
445	};
446
447	muic_i2c_default: muic-i2c-default {
448		pins = "gpio105", "gpio106";
449		function = "gpio";
450
451		drive-strength = <2>;
452		bias-disable;
453	};
454
455	muic_irq_default: muic-irq-default {
456		pins = "gpio12";
457		function = "gpio";
458
459		drive-strength = <2>;
460		bias-disable;
461	};
462
463	nfc_default: nfc-default {
464		pins = "gpio20", "gpio49";
465		function = "gpio";
466
467		drive-strength = <2>;
468		bias-disable;
469
470		irq {
471			pins = "gpio21";
472			function = "gpio";
473
474			drive-strength = <2>;
475			bias-pull-down;
476		};
477	};
478
479	nfc_i2c_default: nfc-i2c-default {
480		pins = "gpio0", "gpio1";
481		function = "gpio";
482
483		drive-strength = <2>;
484		bias-disable;
485	};
486
487	tkey_default: tkey-default {
488		pins = "gpio98";
489		function = "gpio";
490
491		drive-strength = <2>;
492		bias-disable;
493	};
494
495	tkey_en_default: tkey-en-default {
496		pins = "gpio86";
497		function = "gpio";
498
499		drive-strength = <2>;
500		bias-disable;
501	};
502
503	tkey_i2c_default: tkey-i2c-default {
504		pins = "gpio16", "gpio17";
505		function = "gpio";
506
507		drive-strength = <2>;
508		bias-disable;
509	};
510
511	tkey_led_en_default: tkey-led-en-default {
512		pins = "gpio60";
513		function = "gpio";
514
515		drive-strength = <2>;
516		bias-disable;
517	};
518
519	tsp_en_default: tsp-en-default {
520		pins = "gpio73";
521		function = "gpio";
522
523		drive-strength = <2>;
524		bias-disable;
525	};
526
527	tsp_irq_default: tsp-irq-default {
528		pins = "gpio13";
529		function = "gpio";
530
531		drive-strength = <2>;
532		bias-disable;
533	};
534};
535