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