xref: /freebsd/sys/contrib/device-tree/src/arm/st/ste-ux500-samsung-codina.dts (revision 5ca8e32633c4ffbbcd6762e5888b6a4ba0708c6c)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Devicetree for the Samsung Galaxy Ace 2 GT-I8160 also known as Codina.
4 *
5 * NOTE: this is the most common variant according to the vendor tree, known
6 * as "R0.0". There appears to be a "R0.4" variant with backlight on GPIO69,
7 * AB8505 and other changes. There is also talk about some variants having a
8 * Samsung S6D27A1 display, indicated by passing a different command line from
9 * the boot loader.
10 *
11 * The Samsung tree further talks about GT-I8160P and GT-I8160chn (China).
12 * The GT-I8160 plain is known as the "europe" variant.
13 * The GT-I8160P is the CDMA version and it appears to not use the ST
14 * Microelectronics accelerometer and reportedly has NFC mounted.
15 * The GT-I8160chn appears to be the same as the europe variant.
16 *
17 * There is also the Codina-TMO, Samsung SGH-T599, which has its own device
18 * tree.
19 */
20
21/dts-v1/;
22#include "ste-db8500.dtsi"
23#include "ste-ab8500.dtsi"
24#include "ste-dbx5x0-pinctrl.dtsi"
25#include <dt-bindings/gpio/gpio.h>
26#include <dt-bindings/leds/common.h>
27#include <dt-bindings/input/input.h>
28#include <dt-bindings/interrupt-controller/irq.h>
29
30/ {
31	model = "Samsung Galaxy Ace 2 (GT-I8160)";
32	compatible = "samsung,codina", "st-ericsson,u8500";
33
34	cpus {
35		cpu@300 {
36			/*
37			 * This has a frequency cap at ~800 MHz in the firmware.
38			 * (Changing this number here will not overclock it.)
39			 */
40			operating-points = <798720 0
41					    399360 0
42					    199680 0>;
43		};
44	};
45
46	chosen {
47		stdout-path = &serial2;
48	};
49
50	battery: battery {
51		compatible = "samsung,eb425161lu";
52	};
53
54	thermal-zones {
55		battery-thermal {
56			/* This zone will be polled by the battery temperature code */
57			polling-delay = <0>;
58			polling-delay-passive = <0>;
59			thermal-sensors = <&bat_therm>;
60
61			trips {
62				battery-crit-hi {
63					temperature = <70000>;
64					hysteresis = <2000>;
65					type = "critical";
66				};
67			};
68		};
69	};
70
71	bat_therm: thermistor {
72		compatible = "samsung,1404-001221";
73		io-channels = <&gpadc 0x02>; /* BatTemp */
74		pullup-uv = <1800000>;
75		pullup-ohm = <230000>;
76		pulldown-ohm = <0>;
77		#thermal-sensor-cells = <0>;
78	};
79
80	/* TI TXS0206 level translator for 2.9 V */
81	sd_level_translator: regulator-gpio {
82		compatible = "regulator-fixed";
83
84		/* GPIO87 EN */
85		gpios = <&gpio2 23 GPIO_ACTIVE_HIGH>;
86		enable-active-high;
87
88		regulator-name = "sd-level-translator";
89		regulator-min-microvolt = <2900000>;
90		regulator-max-microvolt = <2900000>;
91		regulator-type = "voltage";
92
93		startup-delay-us = <200>;
94
95		pinctrl-names = "default";
96		pinctrl-0 = <&sd_level_translator_default>;
97	};
98
99	/* External LDO MIC5366-3.3YMT for eMMC */
100	ldo_3v3_reg: regulator-gpio-ldo-3v3 {
101		compatible = "regulator-fixed";
102		/* Supplied in turn by VBAT */
103		regulator-name = "VMEM_3V3";
104		regulator-min-microvolt = <3300000>;
105		regulator-max-microvolt = <3300000>;
106		gpios = <&gpio6 31 GPIO_ACTIVE_HIGH>;
107		startup-delay-us = <5000>;
108		enable-active-high;
109		pinctrl-names = "default";
110		pinctrl-0 = <&emmc_ldo_en_default_mode>;
111	};
112
113	/*
114	 * External Ricoh "TSP" regulator for the touchscreen.
115	 * One GPIO line controls two voltages of 3.3V and 1.8V
116	 * this line is known as "TSP_LDO_ON1" in the schematics.
117	 */
118	ldo_tsp_3v3_reg: regulator-gpio-tsp-ldo-3v3 {
119		compatible = "regulator-fixed";
120		/* Supplied in turn by VBAT */
121		regulator-name = "LDO_TSP_A3V3";
122		regulator-min-microvolt = <3300000>;
123		regulator-max-microvolt = <3300000>;
124		/* GPIO94 controls this regulator */
125		gpio = <&gpio2 30 GPIO_ACTIVE_HIGH>;
126		/* 70 ms power-on delay */
127		startup-delay-us = <70000>;
128		enable-active-high;
129		pinctrl-names = "default";
130		pinctrl-0 = <&tsp_ldo_en_default_mode>;
131	};
132	ldo_tsp_1v8_reg: regulator-gpio-tsp-ldo-1v8 {
133		compatible = "regulator-fixed";
134		/* Supplied in turn by VBAT */
135		regulator-name = "VREG_TSP_1V8";
136		regulator-min-microvolt = <1800000>;
137		regulator-max-microvolt = <1800000>;
138		/* GPIO94 controls this regulator */
139		gpio = <&gpio2 30 GPIO_ACTIVE_HIGH>;
140		/* 70 ms power-on delay */
141		startup-delay-us = <70000>;
142		enable-active-high;
143		pinctrl-names = "default";
144		pinctrl-0 = <&tsp_ldo_en_default_mode>;
145	};
146
147	/*
148	 * External Ricoh RP152L010B-TR LCD LDO regulator for the display.
149	 * LCD_PWR_EN controls both a 3.0V and 1.8V output.
150	 */
151	lcd_3v0_reg: regulator-gpio-lcd-3v0 {
152		compatible = "regulator-fixed";
153		/* Supplied in turn by VBAT */
154		regulator-name = "VREG_LCD_3.0V";
155		regulator-min-microvolt = <3000000>;
156		regulator-max-microvolt = <3000000>;
157		/* GPIO219 controls this regulator */
158		gpio = <&gpio6 27 GPIO_ACTIVE_HIGH>;
159		enable-active-high;
160		pinctrl-names = "default";
161		pinctrl-0 = <&lcd_pwr_en_default_mode>;
162	};
163	lcd_1v8_reg: regulator-gpio-lcd-1v8 {
164		compatible = "regulator-fixed";
165		/* Supplied in turn by VBAT */
166		regulator-name = "VREG_LCD_1.8V";
167		regulator-min-microvolt = <1800000>;
168		regulator-max-microvolt = <1800000>;
169		/* GPIO219 controls this regulator too */
170		gpio = <&gpio6 27 GPIO_ACTIVE_HIGH>;
171		enable-active-high;
172		pinctrl-names = "default";
173		pinctrl-0 = <&lcd_pwr_en_default_mode>;
174	};
175
176	/*
177	 * This regulator is a GPIO line that drives the Broadcom WLAN
178	 * line WL_REG_ON high and enables the internal regulators
179	 * inside the chip. Unfortunatley it is erroneously named
180	 * WLAN_RST_N on the schematic but it is not a reset line.
181	 *
182	 * The voltage specified here is only used to determine the OCR mask,
183	 * the for the SDIO connector, the chip is actually connected
184	 * directly to VBAT.
185	 */
186	wl_reg: regulator-gpio-wlan {
187		compatible = "regulator-fixed";
188		regulator-name = "WL_REG_ON";
189		regulator-min-microvolt = <3000000>;
190		regulator-max-microvolt = <3000000>;
191		startup-delay-us = <100000>;
192		/* GPIO215 (WLAN_RST_N to WL_REG_ON) */
193		gpio = <&gpio6 23 GPIO_ACTIVE_HIGH>;
194		enable-active-high;
195		pinctrl-names = "default";
196		pinctrl-0 = <&wlan_ldo_en_default>;
197	};
198
199	vibrator {
200		compatible = "gpio-vibrator";
201		/* GPIO195 "MOT_EN" */
202		enable-gpios = <&gpio6 3 GPIO_ACTIVE_HIGH>;
203		pinctrl-names = "default";
204		pinctrl-0 = <&vibrator_default>;
205	};
206
207	gpio-keys {
208		compatible = "gpio-keys";
209		pinctrl-names = "default";
210		pinctrl-0 = <&gpio_keys_default_mode>;
211
212		button-home {
213			linux,code = <KEY_HOME>;
214			label = "HOME";
215			/* GPIO91 */
216			gpios = <&gpio2 27 GPIO_ACTIVE_LOW>;
217		};
218		button-volup {
219			linux,code = <KEY_VOLUMEUP>;
220			label = "VOL+";
221			/* GPIO67 */
222			gpios = <&gpio2 3 GPIO_ACTIVE_LOW>;
223		};
224		button-voldown {
225			linux,code = <KEY_VOLUMEDOWN>;
226			label = "VOL-";
227			/* GPIO92 */
228			gpios = <&gpio2 28 GPIO_ACTIVE_LOW>;
229		};
230	};
231
232	gpio-leds {
233		compatible = "gpio-leds";
234		pinctrl-names = "default";
235		pinctrl-0 = <&gpio_leds_default_mode>;
236		touchkey-led {
237			label = "touchkeys";
238			/*
239			 * GPIO194 on R0.0, R0.4 does not use this at all, it
240			 * will instead turn LDO AUX4 on/off for key led backlighy.
241			 * (Line is pulled down on R0.4)
242			 */
243			gpios = <&gpio6 2 GPIO_ACTIVE_HIGH>;
244			default-state = "on";
245		};
246	};
247
248	ktd253: backlight {
249		compatible = "kinetic,ktd253";
250		/*
251		 * GPIO68 is for R0.0, the board file talks about a TMO variant
252		 * (R0.4) using GPIO69.
253		 */
254		enable-gpios = <&gpio2 4 GPIO_ACTIVE_HIGH>;
255		/* Default to 13/32 brightness */
256		default-brightness = <13>;
257		pinctrl-names = "default";
258		pinctrl-0 = <&ktd253_backlight_default_mode>;
259	};
260
261	/* Richtek RT8515GQW Flash LED Driver IC */
262	flash {
263		compatible = "richtek,rt8515";
264		/* GPIO 140 */
265		enf-gpios = <&gpio4 12 GPIO_ACTIVE_HIGH>;
266		/* GPIO 141 */
267		ent-gpios = <&gpio4 13 GPIO_ACTIVE_HIGH>;
268		/*
269		 * RFS is 16 kOhm and RTS is 100 kOhm giving
270		 * the flash max current 343mA and torch max
271		 * current 55 mA.
272		 */
273		richtek,rfs-ohms = <16000>;
274		richtek,rts-ohms = <100000>;
275		pinctrl-names = "default";
276		pinctrl-0 = <&gpio_flash_default_mode>;
277
278		led {
279			function = LED_FUNCTION_FLASH;
280			color = <LED_COLOR_ID_WHITE>;
281			flash-max-timeout-us = <250000>;
282			flash-max-microamp = <343750>;
283			led-max-microamp = <55000>;
284		};
285	};
286
287	/* Bit-banged I2C on GPIO143 and GPIO144 also called "SUBPMU I2C" */
288	i2c-gpio-0 {
289		compatible = "i2c-gpio";
290		sda-gpios = <&gpio4 16 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
291		scl-gpios = <&gpio4 15 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
292		pinctrl-names = "default";
293		pinctrl-0 = <&i2c_gpio_0_default>;
294		#address-cells = <1>;
295		#size-cells = <0>;
296
297		magnetometer@c {
298			compatible = "alps,hscdtd008a";
299			reg = <0x0c>;
300			clock-frequency = <400000>;
301
302			avdd-supply = <&ab8500_ldo_aux1_reg>; // 3V
303			dvdd-supply = <&ab8500_ldo_aux2_reg>; // 1.8V
304		};
305		/* TODO: this should also be used by the SM5103 Camera power management unit */
306	};
307
308	/* Bit-banged I2C on GPIO151 and GPIO152 also called "NFC I2C" */
309	i2c-gpio-1 {
310		compatible = "i2c-gpio";
311		sda-gpios = <&gpio4 24 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
312		scl-gpios = <&gpio4 23 (GPIO_ACTIVE_HIGH|GPIO_OPEN_DRAIN)>;
313		pinctrl-names = "default";
314		pinctrl-0 = <&i2c_gpio_1_default>;
315		#address-cells = <1>;
316		#size-cells = <0>;
317
318		nfc@2b {
319			/* NXP NFC circuit PN544 C1 marked NXP 44501  */
320			compatible = "nxp,pn544-i2c";
321			/* IF0, IF1 high, gives I2C address 0x2B */
322			reg = <0x2b>;
323			clock-frequency = <400000>;
324			/* NFC IRQ on GPIO32 */
325			interrupt-parent = <&gpio1>;
326			interrupts = <0 IRQ_TYPE_EDGE_FALLING>;
327			/* GPIO 31 */
328			firmware-gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>;
329			/* GPIO88 */
330			enable-gpios = <&gpio2 24 GPIO_ACTIVE_HIGH>;
331			pinctrl-names = "default";
332			pinctrl-0 = <&pn544_codina_default>;
333		};
334	};
335
336	spi {
337		compatible = "spi-gpio";
338		/* Clock on GPIO220, pin SCL */
339		sck-gpios = <&gpio6 28 GPIO_ACTIVE_HIGH>;
340		/* MOSI on GPIO224, pin SDI "slave data in" */
341		mosi-gpios = <&gpio7 0 GPIO_ACTIVE_HIGH>;
342		/* MISO on GPIO225, pin SDO "slave data out" */
343		miso-gpios = <&gpio7 1 GPIO_ACTIVE_HIGH>;
344		/* Chip select on GPIO201 */
345		cs-gpios = <&gpio6 9 GPIO_ACTIVE_LOW>;
346		num-chipselects = <1>;
347
348		pinctrl-names = "default";
349		pinctrl-0 = <&spi_gpio_0_default>;
350		#address-cells = <1>;
351		#size-cells = <0>;
352
353		/*
354		 * Some Codinas (90%) have a WideChips WS2401-based LMS380KF01
355		 * display mounted and some 10% has a Samsung S6D27A1 instead.
356		 * The boot loader needs to modify this compatible to
357		 * correspond to whatever is passed from the early Samsung boot.
358		 */
359		panel@0 {
360			compatible = "samsung,lms380kf01";
361			spi-max-frequency = <1200000>;
362			/* TYPE 3: inverse clock polarity and phase */
363			spi-cpha;
364			spi-cpol;
365
366			reg = <0>;
367			vci-supply = <&lcd_3v0_reg>;
368			vccio-supply = <&lcd_1v8_reg>;
369
370			/* Reset on GPIO139 */
371			reset-gpios = <&gpio4 11 GPIO_ACTIVE_LOW>;
372			/* LCD_VGH/LCD_DETECT, ESD IRQ on GPIO93 */
373			interrupt-parent = <&gpio2>;
374			interrupts = <29 IRQ_TYPE_EDGE_RISING>;
375
376			pinctrl-names = "default";
377			pinctrl-0 = <&panel_default_mode>;
378			backlight = <&ktd253>;
379
380			port {
381				panel_in: endpoint {
382					remote-endpoint = <&display_out>;
383				};
384			};
385		};
386	};
387
388	soc {
389		/* External Micro SD slot */
390		mmc@80126000 {
391			arm,primecell-periphid = <0x10480180>;
392			max-frequency = <100000000>;
393			bus-width = <4>;
394			cap-sd-highspeed;
395			cap-mmc-highspeed;
396			st,sig-pin-fbclk;
397			full-pwr-cycle;
398			/* MMC is powered by AUX3 1.2V .. 2.91V */
399			vmmc-supply = <&ab8500_ldo_aux3_reg>;
400			/* 2.9 V level translator is using AUX3 at 2.9 V as well */
401			vqmmc-supply = <&sd_level_translator>;
402			pinctrl-names = "default", "sleep";
403			pinctrl-0 = <&mc0_a_2_default>;
404			pinctrl-1 = <&mc0_a_2_sleep>;
405			cd-gpios  = <&gpio6 25 GPIO_ACTIVE_LOW>; // GPIO217
406			status = "okay";
407		};
408
409		/* WLAN SDIO channel */
410		mmc@80118000 {
411			arm,primecell-periphid = <0x10480180>;
412			max-frequency = <50000000>;
413			bus-width = <4>;
414			non-removable;
415			cap-sd-highspeed;
416			pinctrl-names = "default", "sleep";
417			pinctrl-0 = <&mc1_a_2_default>;
418			pinctrl-1 = <&mc1_a_2_sleep>;
419			/*
420			 * GPIO-controlled voltage enablement: this drives
421			 * the WL_REG_ON line high when we use this device.
422			 * Represented as regulator to fill OCR mask.
423			 */
424			vmmc-supply = <&wl_reg>;
425
426			#address-cells = <1>;
427			#size-cells = <0>;
428			status = "okay";
429
430			wifi@1 {
431				/* Actually BRCM4330 */
432				compatible = "brcm,bcm4330-fmac", "brcm,bcm4329-fmac";
433				reg = <1>;
434				/* GPIO216 WL_HOST_WAKE */
435				interrupt-parent = <&gpio6>;
436				interrupts = <24 IRQ_TYPE_EDGE_FALLING>;
437				interrupt-names = "host-wake";
438				pinctrl-names = "default";
439				pinctrl-0 = <&wlan_default_mode>;
440			};
441		};
442
443		/* eMMC */
444		mmc@80005000 {
445			arm,primecell-periphid = <0x10480180>;
446			max-frequency = <100000000>;
447			bus-width = <8>;
448			non-removable;
449			cap-mmc-highspeed;
450			mmc-ddr-1_8v;
451			no-sdio;
452			no-sd;
453			vmmc-supply = <&ldo_3v3_reg>;
454			pinctrl-names = "default", "sleep";
455			/*
456			 * GPIO130 will be set to input no pull-up resulting in a resistor
457			 * pulling the reset high and taking the memory out of reset.
458			 */
459			pinctrl-0 = <&mc2_a_1_default>;
460			pinctrl-1 = <&mc2_a_1_sleep>;
461			status = "okay";
462		};
463
464		/* GBF (Bluetooth) UART */
465		serial@80120000 {
466			pinctrl-names = "default", "sleep";
467			pinctrl-0 = <&u0_a_1_default>;
468			pinctrl-1 = <&u0_a_1_sleep>;
469			status = "okay";
470
471			bluetooth {
472				compatible = "brcm,bcm4330-bt";
473				/* GPIO222 rail BT_VREG_EN to BT_REG_ON */
474				shutdown-gpios = <&gpio6 30 GPIO_ACTIVE_HIGH>;
475				/* BT_WAKE on GPIO199 */
476				device-wakeup-gpios = <&gpio6 7 GPIO_ACTIVE_HIGH>;
477				/* BT_HOST_WAKE on GPIO97 */
478				/* FIXME: convert to interrupt */
479				host-wakeup-gpios = <&gpio3 1 GPIO_ACTIVE_HIGH>;
480				/* BT_RST_N on GPIO209 */
481				reset-gpios = <&gpio6 17 GPIO_ACTIVE_LOW>;
482				pinctrl-names = "default";
483				pinctrl-0 = <&bluetooth_default_mode>;
484			};
485		};
486
487		/* GPS UART */
488		serial@80121000 {
489			status = "okay";
490			pinctrl-names = "default", "sleep";
491			pinctrl-0 = <&u1rxtx_a_1_default &u1ctsrts_a_1_default>;
492			pinctrl-1 = <&u1rxtx_a_1_sleep &u1ctsrts_a_1_sleep>;
493
494			gnss {
495				compatible = "brcm,bcm4751";
496				/* GPS_RSTN on GPIO21 */
497				reset-gpios = <&gpio0 21 GPIO_ACTIVE_LOW>;
498				/* GPS_ON_OFF on GPIO86 */
499				enable-gpios = <&gpio2 22 GPIO_ACTIVE_HIGH>;
500				/* GPS_1V8 (VSMPS2) */
501				vddio-supply = <&db8500_vsmps2_reg>;
502				pinctrl-names = "default";
503				pinctrl-0 = <&bcm4751_codina_default>;
504			};
505		};
506
507		/* Debugging console UART connected to TSU6111RSVR (FSA880) */
508		serial@80007000 {
509			status = "okay";
510			pinctrl-names = "default", "sleep";
511			pinctrl-0 = <&u2rxtx_c_1_default>;
512			pinctrl-1 = <&u2rxtx_c_1_sleep>;
513		};
514
515		prcmu@80157000 {
516			ab8500 {
517				phy {
518					pinctrl-names = "default", "sleep";
519					pinctrl-0 = <&usb_a_1_default>;
520					pinctrl-1 = <&usb_a_1_sleep>;
521				};
522
523				ab8500_fg {
524					line-impedance-micro-ohms = <36000>;
525				};
526
527				regulator {
528					ab8500_ldo_aux1 {
529						/* Used for VDD for sensors */
530						regulator-name = "V-SENSORS-VDD";
531						regulator-min-microvolt = <3000000>;
532						regulator-max-microvolt = <3000000>;
533					};
534
535					ab8500_ldo_aux2 {
536						/* Used for VIO for sensors */
537						regulator-name = "V-SENSORS-VIO";
538						regulator-min-microvolt = <1800000>;
539						regulator-max-microvolt = <1800000>;
540					};
541
542					ab8500_ldo_aux3 {
543						/* Used for voltage for external MMC/SD card */
544						regulator-name = "V-MMC-SD";
545						regulator-min-microvolt = <1200000>;
546						regulator-max-microvolt = <2910000>;
547					};
548				};
549			};
550		};
551
552		/* I2C0 also known as "AGC I2C" */
553		i2c@80004000 {
554			status = "okay";
555			pinctrl-names = "default", "sleep";
556			pinctrl-0 = <&i2c0_a_1_default>;
557			pinctrl-1 = <&i2c0_a_1_sleep>;
558
559			proximity@39 {
560				/* Codina has the Amstaos TMD2672 */
561				compatible = "amstaos,tmd2672";
562				clock-frequency = <400000>;
563				reg = <0x39>;
564
565				/* IRQ on GPIO146 "PS_INT" */
566				interrupt-parent = <&gpio4>;
567				interrupts = <18 IRQ_TYPE_EDGE_FALLING>;
568				/* FIXME: needs a VDDIO supply that is connected to a pull-up resistor */
569				vdd-supply = <&ab8500_ldo_aux1_reg>;
570				pinctrl-names = "default";
571				pinctrl-0 = <&tms2672_codina_default>;
572			};
573		};
574
575		/* I2C1 on GPIO16 and GPIO17 also called "MUS I2C" */
576		i2c@80122000 {
577			status = "okay";
578			pinctrl-names = "default","sleep";
579			/* FIXME: If it doesn't work try what we use on Gavini */
580			pinctrl-0 = <&i2c1_b_2_default>;
581			pinctrl-1 = <&i2c1_b_2_sleep>;
582
583			/* Texas Instruments TSU6111 micro USB switch */
584			usb-switch@25 {
585				compatible = "ti,tsu6111";
586				reg = <0x25>;
587				/* Interrupt JACK_INT_N on GPIO95 */
588				interrupt-parent = <&gpio2>;
589				interrupts = <31 IRQ_TYPE_EDGE_FALLING>;
590				pinctrl-names = "default";
591				pinctrl-0 = <&tsu6111_codina_default>;
592			};
593		};
594
595		/* I2C2 on GPIO10 and GPIO11 also called "SENSORS I2C" */
596		i2c@80128000 {
597			status = "okay";
598			pinctrl-names = "default", "sleep";
599			pinctrl-0 = <&i2c2_b_2_default>;
600			pinctrl-1 = <&i2c2_b_2_sleep>;
601
602			lisd3dh@19 {
603				/* ST Microelectronics Accelerometer */
604				compatible = "st,lis3dh-accel";
605				st,drdy-int-pin = <1>;
606				reg = <0x19>;
607				vdd-supply = <&ab8500_ldo_aux1_reg>; // 3V
608				vddio-supply = <&ab8500_ldo_aux2_reg>; // 1.8V
609				mount-matrix = "0", "1", "0",
610					       "-1", "0", "0",
611					       "0", "0", "1";
612			};
613		};
614
615		/* I2C3 */
616		i2c@80110000 {
617			status = "okay";
618
619			pinctrl-names = "default", "sleep";
620			pinctrl-0 = <&i2c3_c_2_default>;
621			pinctrl-1 = <&i2c3_c_2_sleep>;
622
623			/* TODO: write bindings and driver for this touchscreen */
624
625			/* Zinitix BT404 ISP part */
626			isp@50 {
627				compatible = "zinitix,bt404-isp";
628				reg = <0x50>;
629				pinctrl-names = "default";
630				pinctrl-0 = <&tsp_default>;
631			};
632
633			/* Zinitix BT404 touchscreen, also has the touchkeys for menu and back */
634			touchscreen@20 {
635				compatible = "zinitix,bt404";
636				reg = <0x20>;
637				/* GPIO218 (TSP_INT_1V8) */
638				interrupt-parent = <&gpio6>;
639				interrupts = <26 IRQ_TYPE_EDGE_FALLING>;
640				vcca-supply = <&ldo_tsp_3v3_reg>;
641				vdd-supply = <&ldo_tsp_1v8_reg>;
642				zinitix,mode = <2>;
643				touchscreen-size-x = <480>;
644				touchscreen-size-y = <800>;
645				pinctrl-names = "default";
646				pinctrl-0 = <&tsp_default>;
647			};
648		};
649
650		mcde@a0350000 {
651			status = "okay";
652			pinctrl-names = "default";
653			pinctrl-0 = <&dpi_default_mode>;
654
655			port {
656				display_out: endpoint {
657					remote-endpoint = <&panel_in>;
658				};
659			};
660		};
661	};
662};
663
664&pinctrl {
665	/*
666	 * This extends the MC0_A_2 default config to include
667	 * the card detect GPIO217 line.
668	 */
669	sdi0 {
670		mc0_a_2_default {
671			default_cfg4 {
672				pins = "GPIO217_AH12"; /* card detect */
673				ste,config = <&gpio_in_pd>;
674			};
675		};
676	};
677	sdi2 {
678		/*
679		 * This will make the resistor mounted in R0.0 pull up
680		 * the reset line and take the eMMC out of reset. On
681		 * R0.4 variants, GPIO130 should be set in GPIO mode and
682		 * pulled down. (Not connected.)
683		 */
684		mc2_a_1_default {
685			default_cfg2 {
686				pins = "GPIO130_C8"; /* FBCLK */
687				ste,config = <&in_nopull>;
688			};
689		};
690	};
691	/* GPIO that enables the 2.9V SD card level translator */
692	sd-level-translator {
693		sd_level_translator_default: sd_level_translator_default {
694			/* level shifter on GPIO87 */
695			codina_cfg1 {
696				pins = "GPIO87_B3";
697				ste,config = <&gpio_out_hi>;
698			};
699		};
700	};
701	/* GPIO that enables the LDO regulator for the eMMC */
702	emmc-ldo {
703		emmc_ldo_en_default_mode: emmc_ldo_default {
704			/* LDO enable on GPIO223 */
705			codina_cfg1 {
706				pins = "GPIO223_AH9";
707				ste,config = <&gpio_out_hi>;
708			};
709		};
710	};
711	/* GPIOs for panel control */
712	panel {
713		panel_default_mode: panel_default {
714			codina_cfg1 {
715				/* Reset line */
716				pins = "GPIO139_C9";
717				ste,config = <&gpio_out_lo>;
718			};
719			codina_cfg2 {
720				/* ESD IRQ line "LCD detect" */
721				pins = "GPIO93_B7";
722				ste,config = <&gpio_in_nopull>;
723			};
724		};
725	};
726	/* GPIO that enables the LDO regulator for the touchscreen */
727	tsp-ldo {
728		tsp_ldo_en_default_mode: tsp_ldo_default {
729			/* LDO enable on GPIO94 */
730			gavini_cfg1 {
731				pins = "GPIO94_D7";
732				ste,config = <&gpio_out_hi>;
733			};
734		};
735	};
736	/* GPIO that enables the LDO regulator for the LCD display */
737	lcd-ldo {
738		lcd_pwr_en_default_mode: lcd_pwr_en_default {
739			/* LCD_PWR_EN on GPIO219 */
740			codina_cfg1 {
741				pins = "GPIO219_AG10";
742				ste,config = <&gpio_out_hi>;
743			};
744		};
745	};
746	/* GPIO that enables the LDO regulator for the key LED */
747	key-led {
748		gpio_leds_default_mode: en_led_ldo_default {
749			/* EN_LED_LDO on GPIO194 */
750			codina_cfg1 {
751				pins = "GPIO194_AF27";
752				ste,config = <&gpio_out_hi>;
753			};
754		};
755	};
756	/* GPIO that enables the WLAN internal LDO regulators */
757	wlan-ldo {
758		wlan_ldo_en_default: wlan_ldo_default {
759			/* GPIO215 named WLAN_RST_N */
760			codina_cfg1 {
761				pins = "GPIO215_AH13";
762				ste,config = <&gpio_out_lo>;
763			};
764		};
765	};
766	/* Backlight GPIO */
767	backlight {
768		ktd253_backlight_default_mode: backlight_default {
769			skomer_cfg1 {
770				pins = "GPIO68_E1"; /* LCD_BL_CTRL */
771				ste,config = <&gpio_out_lo>;
772			};
773		};
774	};
775	/* Flash and torch */
776	flash {
777		gpio_flash_default_mode: flash_default {
778			codina_cfg1 {
779				pins = "GPIO140_B11", "GPIO141_C12";
780				ste,config = <&gpio_out_lo>;
781			};
782		};
783	};
784	/* GPIO keys */
785	gpio-keys {
786		gpio_keys_default_mode: gpio_keys_default {
787			skomer_cfg1 {
788				pins = "GPIO67_G2", /* VOL UP */
789				       "GPIO91_B6", /* HOME */
790				       "GPIO92_D6"; /* VOL DOWN */
791				ste,config = <&gpio_in_pu>;
792			};
793		};
794	};
795	/* Interrupt line for the Zinitix BT404 touchscreen */
796	tsp {
797		tsp_default: tsp_default {
798			codina_cfg1 {
799				pins = "GPIO218_AH11";	/* TSP_INT_1V8 */
800				ste,config = <&gpio_in_nopull>;
801			};
802		};
803	};
804	/* Interrupt line for light/proximity sensor TMS2672 */
805	tms2672 {
806		tms2672_codina_default: tms2672_codina {
807			codina_cfg1 {
808				pins = "GPIO146_D13";
809				ste,config = <&gpio_in_nopull>;
810			};
811		};
812	};
813	/* GPIO-based I2C bus for subpmu */
814	i2c-gpio-0 {
815		i2c_gpio_0_default: i2c_gpio_0 {
816			codina_cfg1 {
817				pins = "GPIO143_D12", "GPIO144_B13";
818				ste,config = <&gpio_in_nopull>;
819			};
820		};
821	};
822	/* GPIO-based I2C bus for the NFC */
823	i2c-gpio-1 {
824		i2c_gpio_1_default: i2c_gpio_1 {
825			codina_cfg1 {
826				pins = "GPIO151_D17", "GPIO152_D16";
827				ste,config = <&gpio_in_nopull>;
828			};
829		};
830	};
831	/* GPIO-based SPI bus for the display */
832	spi-gpio-0 {
833		spi_gpio_0_default: spi_gpio_0_d {
834			codina_cfg1 {
835				pins = "GPIO220_AH10", "GPIO201_AF24", "GPIO224_AG9";
836				ste,config = <&gpio_out_hi>;
837			};
838			codina_cfg2 {
839				pins = "GPIO225_AG8";
840				/* Needs pull down, no pull down resistor on board */
841				ste,config = <&gpio_in_pd>;
842			};
843		};
844		spi_gpio_0_sleep: spi_gpio_0_s {
845			codina_cfg1 {
846				pins = "GPIO220_AH10", "GPIO201_AF24",
847				       "GPIO224_AG9", "GPIO225_AG8";
848				ste,config = <&gpio_out_hi>;
849			};
850		};
851	};
852	wlan {
853		wlan_default_mode: wlan_default {
854			/* GPIO216 for WL_HOST_WAKE */
855			codina_cfg2 {
856				pins = "GPIO216_AG12";
857				ste,config = <&gpio_in_pd>;
858			};
859		};
860	};
861	bluetooth {
862		bluetooth_default_mode: bluetooth_default {
863			/* GPIO199 BT_WAKE and GPIO222 BT_VREG_ON */
864			codina_cfg1 {
865				pins = "GPIO199_AH23", "GPIO222_AJ9";
866				ste,config = <&gpio_out_lo>;
867			};
868			/* GPIO97 BT_HOST_WAKE */
869			codina_cfg2 {
870				pins = "GPIO97_D9";
871				ste,config = <&gpio_in_nopull>;
872			};
873			/* GPIO209 BT_RST_N */
874			codina_cfg3 {
875				pins = "GPIO209_AG15";
876				ste,config = <&gpio_out_hi>;
877			};
878		};
879	};
880	/* Interrupt line for TI TSU6111 Micro USB switch */
881	tsu6111 {
882		tsu6111_codina_default: tsu6111_codina {
883			codina_cfg1 {
884				/* GPIO95 used for IRQ */
885				pins = "GPIO95_E8";
886				ste,config = <&gpio_in_nopull>;
887			};
888		};
889	};
890	nfc {
891		pn544_codina_default: pn544_codina {
892			/* Interrupt line */
893			codina_cfg1 {
894				pins = "GPIO32_V2";
895				ste,config = <&gpio_in_nopull>;
896			};
897			/* Enable and firmware GPIOs */
898			codina_cfg2 {
899				pins = "GPIO31_V3", "GPIO88_C4";
900				ste,config = <&gpio_out_lo>;
901			};
902		};
903	};
904	bcm4751 {
905		bcm4751_codina_default: bcm4751_codina {
906			/* Reset line, start out asserted */
907			codina_cfg1 {
908				pins = "GPIO21_AB3";
909				ste,config = <&gpio_out_lo>;
910			};
911			/* GPS_ON_OFF, start out deasserted (off) */
912			codina_cfg2 {
913				pins = "GPIO86_C6";
914				ste,config = <&gpio_out_lo>;
915			};
916		};
917	};
918	vibrator {
919		vibrator_default: vibrator_default {
920			codina_cfg1 {
921				pins = "GPIO195_AG28";	/* MOT_EN */
922				ste,config = <&gpio_out_lo>;
923			};
924		};
925	};
926	mcde {
927		dpi_default_mode: dpi_default {
928			default_mux1 {
929				/* Mux in all the data lines */
930				function = "lcd";
931				groups =
932					/* Data lines D0-D7 GPIO70..GPIO77 */
933					"lcd_d0_d7_a_1",
934					/* Data lines D8-D11 GPIO78..GPIO81 */
935					"lcd_d8_d11_a_1",
936					/* Data lines D12-D15 GPIO82..GPIO85 */
937					"lcd_d12_d15_a_1",
938					/* Data lines D16-D23 GPIO161..GPIO168 */
939					"lcd_d16_d23_b_1";
940			};
941			default_mux2 {
942				function = "lcda";
943				/* Clock line on GPIO150, DE, VSO, HSO on GPIO169..GPIO171 */
944				groups = "lcdaclk_b_1", "lcda_b_1";
945			};
946			/* Input, no pull-up is the default state for pins used for an alt function */
947			default_cfg1 {
948				pins = "GPIO150_C14", "GPIO169_D22", "GPIO170_C23", "GPIO171_D23";
949				ste,config = <&in_nopull>;
950			};
951		};
952	};
953};
954