1// SPDX-License-Identifier: GPL-2.0-only
2/dts-v1/;
3
4#include "ste-db8500.dtsi"
5#include "ste-ab8505.dtsi"
6#include "ste-dbx5x0-pinctrl.dtsi"
7#include <dt-bindings/gpio/gpio.h>
8#include <dt-bindings/leds/common.h>
9#include <dt-bindings/input/input.h>
10#include <dt-bindings/interrupt-controller/irq.h>
11
12/*
13 * Note: This device tree cannot be booted directly with the Samsung bootloader.
14 * You need an intermediate, device-tree compatible bootloader
15 * that locks the L2 cache. Otherwise the kernel will crash after decompression.
16 *
17 * There is a port of (mainline) U-Boot, see
18 * https://wiki.postmarketos.org/wiki/ST-Ericsson_NovaThor_U8500#U-Boot
19 */
20/ {
21	model = "Samsung Galaxy S III mini (GT-I8190)";
22	compatible = "samsung,golden", "st-ericsson,u8500";
23
24	chosen {
25		stdout-path = &serial2;
26	};
27
28	battery: battery {
29		compatible = "samsung,eb-l1m7flu";
30	};
31
32	thermal-zones {
33		battery-thermal {
34			/* This zone will be polled by the battery temperature code */
35			polling-delay = <0>;
36			polling-delay-passive = <0>;
37			thermal-sensors = <&bat_therm>;
38
39			trips {
40				battery-crit-hi {
41					temperature = <70000>;
42					hysteresis = <2000>;
43					type = "critical";
44				};
45			};
46		};
47	};
48
49	bat_therm: thermistor {
50		compatible = "samsung,1404-001221";
51		io-channels = <&gpadc 0x02>; /* BatTemp */
52		pullup-uv = <1800000>;
53		pullup-ohm = <230000>;
54		pulldown-ohm = <0>;
55		#thermal-sensor-cells = <0>;
56	};
57
58	i2c-gpio-0 {
59		compatible = "i2c-gpio";
60		sda-gpios = <&gpio2 14 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
61		scl-gpios = <&gpio2 13 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
62
63		pinctrl-names = "default";
64		pinctrl-0 = <&i2c_gpio_0_default>;
65
66		#address-cells = <1>;
67		#size-cells = <0>;
68
69		touchkey@20 {
70			compatible = "coreriver,tc360-touchkey";
71			reg = <0x20>;
72			vdd-supply = <&ab8500_ldo_aux4_reg>;
73			vcc-supply = <&ab8500_ldo_aux6_reg>;
74
75			interrupt-parent = <&gpio2>;
76			interrupts = <15 IRQ_TYPE_EDGE_FALLING>;
77
78			pinctrl-names = "default";
79			pinctrl-0 = <&touchkey_default>;
80			linux,keycodes = <KEY_MENU KEY_BACK>;
81		};
82	};
83
84	i2c-gpio-1 {
85		compatible = "i2c-gpio";
86		sda-gpios = <&gpio4 24 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
87		scl-gpios = <&gpio4 23 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
88
89		pinctrl-names = "default";
90		pinctrl-0 = <&i2c_gpio_1_default>;
91
92		#address-cells = <1>;
93		#size-cells = <0>;
94
95		magnetometer@c {
96			compatible = "alps,hscdtd008a";
97			reg = <0x0c>;
98
99			avdd-supply = <&ab8500_ldo_aux1_reg>;
100			dvdd-supply = <&ab8500_ldo_aux8_reg>;
101		};
102	};
103
104	soc {
105		/* External Micro SD card slot */
106		mmc@80126000 {
107			status = "okay";
108
109			arm,primecell-periphid = <0x10480180>;
110			max-frequency = <100000000>;
111			bus-width = <4>;
112
113			non-removable;
114			/*
115			 * Unfortunately, there is no way to enable the UHS
116			 * modes due to a limitation of the SD level translator:
117			 * It will either translate to 2.9V or disconnect the
118			 * DATA lines, so switching to 1.8V signal voltage fails.
119			 */
120			cap-sd-highspeed;
121			cap-mmc-highspeed;
122			st,sig-pin-fbclk;
123			full-pwr-cycle;
124
125			vmmc-supply = <&ab8500_ldo_aux3_reg>;
126			vqmmc-supply = <&sd_level_translator>;
127
128			pinctrl-names = "default", "sleep";
129			pinctrl-0 = <&mc0_a_2_default>;
130			pinctrl-1 = <&mc0_a_2_sleep>;
131		};
132
133		/* WLAN SDIO */
134		mmc@80118000 {
135			status = "okay";
136
137			arm,primecell-periphid = <0x10480180>;
138			max-frequency = <50000000>;
139			bus-width = <4>;
140
141			non-removable;
142			cap-sd-highspeed;
143
144			vmmc-supply = <&wl_reg_on>;
145
146			pinctrl-names = "default", "sleep";
147			pinctrl-0 = <&mc1_a_2_default>;
148			pinctrl-1 = <&mc1_a_2_sleep>;
149
150			#address-cells = <1>;
151			#size-cells = <0>;
152
153			wifi@1 {
154				compatible = "brcm,bcm4334-fmac", "brcm,bcm4329-fmac";
155				reg = <1>;
156
157				/* GPIO216 (WLAN_HOST_WAKE) */
158				interrupt-parent = <&gpio6>;
159				interrupts = <24 IRQ_TYPE_EDGE_FALLING>;
160				interrupt-names = "host-wake";
161
162				pinctrl-names = "default";
163				pinctrl-0 = <&wlan_default>;
164			};
165		};
166
167		/* eMMC */
168		mmc@80005000 {
169			status = "okay";
170
171			arm,primecell-periphid = <0x10480180>;
172			max-frequency = <100000000>;
173			bus-width = <8>;
174
175			non-removable;
176			cap-mmc-highspeed;
177			mmc-ddr-1_8v;
178			no-sdio;
179			no-sd;
180
181			vmmc-supply = <&vmem_3v3>;
182
183			pinctrl-names = "default", "sleep";
184			pinctrl-0 = <&mc2_a_1_default>;
185			pinctrl-1 = <&mc2_a_1_sleep>;
186		};
187
188		/* BT UART */
189		serial@80120000 {
190			status = "okay";
191
192			pinctrl-names = "default", "sleep";
193			pinctrl-0 = <&u0_a_1_default>;
194			pinctrl-1 = <&u0_a_1_sleep>;
195
196			bluetooth {
197				/* BCM4334B0 actually */
198				compatible = "brcm,bcm4330-bt";
199				/* GPIO222 (BT_VREG_ON) */
200				shutdown-gpios = <&gpio6 30 GPIO_ACTIVE_HIGH>;
201				/* GPIO199 (BT_WAKE) */
202				device-wakeup-gpios = <&gpio6 7 GPIO_ACTIVE_HIGH>;
203				/* GPIO97 (BT_HOST_WAKE) */
204				host-wakeup-gpios = <&gpio3 1 GPIO_ACTIVE_HIGH>;
205
206				pinctrl-names = "default";
207				pinctrl-0 = <&bluetooth_default>;
208			};
209		};
210
211		/* GPF UART */
212		serial@80121000 {
213			status = "okay";
214
215			pinctrl-names = "default", "sleep";
216			pinctrl-0 = <&u1rxtx_a_1_default &u1ctsrts_a_1_default>;
217			pinctrl-1 = <&u1rxtx_a_1_sleep &u1ctsrts_a_1_sleep>;
218		};
219
220		/* Debugging console UART */
221		serial@80007000 {
222			status = "okay";
223
224			pinctrl-names = "default", "sleep";
225			pinctrl-0 = <&u2rxtx_c_1_default>;
226			pinctrl-1 = <&u2rxtx_c_1_sleep>;
227		};
228
229		i2c@80004000 {
230			status = "okay";
231
232			pinctrl-names = "default", "sleep";
233			pinctrl-0 = <&i2c0_a_1_default>;
234			pinctrl-1 = <&i2c0_a_1_sleep>;
235
236			proximity@44 {
237				compatible = "sharp,gp2ap002s00f";
238				reg = <0x44>;
239
240				/* GPIO146 (PS_INT) */
241				interrupt-parent = <&gpio4>;
242				interrupts = <18 IRQ_TYPE_EDGE_FALLING>;
243
244				vdd-supply = <&ab8500_ldo_aux1_reg>;
245				vio-supply = <&ab8500_ldo_aux8_reg>;
246
247				pinctrl-names = "default";
248				pinctrl-0 = <&proximity_default>;
249
250				sharp,proximity-far-hysteresis = <0x40>;
251				sharp,proximity-close-hysteresis = <0x0f>;
252			};
253		};
254
255		i2c@80128000 {
256			status = "okay";
257
258			pinctrl-names = "default", "sleep";
259			pinctrl-0 = <&i2c2_b_2_default>;
260			pinctrl-1 = <&i2c2_b_2_sleep>;
261
262			imu@68 {
263				compatible = "invensense,mpu6050";
264				reg = <0x68>;
265
266				/* GPIO206 (ACC_INT) */
267				interrupt-parent = <&gpio6>;
268				interrupts = <14 IRQ_TYPE_EDGE_RISING>;
269
270				mount-matrix = "0", "1", "0",
271					      "-1", "0", "0",
272					       "0", "0", "1";
273
274				vdd-supply = <&ab8500_ldo_aux1_reg>;
275				vddio-supply = <&ab8500_ldo_aux8_reg>;
276
277				pinctrl-names = "default";
278				pinctrl-0 = <&imu_default>;
279			};
280		};
281
282		i2c@80110000 {
283			status = "okay";
284
285			pinctrl-names = "default", "sleep";
286			pinctrl-0 = <&i2c3_c_2_default>;
287			pinctrl-1 = <&i2c3_c_2_sleep>;
288
289			touchscreen@4a {
290				compatible = "atmel,maxtouch";
291				reg = <0x4a>;
292
293				/* GPIO218 (TSP_INT_1V8) */
294				interrupt-parent = <&gpio6>;
295				interrupts = <26 IRQ_TYPE_EDGE_FALLING>;
296
297				/* VDDA is "analog supply", 2.57-3.47 V */
298				vdda-supply = <&ab8500_ldo_aux2_reg>;
299				/* VDD is "digital supply" 1.71-3.47V */
300				vdd-supply = <&ab8500_ldo_aux5_reg>;
301
302				pinctrl-names = "default";
303				pinctrl-0 = <&tsp_default>;
304			};
305		};
306
307		prcmu@80157000 {
308			ab8505 {
309				phy {
310					pinctrl-names = "default", "sleep";
311					pinctrl-0 = <&usb_a_1_default>;
312					pinctrl-1 = <&usb_a_1_sleep>;
313				};
314
315				ab8500_fg {
316					line-impedance-micro-ohms = <36000>;
317				};
318
319				regulator {
320					ab8500_ldo_aux1 {
321						regulator-name = "sensor_3v";
322						regulator-min-microvolt = <3000000>;
323						regulator-max-microvolt = <3000000>;
324					};
325
326					ab8500_ldo_aux2 {
327						regulator-name = "vreg_tsp_a3v3";
328						regulator-min-microvolt = <3300000>;
329						regulator-max-microvolt = <3300000>;
330					};
331
332					ab8500_ldo_aux3 {
333						regulator-name = "vdd_tf_2v91";
334					};
335
336					ab8500_ldo_aux4 {
337						regulator-name = "key_led_3.3v";
338						regulator-min-microvolt = <3300000>;
339						regulator-max-microvolt = <3300000>;
340					};
341
342					ab8500_ldo_aux5 {
343						regulator-name = "vreg_tsp_1v8";
344						regulator-min-microvolt = <1800000>;
345						regulator-max-microvolt = <1800000>;
346					};
347
348					ab8500_ldo_aux6 {
349						regulator-name = "touch_key_2.2v";
350						regulator-min-microvolt = <2200000>;
351						regulator-max-microvolt = <2200000>;
352					};
353
354					ab8500_ldo_aux8 {
355						regulator-name = "sensor_1v8";
356					};
357				};
358			};
359		};
360
361		mcde@a0350000 {
362			status = "okay";
363			pinctrl-names = "default";
364			pinctrl-0 = <&dsi_default_mode>;
365
366			dsi@a0351000 {
367				panel@0 {
368					compatible = "samsung,s6e63m0";
369					reg = <0>;
370					max-brightness = <15>;
371					vdd3-supply = <&panel_reg_3v0>;
372					vci-supply = <&panel_reg_1v8>;
373					reset-gpios = <&gpio4 11 GPIO_ACTIVE_LOW>;
374					/* ESD (electrostatic discharge) detection interrupt */
375					interrupt-parent = <&gpio2>;
376					interrupts = <18 IRQ_TYPE_EDGE_RISING>;
377					interrupt-names = "esd";
378					pinctrl-names = "default";
379					pinctrl-0 = <&display_default_mode>;
380				};
381			};
382		};
383	};
384
385	gpio-keys {
386		compatible = "gpio-keys";
387
388		pinctrl-names = "default";
389		pinctrl-0 = <&gpio_keys_default>;
390
391		label = "GPIO Buttons";
392
393		volume-up {
394			label = "Volume Up";
395			/* GPIO67 (VOL_UP) */
396			gpios = <&gpio2 3 GPIO_ACTIVE_LOW>;
397			linux,code = <KEY_VOLUMEUP>;
398		};
399
400		volume-down {
401			label = "Volume Down";
402			/* GPIO92 (VOL_DOWN) */
403			gpios = <&gpio2 28 GPIO_ACTIVE_LOW>;
404			linux,code = <KEY_VOLUMEDOWN>;
405		};
406
407		home {
408			label = "Home";
409			/* GPIO91 (HOME_KEY) */
410			gpios = <&gpio2 27 GPIO_ACTIVE_LOW>;
411			linux,code = <KEY_HOMEPAGE>;
412		};
413	};
414
415	/* Richtek RT8515GQW Flash LED Driver IC */
416	flash {
417		compatible = "richtek,rt8515";
418		/* GPIO 140 */
419		enf-gpios = <&gpio4 12 GPIO_ACTIVE_HIGH>;
420		/* GPIO 141 */
421		ent-gpios = <&gpio4 13 GPIO_ACTIVE_HIGH>;
422		/*
423		 * RFS is 16 kOhm and RTS is 100 kOhm giving
424		 * the flash max current 343mA and torch max
425		 * current 55 mA.
426		 */
427		richtek,rfs-ohms = <16000>;
428		richtek,rts-ohms = <100000>;
429		pinctrl-names = "default";
430		pinctrl-0 = <&gpio_flash_default_mode>;
431
432		led {
433			function = LED_FUNCTION_FLASH;
434			color = <LED_COLOR_ID_WHITE>;
435			flash-max-timeout-us = <250000>;
436			flash-max-microamp = <343750>;
437			led-max-microamp = <55000>;
438		};
439	};
440
441	vibrator {
442		compatible = "gpio-vibrator";
443		/* GPIO195 (MOT_EN) */
444		enable-gpios = <&gpio6 3 GPIO_ACTIVE_HIGH>;
445
446		pinctrl-names = "default";
447		pinctrl-0 = <&vibrator_default>;
448	};
449
450	/* External LDO for eMMC */
451	vmem_3v3: regulator-vmem {
452		compatible = "regulator-fixed";
453
454		regulator-name = "vmem_3v3";
455		regulator-min-microvolt = <3300000>;
456		regulator-max-microvolt = <3300000>;
457		regulator-boot-on;
458
459		startup-delay-us = <200>;
460
461		/* GPIO223 (MEM_LDO_EN) */
462		gpio = <&gpio6 31 GPIO_ACTIVE_HIGH>;
463		enable-active-high;
464
465		pinctrl-names = "default";
466		pinctrl-0 = <&mem_ldo_default>;
467	};
468
469	/* TI TXS0206-29 level translator for 2.9 V */
470	sd_level_translator: regulator-sd-level-translator {
471		compatible = "regulator-fixed";
472
473		regulator-name = "sd-level-translator";
474		regulator-min-microvolt = <2900000>;
475		regulator-max-microvolt = <2900000>;
476
477		startup-delay-us = <200>;
478
479		/* GPIO87 (TXS0206-29_EN) */
480		gpios = <&gpio2 23 GPIO_ACTIVE_HIGH>;
481		enable-active-high;
482
483		pinctrl-names = "default";
484		pinctrl-0 = <&sd_level_translator_default>;
485	};
486
487	/*
488	 * WL_REG_ON takes WLAN out of reset and enables the internal regulators.
489	 * The voltage specified here is only used to determine the OCR mask,
490	 * the BCM chip is actually connected directly to VBAT.
491	 */
492	wl_reg_on: regulator-wl-reg-on {
493		compatible = "regulator-fixed";
494
495		regulator-name = "wl-reg-on";
496		regulator-min-microvolt = <3000000>;
497		regulator-max-microvolt = <3000000>;
498
499		startup-delay-us = <100000>;
500
501		/* GPIO215 (WLAN_EN) */
502		gpio = <&gpio6 23 GPIO_ACTIVE_HIGH>;
503		enable-active-high;
504
505		pinctrl-names = "default";
506		pinctrl-0 = <&wlan_en_default>;
507	};
508
509	/* MIC5366 GPIO-controlled regulator */
510	panel_reg_1v8: regulator-panel-1v8 {
511		compatible = "regulator-fixed";
512
513		regulator-name = "panel-fixed-supply";
514		regulator-min-microvolt = <1800000>;
515		regulator-max-microvolt = <1800000>;
516		/* GPIO219 */
517		gpio = <&gpio6 27 GPIO_ACTIVE_HIGH>;
518
519		startup-delay-us = <200>;
520		enable-active-high;
521
522		pinctrl-names = "default";
523		pinctrl-0 = <&panel_reg_default_mode>;
524	};
525
526	/* MIC5366 GPIO-controlled regulator */
527	panel_reg_3v0: regulator-panel-3v0 {
528		compatible = "regulator-fixed";
529
530		regulator-name = "panel-fixed-supply";
531		regulator-min-microvolt = <3000000>;
532		regulator-max-microvolt = <3000000>;
533		/* GPIO219 */
534		gpio = <&gpio6 27 GPIO_ACTIVE_HIGH>;
535
536		startup-delay-us = <200>;
537		enable-active-high;
538
539		pinctrl-names = "default";
540		pinctrl-0 = <&panel_reg_default_mode>;
541	};
542};
543
544&pinctrl {
545	gpio-keys {
546		gpio_keys_default: gpio_keys_default {
547			golden_cfg1 {
548				pins = "GPIO67",	/* VOL_UP */
549				       "GPIO91",	/* HOME_KEY */
550				       "GPIO92";	/* VOL_DOWN */
551				ste,config = <&gpio_in_pu>;
552			};
553		};
554	};
555
556	i2c-gpio-0 {
557		i2c_gpio_0_default: i2c_gpio_0 {
558			golden_cfg1 {
559				pins = "GPIO77",	/* TOUCHKEY_SCL */
560				       "GPIO78";	/* TOUCHKEY_SDA */
561				ste,config = <&gpio_in_nopull>;
562			};
563		};
564	};
565
566	flash {
567		gpio_flash_default_mode: flash_default {
568			golden_cfg1 {
569				pins = "GPIO140_B11", "GPIO141_C12";
570				ste,config = <&gpio_out_lo>;
571			};
572		};
573	};
574
575	i2c-gpio-1 {
576		i2c_gpio_1_default: i2c_gpio_1 {
577			golden_cfg1 {
578				pins = "GPIO151",	/* COMP_SCL */
579				       "GPIO152";	/* COMP_SDA */
580				ste,config = <&gpio_in_nopull>;
581			};
582		};
583	};
584
585	touchkey {
586		touchkey_default: touchkey_default {
587			golden_cfg1 {
588				pins = "GPIO79";	/* TOUCHKEY_INT */
589				ste,config = <&gpio_in_nopull>;
590			};
591		};
592	};
593
594	sdi0 {
595		sd_level_translator_default: sd_level_translator_default {
596			golden_cfg1 {
597				pins = "GPIO87_B3";	/* TXS0206-29_EN */
598				ste,config = <&gpio_out_lo>;
599			};
600		};
601	};
602
603	sdi2 {
604		mem_ldo_default: mem_ldo_default {
605			golden_cfg1 {
606				pins = "GPIO223_AH9";	/* MEM_LDO_EN */
607				ste,config = <&gpio_out_hi>;
608			};
609		};
610	};
611
612	mcde {
613		dsi_default_mode: dsi_default {
614			default_mux1 {
615				/* Mux in VSI0 used for DSI TE */
616				function = "lcd";
617				groups =
618				"lcdvsi0_a_1"; /* VSI0 for LCD */
619			};
620			default_cfg1 {
621				pins =
622				"GPIO68_E1"; /* VSI0 */
623				ste,config = <&in_nopull>;
624			};
625		};
626	};
627
628	display {
629		display_default_mode: display_default {
630			golden_cfg1 {
631				pins = "GPIO139_C9"; /* MIPI_DSI0_RESET_N */
632				ste,config = <&gpio_out_lo>;
633			};
634			golden_cfg2 {
635				pins = "GPIO82_C1"; /* LDI_ESD_DET */
636				ste,config = <&gpio_in_pu>;
637			};
638		};
639		panel_reg_default_mode: panel_reg_default {
640			golden_cfg1 {
641				pins = "GPIO219_AG10"; /* LCD_PWR_EN */
642				ste,config = <&gpio_out_lo>;
643			};
644		};
645	};
646
647	proximity {
648		proximity_default: proximity_default {
649			golden_cfg1 {
650				pins = "GPIO146_D13";	/* PS_INT */
651				ste,config = <&gpio_in_nopull>;
652			};
653		};
654	};
655
656	imu {
657		imu_default: imu_default {
658			golden_cfg1 {
659				pins = "GPIO206_AG24";	/* ACC_INT */
660				ste,config = <&gpio_in_pd>;
661			};
662		};
663	};
664
665	tsp {
666		tsp_default: tsp_default {
667			golden_cfg1 {
668				pins = "GPIO218_AH11";	/* TSP_INT_1V8 */
669				ste,config = <&gpio_in_nopull>;
670			};
671		};
672	};
673
674	wlan {
675		wlan_default: wlan_default {
676			golden_cfg1 {
677				pins = "GPIO216_AG12";	/* WLAN_HOST_WAKE */
678				ste,config = <&gpio_in_pd>;
679			};
680		};
681
682		wlan_en_default: wlan_en_default {
683			golden_cfg1 {
684				pins = "GPIO215_AH13";	/* WLAN_EN */
685				ste,config = <&gpio_out_lo>;
686			};
687		};
688	};
689
690	bluetooth {
691		bluetooth_default: bluetooth_default {
692			golden_cfg1 {
693				pins = "GPIO199_AH23",	/* BT_WAKE */
694				       "GPIO222_AJ9";	/* BT_VREG_ON */
695				ste,config = <&gpio_out_lo>;
696			};
697			golden_cfg2 {
698				pins = "GPIO97_D9";	/* BT_HOST_WAKE */
699				ste,config = <&gpio_in_nopull>;
700			};
701		};
702	};
703
704	vibrator {
705		vibrator_default: vibrator_default {
706			golden_cfg1 {
707				pins = "GPIO195_AG28";	/* MOT_EN */
708				ste,config = <&gpio_out_lo>;
709			};
710		};
711	};
712};
713
714&ab8505_gpio {
715	/* Hog a few default settings */
716	pinctrl-names = "default";
717	pinctrl-0 = <&gpio_default>;
718
719	gpio {
720		gpio_default: gpio_default {
721			golden_mux {
722				/* Change unused pins to GPIO mode */
723				function = "gpio";
724				groups = "gpio3_a_1",	/* default: SysClkReq4 */
725					 "gpio14_a_1";	/* default: PWMOut1 */
726			};
727			golden_cfg1 {
728				pins = "GPIO11_B17", "GPIO13_D17", "GPIO50_L4";
729				bias-disable;
730			};
731		};
732	};
733};
734