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