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			usb_con: connector {
147				compatible = "usb-b-connector";
148				label = "micro-USB";
149				type = "micro";
150			};
151		};
152	};
153
154	i2c-tkey {
155		compatible = "i2c-gpio";
156		sda-gpios = <&tlmm 16 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
157		scl-gpios = <&tlmm 17 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
158
159		pinctrl-names = "default";
160		pinctrl-0 = <&tkey_i2c_default>;
161
162		#address-cells = <1>;
163		#size-cells = <0>;
164
165		touchkey@20 {
166			compatible = "coreriver,tc360-touchkey";
167			reg = <0x20>;
168
169			interrupt-parent = <&tlmm>;
170			interrupts = <98 IRQ_TYPE_EDGE_FALLING>;
171
172			vcc-supply = <&reg_touch_key>;
173			vdd-supply = <&reg_key_led>;
174			vddio-supply = <&pm8916_l6>;
175
176			linux,keycodes = <KEY_APPSELECT KEY_BACK>;
177
178			pinctrl-names = "default";
179			pinctrl-0 = <&tkey_default>;
180		};
181	};
182
183	i2c-nfc {
184		compatible = "i2c-gpio";
185		sda-gpios = <&tlmm 0 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
186		scl-gpios = <&tlmm 1 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
187
188		pinctrl-names = "default";
189		pinctrl-0 = <&nfc_i2c_default>;
190
191		#address-cells = <1>;
192		#size-cells = <0>;
193
194		nfc@2b {
195			compatible = "nxp,pn547", "nxp,nxp-nci-i2c";
196			reg = <0x2b>;
197
198			interrupt-parent = <&tlmm>;
199			interrupts = <21 IRQ_TYPE_EDGE_RISING>;
200
201			enable-gpios = <&tlmm 20 GPIO_ACTIVE_HIGH>;
202			firmware-gpios = <&tlmm 49 GPIO_ACTIVE_HIGH>;
203
204			pinctrl-names = "default";
205			pinctrl-0 = <&nfc_default>;
206		};
207	};
208
209	battery: battery {
210		compatible = "simple-battery";
211		precharge-current-microamp = <450000>;
212		constant-charge-current-max-microamp = <1000000>;
213		charge-term-current-microamp = <150000>;
214		precharge-upper-limit-microvolt = <3500000>;
215		constant-charge-voltage-max-microvolt = <4350000>;
216	};
217};
218
219&blsp_i2c2 {
220	status = "okay";
221
222	imu@6b {
223		compatible = "st,lsm6ds3";
224		reg = <0x6b>;
225
226		interrupt-parent = <&tlmm>;
227		interrupts = <115 IRQ_TYPE_EDGE_RISING>;
228
229		pinctrl-names = "default";
230		pinctrl-0 = <&imu_irq_default>;
231	};
232
233	magnetometer@2e {
234		compatible = "yamaha,yas537";
235		reg = <0x2e>;
236
237		mount-matrix = "0",  "1",  "0",
238			       "1",  "0",  "0",
239			       "0",  "0", "-1";
240	};
241};
242
243&blsp_i2c4 {
244	status = "okay";
245
246	fuel-gauge@35 {
247		compatible = "richtek,rt5033-battery";
248		reg = <0x35>;
249
250		interrupt-parent = <&tlmm>;
251		interrupts = <121 IRQ_TYPE_EDGE_FALLING>;
252
253		pinctrl-names = "default";
254		pinctrl-0 = <&fg_alert_default>;
255
256		power-supplies = <&rt5033_charger>;
257	};
258};
259
260&blsp_i2c5 {
261	status = "okay";
262
263	touchscreen@20 {
264		compatible = "zinitix,bt541";
265		reg = <0x20>;
266
267		interrupt-parent = <&tlmm>;
268		interrupts = <13 IRQ_TYPE_EDGE_FALLING>;
269
270		touchscreen-size-x = <540>;
271		touchscreen-size-y = <960>;
272
273		vdd-supply = <&reg_vdd_tsp>;
274		vddo-supply = <&pm8916_l6>;
275
276		pinctrl-names = "default";
277		pinctrl-0 = <&tsp_irq_default>;
278	};
279};
280
281&blsp_i2c6 {
282	status = "okay";
283
284	pmic@34 {
285		compatible = "richtek,rt5033";
286		reg = <0x34>;
287
288		interrupt-parent = <&tlmm>;
289		interrupts = <62 IRQ_TYPE_EDGE_FALLING>;
290
291		pinctrl-names = "default";
292		pinctrl-0 = <&pmic_int_default>;
293
294		regulators {
295			rt5033_reg_safe_ldo: SAFE_LDO {
296				regulator-min-microvolt = <4900000>;
297				regulator-max-microvolt = <4900000>;
298				regulator-always-on;
299			};
300			rt5033_reg_ldo: LDO {
301				regulator-min-microvolt = <2800000>;
302				regulator-max-microvolt = <2800000>;
303			};
304			rt5033_reg_buck: BUCK {
305				regulator-min-microvolt = <1200000>;
306				regulator-max-microvolt = <1200000>;
307			};
308		};
309
310		rt5033_charger: charger {
311			compatible = "richtek,rt5033-charger";
312			monitored-battery = <&battery>;
313			richtek,usb-connector = <&usb_con>;
314		};
315	};
316};
317
318&blsp_uart2 {
319	status = "okay";
320};
321
322&pm8916_resin {
323	status = "okay";
324	linux,code = <KEY_VOLUMEDOWN>;
325};
326
327&pm8916_vib {
328	status = "okay";
329};
330
331&sdhc_1 {
332	status = "okay";
333};
334
335&sdhc_2 {
336	status = "okay";
337	non-removable;
338
339	/*
340	 * FIXME: Disable UHS-I modes since tuning fails with:
341	 *
342	 * sdhci_msm 7864900.sdhci: mmc1: No tuning point found
343	 * mmc1: tuning execution failed: -5
344	 * mmc1: error -5 whilst initialising SD card
345	 *
346	 * This is the quirk used on downstream, which suggests this is
347	 * a hardware limitation. However, probing a card using DDR50 works
348	 * (without tuning), so maybe only tuning is broken?
349	 */
350	no-1-8-v;
351};
352
353&usb {
354	status = "okay";
355	extcon = <&muic>, <&muic>;
356};
357
358&usb_hs_phy {
359	extcon = <&muic>;
360};
361
362&wcnss {
363	status = "okay";
364};
365
366&wcnss_iris {
367	compatible = "qcom,wcn3660b";
368};
369
370&tlmm {
371	fg_alert_default: fg-alert-default-state {
372		pins = "gpio121";
373		function = "gpio";
374
375		drive-strength = <2>;
376		bias-disable;
377	};
378
379	gpio_keys_default: gpio-keys-default-state {
380		pins = "gpio107", "gpio109";
381		function = "gpio";
382
383		drive-strength = <2>;
384		bias-pull-up;
385	};
386
387	gpio_hall_sensor_default: gpio-hall-sensor-default-state {
388		pins = "gpio52";
389		function = "gpio";
390
391		drive-strength = <2>;
392		bias-disable;
393	};
394
395	imu_irq_default: imu-irq-default-state {
396		pins = "gpio115";
397		function = "gpio";
398
399		drive-strength = <2>;
400		bias-disable;
401	};
402
403	muic_i2c_default: muic-i2c-default-state {
404		pins = "gpio105", "gpio106";
405		function = "gpio";
406
407		drive-strength = <2>;
408		bias-disable;
409	};
410
411	muic_irq_default: muic-irq-default-state {
412		pins = "gpio12";
413		function = "gpio";
414
415		drive-strength = <2>;
416		bias-disable;
417	};
418
419	nfc_default: nfc-default-state {
420		nfc-pins {
421			pins = "gpio20", "gpio49";
422			function = "gpio";
423
424			drive-strength = <2>;
425			bias-disable;
426		};
427		irq-pins {
428			pins = "gpio21";
429			function = "gpio";
430
431			drive-strength = <2>;
432			bias-pull-down;
433		};
434	};
435
436	nfc_i2c_default: nfc-i2c-default-state {
437		pins = "gpio0", "gpio1";
438		function = "gpio";
439
440		drive-strength = <2>;
441		bias-disable;
442	};
443
444	pmic_int_default: pmic-int-default-state {
445		pins = "gpio62";
446		function = "gpio";
447
448		drive-strength = <2>;
449		bias-disable;
450	};
451
452	tkey_default: tkey-default-state {
453		pins = "gpio98";
454		function = "gpio";
455
456		drive-strength = <2>;
457		bias-disable;
458	};
459
460	tkey_en_default: tkey-en-default-state {
461		pins = "gpio86";
462		function = "gpio";
463
464		drive-strength = <2>;
465		bias-disable;
466	};
467
468	tkey_i2c_default: tkey-i2c-default-state {
469		pins = "gpio16", "gpio17";
470		function = "gpio";
471
472		drive-strength = <2>;
473		bias-disable;
474	};
475
476	tkey_led_en_default: tkey-led-en-default-state {
477		pins = "gpio60";
478		function = "gpio";
479
480		drive-strength = <2>;
481		bias-disable;
482	};
483
484	tsp_en_default: tsp-en-default-state {
485		pins = "gpio73";
486		function = "gpio";
487
488		drive-strength = <2>;
489		bias-disable;
490	};
491
492	tsp_irq_default: tsp-irq-default-state {
493		pins = "gpio13";
494		function = "gpio";
495
496		drive-strength = <2>;
497		bias-disable;
498	};
499};
500