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&venus {
363	status = "okay";
364};
365
366&venus_mem {
367	status = "okay";
368};
369
370&wcnss {
371	status = "okay";
372};
373
374&wcnss_iris {
375	compatible = "qcom,wcn3660b";
376};
377
378&wcnss_mem {
379	status = "okay";
380};
381
382&tlmm {
383	fg_alert_default: fg-alert-default-state {
384		pins = "gpio121";
385		function = "gpio";
386
387		drive-strength = <2>;
388		bias-disable;
389	};
390
391	gpio_keys_default: gpio-keys-default-state {
392		pins = "gpio107", "gpio109";
393		function = "gpio";
394
395		drive-strength = <2>;
396		bias-pull-up;
397	};
398
399	gpio_hall_sensor_default: gpio-hall-sensor-default-state {
400		pins = "gpio52";
401		function = "gpio";
402
403		drive-strength = <2>;
404		bias-disable;
405	};
406
407	imu_irq_default: imu-irq-default-state {
408		pins = "gpio115";
409		function = "gpio";
410
411		drive-strength = <2>;
412		bias-disable;
413	};
414
415	muic_i2c_default: muic-i2c-default-state {
416		pins = "gpio105", "gpio106";
417		function = "gpio";
418
419		drive-strength = <2>;
420		bias-disable;
421	};
422
423	muic_irq_default: muic-irq-default-state {
424		pins = "gpio12";
425		function = "gpio";
426
427		drive-strength = <2>;
428		bias-disable;
429	};
430
431	nfc_default: nfc-default-state {
432		nfc-pins {
433			pins = "gpio20", "gpio49";
434			function = "gpio";
435
436			drive-strength = <2>;
437			bias-disable;
438		};
439		irq-pins {
440			pins = "gpio21";
441			function = "gpio";
442
443			drive-strength = <2>;
444			bias-pull-down;
445		};
446	};
447
448	nfc_i2c_default: nfc-i2c-default-state {
449		pins = "gpio0", "gpio1";
450		function = "gpio";
451
452		drive-strength = <2>;
453		bias-disable;
454	};
455
456	pmic_int_default: pmic-int-default-state {
457		pins = "gpio62";
458		function = "gpio";
459
460		drive-strength = <2>;
461		bias-disable;
462	};
463
464	tkey_default: tkey-default-state {
465		pins = "gpio98";
466		function = "gpio";
467
468		drive-strength = <2>;
469		bias-disable;
470	};
471
472	tkey_en_default: tkey-en-default-state {
473		pins = "gpio86";
474		function = "gpio";
475
476		drive-strength = <2>;
477		bias-disable;
478	};
479
480	tkey_i2c_default: tkey-i2c-default-state {
481		pins = "gpio16", "gpio17";
482		function = "gpio";
483
484		drive-strength = <2>;
485		bias-disable;
486	};
487
488	tkey_led_en_default: tkey-led-en-default-state {
489		pins = "gpio60";
490		function = "gpio";
491
492		drive-strength = <2>;
493		bias-disable;
494	};
495
496	tsp_en_default: tsp-en-default-state {
497		pins = "gpio73";
498		function = "gpio";
499
500		drive-strength = <2>;
501		bias-disable;
502	};
503
504	tsp_irq_default: tsp-irq-default-state {
505		pins = "gpio13";
506		function = "gpio";
507
508		drive-strength = <2>;
509		bias-disable;
510	};
511};
512