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