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