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		mmc0 = &sdhc_1; /* eMMC */
32		mmc1 = &sdhc_2; /* SD card */
33		serial0 = &blsp_uart2;
34	};
35
36	chosen {
37		stdout-path = "serial0";
38	};
39
40	reserved-memory {
41		/* Additional memory used by Samsung firmware modifications */
42		tz-apps@85500000 {
43			reg = <0x0 0x85500000 0x0 0xb00000>;
44			no-map;
45		};
46	};
47
48	gpio-keys {
49		compatible = "gpio-keys";
50
51		pinctrl-names = "default";
52		pinctrl-0 = <&gpio_keys_default>;
53
54		label = "GPIO Buttons";
55
56		button-volume-up {
57			label = "Volume Up";
58			gpios = <&tlmm 107 GPIO_ACTIVE_LOW>;
59			linux,code = <KEY_VOLUMEUP>;
60		};
61
62		button-home {
63			label = "Home";
64			gpios = <&tlmm 109 GPIO_ACTIVE_LOW>;
65			linux,code = <KEY_HOMEPAGE>;
66		};
67	};
68
69	gpio-hall-sensor {
70		compatible = "gpio-keys";
71
72		pinctrl-names = "default";
73		pinctrl-0 = <&gpio_hall_sensor_default>;
74
75		label = "GPIO Hall Effect Sensor";
76
77		event-hall-sensor {
78			label = "Hall Effect Sensor";
79			gpios = <&tlmm 52 GPIO_ACTIVE_LOW>;
80			linux,input-type = <EV_SW>;
81			linux,code = <SW_LID>;
82			linux,can-disable;
83		};
84	};
85
86	reg_vdd_tsp: regulator-vdd-tsp {
87		compatible = "regulator-fixed";
88		regulator-name = "vdd_tsp";
89		regulator-min-microvolt = <3300000>;
90		regulator-max-microvolt = <3300000>;
91
92		gpio = <&tlmm 73 GPIO_ACTIVE_HIGH>;
93		enable-active-high;
94
95		pinctrl-names = "default";
96		pinctrl-0 = <&tsp_en_default>;
97	};
98
99	reg_touch_key: regulator-touch-key {
100		compatible = "regulator-fixed";
101		regulator-name = "touch_key";
102		regulator-min-microvolt = <2800000>;
103		regulator-max-microvolt = <2800000>;
104
105		gpio = <&tlmm 86 GPIO_ACTIVE_HIGH>;
106		enable-active-high;
107
108		pinctrl-names = "default";
109		pinctrl-0 = <&tkey_en_default>;
110	};
111
112	reg_key_led: regulator-key-led {
113		compatible = "regulator-fixed";
114		regulator-name = "key_led";
115		regulator-min-microvolt = <3300000>;
116		regulator-max-microvolt = <3300000>;
117
118		gpio = <&tlmm 60 GPIO_ACTIVE_HIGH>;
119		enable-active-high;
120
121		pinctrl-names = "default";
122		pinctrl-0 = <&tkey_led_en_default>;
123	};
124
125	i2c-muic {
126		compatible = "i2c-gpio";
127		sda-gpios = <&tlmm 105 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
128		scl-gpios = <&tlmm 106 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
129
130		pinctrl-names = "default";
131		pinctrl-0 = <&muic_i2c_default>;
132
133		#address-cells = <1>;
134		#size-cells = <0>;
135
136		muic: extcon@14 {
137			compatible = "siliconmitus,sm5504-muic";
138			reg = <0x14>;
139
140			interrupt-parent = <&tlmm>;
141			interrupts = <12 IRQ_TYPE_EDGE_FALLING>;
142
143			pinctrl-names = "default";
144			pinctrl-0 = <&muic_irq_default>;
145		};
146	};
147
148	i2c-tkey {
149		compatible = "i2c-gpio";
150		sda-gpios = <&tlmm 16 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
151		scl-gpios = <&tlmm 17 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
152
153		pinctrl-names = "default";
154		pinctrl-0 = <&tkey_i2c_default>;
155
156		#address-cells = <1>;
157		#size-cells = <0>;
158
159		touchkey@20 {
160			compatible = "coreriver,tc360-touchkey";
161			reg = <0x20>;
162
163			interrupt-parent = <&tlmm>;
164			interrupts = <98 IRQ_TYPE_EDGE_FALLING>;
165
166			vcc-supply = <&reg_touch_key>;
167			vdd-supply = <&reg_key_led>;
168			vddio-supply = <&pm8916_l6>;
169
170			linux,keycodes = <KEY_APPSELECT KEY_BACK>;
171
172			pinctrl-names = "default";
173			pinctrl-0 = <&tkey_default>;
174		};
175	};
176
177	i2c-nfc {
178		compatible = "i2c-gpio";
179		sda-gpios = <&tlmm 0 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
180		scl-gpios = <&tlmm 1 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
181
182		pinctrl-names = "default";
183		pinctrl-0 = <&nfc_i2c_default>;
184
185		#address-cells = <1>;
186		#size-cells = <0>;
187
188		nfc@2b {
189			compatible = "nxp,pn547", "nxp,nxp-nci-i2c";
190			reg = <0x2b>;
191
192			interrupt-parent = <&tlmm>;
193			interrupts = <21 IRQ_TYPE_EDGE_RISING>;
194
195			enable-gpios = <&tlmm 20 GPIO_ACTIVE_HIGH>;
196			firmware-gpios = <&tlmm 49 GPIO_ACTIVE_HIGH>;
197
198			pinctrl-names = "default";
199			pinctrl-0 = <&nfc_default>;
200		};
201	};
202};
203
204&blsp_i2c2 {
205	status = "okay";
206
207	imu@6b {
208		compatible = "st,lsm6ds3";
209		reg = <0x6b>;
210
211		interrupt-parent = <&tlmm>;
212		interrupts = <115 IRQ_TYPE_EDGE_RISING>;
213
214		pinctrl-names = "default";
215		pinctrl-0 = <&imu_irq_default>;
216	};
217
218	magnetometer@2e {
219		compatible = "yamaha,yas537";
220		reg = <0x2e>;
221
222		mount-matrix =  "0",  "1",  "0",
223				"1",  "0",  "0",
224				"0",  "0", "-1";
225	};
226};
227
228&blsp_i2c4 {
229	status = "okay";
230
231	battery@35 {
232		compatible = "richtek,rt5033-battery";
233		reg = <0x35>;
234
235		interrupt-parent = <&tlmm>;
236		interrupts = <121 IRQ_TYPE_EDGE_FALLING>;
237
238		pinctrl-names = "default";
239		pinctrl-0 = <&fg_alert_default>;
240	};
241};
242
243&blsp_i2c5 {
244	status = "okay";
245
246	touchscreen@20 {
247		compatible = "zinitix,bt541";
248		reg = <0x20>;
249
250		interrupt-parent = <&tlmm>;
251		interrupts = <13 IRQ_TYPE_EDGE_FALLING>;
252
253		touchscreen-size-x = <540>;
254		touchscreen-size-y = <960>;
255
256		vdd-supply = <&reg_vdd_tsp>;
257		vddo-supply = <&pm8916_l6>;
258
259		pinctrl-names = "default";
260		pinctrl-0 = <&tsp_irq_default>;
261	};
262};
263
264&blsp_uart2 {
265	status = "okay";
266};
267
268&pm8916_resin {
269	status = "okay";
270	linux,code = <KEY_VOLUMEDOWN>;
271};
272
273&pm8916_vib {
274	status = "okay";
275};
276
277&sdhc_1 {
278	status = "okay";
279};
280
281&sdhc_2 {
282	status = "okay";
283	non-removable;
284
285	/*
286	 * FIXME: Disable UHS-I modes since tuning fails with:
287	 *
288	 * sdhci_msm 7864900.sdhci: mmc1: No tuning point found
289	 * mmc1: tuning execution failed: -5
290	 * mmc1: error -5 whilst initialising SD card
291	 *
292	 * This is the quirk used on downstream, which suggests this is
293	 * a hardware limitation. However, probing a card using DDR50 works
294	 * (without tuning), so maybe only tuning is broken?
295	 */
296	no-1-8-v;
297};
298
299&usb {
300	status = "okay";
301	extcon = <&muic>, <&muic>;
302};
303
304&usb_hs_phy {
305	extcon = <&muic>;
306};
307
308&wcnss {
309	status = "okay";
310};
311
312&wcnss_iris {
313	compatible = "qcom,wcn3660b";
314};
315
316&tlmm {
317	fg_alert_default: fg-alert-default-state {
318		pins = "gpio121";
319		function = "gpio";
320
321		drive-strength = <2>;
322		bias-disable;
323	};
324
325	gpio_keys_default: gpio-keys-default-state {
326		pins = "gpio107", "gpio109";
327		function = "gpio";
328
329		drive-strength = <2>;
330		bias-pull-up;
331	};
332
333	gpio_hall_sensor_default: gpio-hall-sensor-default-state {
334		pins = "gpio52";
335		function = "gpio";
336
337		drive-strength = <2>;
338		bias-disable;
339	};
340
341	imu_irq_default: imu-irq-default-state {
342		pins = "gpio115";
343		function = "gpio";
344
345		drive-strength = <2>;
346		bias-disable;
347	};
348
349	muic_i2c_default: muic-i2c-default-state {
350		pins = "gpio105", "gpio106";
351		function = "gpio";
352
353		drive-strength = <2>;
354		bias-disable;
355	};
356
357	muic_irq_default: muic-irq-default-state {
358		pins = "gpio12";
359		function = "gpio";
360
361		drive-strength = <2>;
362		bias-disable;
363	};
364
365	nfc_default: nfc-default-state {
366		nfc-pins {
367			pins = "gpio20", "gpio49";
368			function = "gpio";
369
370			drive-strength = <2>;
371			bias-disable;
372		};
373		irq-pins {
374			pins = "gpio21";
375			function = "gpio";
376
377			drive-strength = <2>;
378			bias-pull-down;
379		};
380	};
381
382	nfc_i2c_default: nfc-i2c-default-state {
383		pins = "gpio0", "gpio1";
384		function = "gpio";
385
386		drive-strength = <2>;
387		bias-disable;
388	};
389
390	tkey_default: tkey-default-state {
391		pins = "gpio98";
392		function = "gpio";
393
394		drive-strength = <2>;
395		bias-disable;
396	};
397
398	tkey_en_default: tkey-en-default-state {
399		pins = "gpio86";
400		function = "gpio";
401
402		drive-strength = <2>;
403		bias-disable;
404	};
405
406	tkey_i2c_default: tkey-i2c-default-state {
407		pins = "gpio16", "gpio17";
408		function = "gpio";
409
410		drive-strength = <2>;
411		bias-disable;
412	};
413
414	tkey_led_en_default: tkey-led-en-default-state {
415		pins = "gpio60";
416		function = "gpio";
417
418		drive-strength = <2>;
419		bias-disable;
420	};
421
422	tsp_en_default: tsp-en-default-state {
423		pins = "gpio73";
424		function = "gpio";
425
426		drive-strength = <2>;
427		bias-disable;
428	};
429
430	tsp_irq_default: tsp-irq-default-state {
431		pins = "gpio13";
432		function = "gpio";
433
434		drive-strength = <2>;
435		bias-disable;
436	};
437};
438