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