xref: /linux/arch/arm/mach-omap1/board-sx1.c (revision cdd5b5a9761fd66d17586e4f4ba6588c70e640ea)
1d2912cb1SThomas Gleixner // SPDX-License-Identifier: GPL-2.0-only
2c79ed194SVladimir Ananiev /*
3c79ed194SVladimir Ananiev * linux/arch/arm/mach-omap1/board-sx1.c
4c79ed194SVladimir Ananiev *
5c79ed194SVladimir Ananiev * Modified from board-generic.c
6c79ed194SVladimir Ananiev *
7c79ed194SVladimir Ananiev * Support for the Siemens SX1 mobile phone.
8c79ed194SVladimir Ananiev *
9c79ed194SVladimir Ananiev * Original version : Vladimir Ananiev (Vovan888-at-gmail com)
10c79ed194SVladimir Ananiev *
11c79ed194SVladimir Ananiev * Maintainters : Vladimir Ananiev (aka Vovan888), Sergge
12c79ed194SVladimir Ananiev *		oslik.ru
13c79ed194SVladimir Ananiev */
14*480c82daSLinus Walleij #include <linux/gpio/machine.h>
15*480c82daSLinus Walleij #include <linux/gpio/consumer.h>
16c79ed194SVladimir Ananiev #include <linux/kernel.h>
17c79ed194SVladimir Ananiev #include <linux/init.h>
18c79ed194SVladimir Ananiev #include <linux/input.h>
19c79ed194SVladimir Ananiev #include <linux/platform_device.h>
20c79ed194SVladimir Ananiev #include <linux/notifier.h>
21c79ed194SVladimir Ananiev #include <linux/mtd/mtd.h>
22c79ed194SVladimir Ananiev #include <linux/mtd/partitions.h>
23561b036aSLadislav Michl #include <linux/mtd/physmap.h>
24c79ed194SVladimir Ananiev #include <linux/types.h>
25c79ed194SVladimir Ananiev #include <linux/i2c.h>
26c79ed194SVladimir Ananiev #include <linux/errno.h>
27dc28094bSPaul Gortmaker #include <linux/export.h>
28ddba6c7fSTomi Valkeinen #include <linux/omapfb.h>
292203747cSArnd Bergmann #include <linux/platform_data/keypad-omap.h>
307e0a9e62SArnd Bergmann #include <linux/omap-dma.h>
317e0a9e62SArnd Bergmann #include "tc.h"
32c79ed194SVladimir Ananiev 
33c79ed194SVladimir Ananiev #include <asm/mach-types.h>
34c79ed194SVladimir Ananiev #include <asm/mach/arch.h>
35c79ed194SVladimir Ananiev #include <asm/mach/map.h>
36c79ed194SVladimir Ananiev 
37100f9638SArnd Bergmann #include "flash.h"
387e0a9e62SArnd Bergmann #include "mux.h"
39100f9638SArnd Bergmann #include "board-sx1.h"
407e0a9e62SArnd Bergmann #include "hardware.h"
41e8e77e97SArnd Bergmann #include "usb.h"
422e3ee9f4STony Lindgren #include "common.h"
432e3ee9f4STony Lindgren 
44c79ed194SVladimir Ananiev /* Write to I2C device */
sx1_i2c_write_byte(u8 devaddr,u8 regoffset,u8 value)45087c5030SCarlos Eduardo Aguiar int sx1_i2c_write_byte(u8 devaddr, u8 regoffset, u8 value)
46c79ed194SVladimir Ananiev {
47c79ed194SVladimir Ananiev 	struct i2c_adapter *adap;
48c79ed194SVladimir Ananiev 	int err;
49c79ed194SVladimir Ananiev 	struct i2c_msg msg[1];
50c79ed194SVladimir Ananiev 	unsigned char data[2];
51c79ed194SVladimir Ananiev 
52c79ed194SVladimir Ananiev 	adap = i2c_get_adapter(0);
53c79ed194SVladimir Ananiev 	if (!adap)
54c79ed194SVladimir Ananiev 		return -ENODEV;
55c79ed194SVladimir Ananiev 	msg->addr = devaddr;	/* I2C address of chip */
56c79ed194SVladimir Ananiev 	msg->flags = 0;
57c79ed194SVladimir Ananiev 	msg->len = 2;
58c79ed194SVladimir Ananiev 	msg->buf = data;
59c79ed194SVladimir Ananiev 	data[0] = regoffset;	/* register num */
60c79ed194SVladimir Ananiev 	data[1] = value;		/* register data */
61c79ed194SVladimir Ananiev 	err = i2c_transfer(adap, msg, 1);
62c9a2c46dSJean Delvare 	i2c_put_adapter(adap);
63c79ed194SVladimir Ananiev 	if (err >= 0)
64c79ed194SVladimir Ananiev 		return 0;
65c79ed194SVladimir Ananiev 	return err;
66c79ed194SVladimir Ananiev }
67c79ed194SVladimir Ananiev 
68c79ed194SVladimir Ananiev /* Read from I2C device */
sx1_i2c_read_byte(u8 devaddr,u8 regoffset,u8 * value)69087c5030SCarlos Eduardo Aguiar int sx1_i2c_read_byte(u8 devaddr, u8 regoffset, u8 *value)
70c79ed194SVladimir Ananiev {
71c79ed194SVladimir Ananiev 	struct i2c_adapter *adap;
72c79ed194SVladimir Ananiev 	int err;
73c79ed194SVladimir Ananiev 	struct i2c_msg msg[1];
74c79ed194SVladimir Ananiev 	unsigned char data[2];
75c79ed194SVladimir Ananiev 
76c79ed194SVladimir Ananiev 	adap = i2c_get_adapter(0);
77c79ed194SVladimir Ananiev 	if (!adap)
78c79ed194SVladimir Ananiev 		return -ENODEV;
79c79ed194SVladimir Ananiev 
80c79ed194SVladimir Ananiev 	msg->addr = devaddr;	/* I2C address of chip */
81c79ed194SVladimir Ananiev 	msg->flags = 0;
82c79ed194SVladimir Ananiev 	msg->len = 1;
83c79ed194SVladimir Ananiev 	msg->buf = data;
84c79ed194SVladimir Ananiev 	data[0] = regoffset;	/* register num */
85c79ed194SVladimir Ananiev 	err = i2c_transfer(adap, msg, 1);
86c79ed194SVladimir Ananiev 
87c79ed194SVladimir Ananiev 	msg->addr = devaddr;	/* I2C address */
88c79ed194SVladimir Ananiev 	msg->flags = I2C_M_RD;
89c79ed194SVladimir Ananiev 	msg->len = 1;
90c79ed194SVladimir Ananiev 	msg->buf = data;
91c79ed194SVladimir Ananiev 	err = i2c_transfer(adap, msg, 1);
92c79ed194SVladimir Ananiev 	*value = data[0];
93c9a2c46dSJean Delvare 	i2c_put_adapter(adap);
94c79ed194SVladimir Ananiev 
95c79ed194SVladimir Ananiev 	if (err >= 0)
96c79ed194SVladimir Ananiev 		return 0;
97c79ed194SVladimir Ananiev 	return err;
98c79ed194SVladimir Ananiev }
99c79ed194SVladimir Ananiev /* set keyboard backlight intensity */
sx1_setkeylight(u8 keylight)100c79ed194SVladimir Ananiev int sx1_setkeylight(u8 keylight)
101c79ed194SVladimir Ananiev {
102c79ed194SVladimir Ananiev 	if (keylight > SOFIA_MAX_LIGHT_VAL)
103c79ed194SVladimir Ananiev 		keylight = SOFIA_MAX_LIGHT_VAL;
104087c5030SCarlos Eduardo Aguiar 	return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_KEYLIGHT_REG, keylight);
105c79ed194SVladimir Ananiev }
106c79ed194SVladimir Ananiev /* get current keylight intensity */
sx1_getkeylight(u8 * keylight)107c79ed194SVladimir Ananiev int sx1_getkeylight(u8 * keylight)
108c79ed194SVladimir Ananiev {
109087c5030SCarlos Eduardo Aguiar 	return sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_KEYLIGHT_REG, keylight);
110c79ed194SVladimir Ananiev }
111c79ed194SVladimir Ananiev /* set LCD backlight intensity */
sx1_setbacklight(u8 backlight)112c79ed194SVladimir Ananiev int sx1_setbacklight(u8 backlight)
113c79ed194SVladimir Ananiev {
114c79ed194SVladimir Ananiev 	if (backlight > SOFIA_MAX_LIGHT_VAL)
115c79ed194SVladimir Ananiev 		backlight = SOFIA_MAX_LIGHT_VAL;
116087c5030SCarlos Eduardo Aguiar 	return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_BACKLIGHT_REG,
117087c5030SCarlos Eduardo Aguiar 				  backlight);
118c79ed194SVladimir Ananiev }
119c79ed194SVladimir Ananiev /* get current LCD backlight intensity */
sx1_getbacklight(u8 * backlight)120c79ed194SVladimir Ananiev int sx1_getbacklight (u8 * backlight)
121c79ed194SVladimir Ananiev {
122087c5030SCarlos Eduardo Aguiar 	return sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_BACKLIGHT_REG,
123087c5030SCarlos Eduardo Aguiar 				 backlight);
124c79ed194SVladimir Ananiev }
125c79ed194SVladimir Ananiev /* set LCD backlight power on/off */
sx1_setmmipower(u8 onoff)126c79ed194SVladimir Ananiev int sx1_setmmipower(u8 onoff)
127c79ed194SVladimir Ananiev {
128c79ed194SVladimir Ananiev 	int err;
129c79ed194SVladimir Ananiev 	u8 dat = 0;
130087c5030SCarlos Eduardo Aguiar 	err = sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat);
131c79ed194SVladimir Ananiev 	if (err < 0)
132c79ed194SVladimir Ananiev 		return err;
133c79ed194SVladimir Ananiev 	if (onoff)
134c79ed194SVladimir Ananiev 		dat |= SOFIA_MMILIGHT_POWER;
135c79ed194SVladimir Ananiev 	else
136c79ed194SVladimir Ananiev 		dat &= ~SOFIA_MMILIGHT_POWER;
137087c5030SCarlos Eduardo Aguiar 	return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat);
138c79ed194SVladimir Ananiev }
139087c5030SCarlos Eduardo Aguiar 
140c79ed194SVladimir Ananiev /* set USB power on/off */
sx1_setusbpower(u8 onoff)141c79ed194SVladimir Ananiev int sx1_setusbpower(u8 onoff)
142c79ed194SVladimir Ananiev {
143c79ed194SVladimir Ananiev 	int err;
144c79ed194SVladimir Ananiev 	u8 dat = 0;
145087c5030SCarlos Eduardo Aguiar 	err = sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat);
146c79ed194SVladimir Ananiev 	if (err < 0)
147c79ed194SVladimir Ananiev 		return err;
148c79ed194SVladimir Ananiev 	if (onoff)
149c79ed194SVladimir Ananiev 		dat |= SOFIA_USB_POWER;
150c79ed194SVladimir Ananiev 	else
151c79ed194SVladimir Ananiev 		dat &= ~SOFIA_USB_POWER;
152087c5030SCarlos Eduardo Aguiar 	return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat);
153c79ed194SVladimir Ananiev }
154c79ed194SVladimir Ananiev 
155c79ed194SVladimir Ananiev EXPORT_SYMBOL(sx1_setkeylight);
156c79ed194SVladimir Ananiev EXPORT_SYMBOL(sx1_getkeylight);
157c79ed194SVladimir Ananiev EXPORT_SYMBOL(sx1_setbacklight);
158c79ed194SVladimir Ananiev EXPORT_SYMBOL(sx1_getbacklight);
159c79ed194SVladimir Ananiev EXPORT_SYMBOL(sx1_setmmipower);
160c79ed194SVladimir Ananiev EXPORT_SYMBOL(sx1_setusbpower);
161c79ed194SVladimir Ananiev 
162c79ed194SVladimir Ananiev /*----------- Keypad -------------------------*/
163c79ed194SVladimir Ananiev 
164da1f026bSJanusz Krzysztofik static const unsigned int sx1_keymap[] = {
165da1f026bSJanusz Krzysztofik 	KEY(3, 5, GROUP_0 | 117), /* camera Qt::Key_F17 */
166da1f026bSJanusz Krzysztofik 	KEY(4, 0, GROUP_0 | 114), /* voice memo Qt::Key_F14 */
167da1f026bSJanusz Krzysztofik 	KEY(4, 1, GROUP_2 | 114), /* voice memo */
168da1f026bSJanusz Krzysztofik 	KEY(4, 2, GROUP_3 | 114), /* voice memo */
169c79ed194SVladimir Ananiev 	KEY(0, 0, GROUP_1 | KEY_F12),	/* red button Qt::Key_Hangup */
170da1f026bSJanusz Krzysztofik 	KEY(3, 4, GROUP_1 | KEY_LEFT),
171da1f026bSJanusz Krzysztofik 	KEY(3, 2, GROUP_1 | KEY_DOWN),
172da1f026bSJanusz Krzysztofik 	KEY(3, 1, GROUP_1 | KEY_RIGHT),
173da1f026bSJanusz Krzysztofik 	KEY(3, 0, GROUP_1 | KEY_UP),
174c79ed194SVladimir Ananiev 	KEY(3, 3, GROUP_1 | KEY_POWER), /* joystick press or Qt::Key_Select */
175da1f026bSJanusz Krzysztofik 	KEY(0, 5, GROUP_1 | KEY_1),
176da1f026bSJanusz Krzysztofik 	KEY(0, 4, GROUP_1 | KEY_2),
177da1f026bSJanusz Krzysztofik 	KEY(0, 3, GROUP_1 | KEY_3),
178da1f026bSJanusz Krzysztofik 	KEY(4, 3, GROUP_1 | KEY_4),
179c79ed194SVladimir Ananiev 	KEY(4, 4, GROUP_1 | KEY_5),
180da1f026bSJanusz Krzysztofik 	KEY(4, 5, GROUP_1 | KEY_KPASTERISK),/* "*" */
181da1f026bSJanusz Krzysztofik 	KEY(1, 4, GROUP_1 | KEY_6),
182da1f026bSJanusz Krzysztofik 	KEY(1, 5, GROUP_1 | KEY_7),
183da1f026bSJanusz Krzysztofik 	KEY(1, 3, GROUP_1 | KEY_8),
184da1f026bSJanusz Krzysztofik 	KEY(2, 3, GROUP_1 | KEY_9),
185da1f026bSJanusz Krzysztofik 	KEY(2, 5, GROUP_1 | KEY_0),
186da1f026bSJanusz Krzysztofik 	KEY(2, 4, GROUP_1 | 113), /* # F13 Toggle input method Qt::Key_F13 */
187da1f026bSJanusz Krzysztofik 	KEY(1, 0, GROUP_1 | KEY_F11),	/* green button Qt::Key_Call */
188da1f026bSJanusz Krzysztofik 	KEY(2, 1, GROUP_1 | KEY_YEN),	/* left soft Qt::Key_Context1 */
189c79ed194SVladimir Ananiev 	KEY(2, 2, GROUP_1 | KEY_F8),	/* right soft Qt::Key_Back */
190da1f026bSJanusz Krzysztofik 	KEY(1, 2, GROUP_1 | KEY_LEFTSHIFT), /* shift */
191c79ed194SVladimir Ananiev 	KEY(1, 1, GROUP_1 | KEY_BACKSPACE), /* C (clear) */
192da1f026bSJanusz Krzysztofik 	KEY(2, 0, GROUP_1 | KEY_F7),	/* menu Qt::Key_Menu */
193c79ed194SVladimir Ananiev };
194c79ed194SVladimir Ananiev 
195c79ed194SVladimir Ananiev static struct resource sx1_kp_resources[] = {
196c79ed194SVladimir Ananiev 	[0] = {
197c79ed194SVladimir Ananiev 		.start	= INT_KEYBOARD,
198c79ed194SVladimir Ananiev 		.end	= INT_KEYBOARD,
199c79ed194SVladimir Ananiev 		.flags	= IORESOURCE_IRQ,
200c79ed194SVladimir Ananiev 	},
201c79ed194SVladimir Ananiev };
202c79ed194SVladimir Ananiev 
203da1f026bSJanusz Krzysztofik static const struct matrix_keymap_data sx1_keymap_data = {
204da1f026bSJanusz Krzysztofik 	.keymap		= sx1_keymap,
205da1f026bSJanusz Krzysztofik 	.keymap_size	= ARRAY_SIZE(sx1_keymap),
206da1f026bSJanusz Krzysztofik };
207da1f026bSJanusz Krzysztofik 
208c79ed194SVladimir Ananiev static struct omap_kp_platform_data sx1_kp_data = {
209c79ed194SVladimir Ananiev 	.rows		= 6,
210c79ed194SVladimir Ananiev 	.cols		= 6,
211da1f026bSJanusz Krzysztofik 	.keymap_data	= &sx1_keymap_data,
212c79ed194SVladimir Ananiev 	.delay	= 80,
213c79ed194SVladimir Ananiev };
214c79ed194SVladimir Ananiev 
215c79ed194SVladimir Ananiev static struct platform_device sx1_kp_device = {
216c79ed194SVladimir Ananiev 	.name		= "omap-keypad",
217c79ed194SVladimir Ananiev 	.id		= -1,
218c79ed194SVladimir Ananiev 	.dev		= {
219c79ed194SVladimir Ananiev 		.platform_data = &sx1_kp_data,
220c79ed194SVladimir Ananiev 	},
221c79ed194SVladimir Ananiev 	.num_resources	= ARRAY_SIZE(sx1_kp_resources),
222c79ed194SVladimir Ananiev 	.resource	= sx1_kp_resources,
223c79ed194SVladimir Ananiev };
224c79ed194SVladimir Ananiev 
225c79ed194SVladimir Ananiev /*----------- MTD -------------------------*/
226c79ed194SVladimir Ananiev 
227c79ed194SVladimir Ananiev static struct mtd_partition sx1_partitions[] = {
228c79ed194SVladimir Ananiev 	/* bootloader (U-Boot, etc) in first sector */
229c79ed194SVladimir Ananiev 	{
230c79ed194SVladimir Ananiev 		.name		= "bootloader",
231c79ed194SVladimir Ananiev 		.offset		= 0x01800000,
232c79ed194SVladimir Ananiev 		.size		= SZ_128K,
233c79ed194SVladimir Ananiev 		.mask_flags	= MTD_WRITEABLE, /* force read-only */
234c79ed194SVladimir Ananiev 	},
235c79ed194SVladimir Ananiev 	/* bootloader params in the next sector */
236c79ed194SVladimir Ananiev 	{
237c79ed194SVladimir Ananiev 		.name		= "params",
238c79ed194SVladimir Ananiev 		.offset		= MTDPART_OFS_APPEND,
239c79ed194SVladimir Ananiev 		.size		= SZ_128K,
240c79ed194SVladimir Ananiev 		.mask_flags	= 0,
241c79ed194SVladimir Ananiev 	},
242c79ed194SVladimir Ananiev 	/* kernel */
243c79ed194SVladimir Ananiev 	{
244c79ed194SVladimir Ananiev 		.name		= "kernel",
245c79ed194SVladimir Ananiev 		.offset		= MTDPART_OFS_APPEND,
246c79ed194SVladimir Ananiev 		.size		= SZ_2M - 2 * SZ_128K,
247c79ed194SVladimir Ananiev 		.mask_flags	= 0
248c79ed194SVladimir Ananiev 	},
249c79ed194SVladimir Ananiev 	/* file system */
250c79ed194SVladimir Ananiev 	{
251c79ed194SVladimir Ananiev 		.name		= "filesystem",
252c79ed194SVladimir Ananiev 		.offset		= MTDPART_OFS_APPEND,
253c79ed194SVladimir Ananiev 		.size		= MTDPART_SIZ_FULL,
254c79ed194SVladimir Ananiev 		.mask_flags	= 0
255c79ed194SVladimir Ananiev 	}
256c79ed194SVladimir Ananiev };
257c79ed194SVladimir Ananiev 
258561b036aSLadislav Michl static struct physmap_flash_data sx1_flash_data = {
259c79ed194SVladimir Ananiev 	.width		= 2,
260561b036aSLadislav Michl 	.set_vpp	= omap1_set_vpp,
261c79ed194SVladimir Ananiev 	.parts		= sx1_partitions,
262c79ed194SVladimir Ananiev 	.nr_parts	= ARRAY_SIZE(sx1_partitions),
263c79ed194SVladimir Ananiev };
264c79ed194SVladimir Ananiev 
265c79ed194SVladimir Ananiev /* MTD Intel 4000 flash - new flashes */
266c79ed194SVladimir Ananiev static struct resource sx1_new_flash_resource = {
267c79ed194SVladimir Ananiev 	.start		= OMAP_CS0_PHYS,
268c79ed194SVladimir Ananiev 	.end		= OMAP_CS0_PHYS + SZ_32M - 1,
269c79ed194SVladimir Ananiev 	.flags		= IORESOURCE_MEM,
270c79ed194SVladimir Ananiev };
271c79ed194SVladimir Ananiev 
272c79ed194SVladimir Ananiev static struct platform_device sx1_flash_device = {
273561b036aSLadislav Michl 	.name		= "physmap-flash",
274c79ed194SVladimir Ananiev 	.id		= 0,
275c79ed194SVladimir Ananiev 	.dev		= {
276c79ed194SVladimir Ananiev 		.platform_data	= &sx1_flash_data,
277c79ed194SVladimir Ananiev 	},
278c79ed194SVladimir Ananiev 	.num_resources	= 1,
279c79ed194SVladimir Ananiev 	.resource	= &sx1_new_flash_resource,
280c79ed194SVladimir Ananiev };
281c79ed194SVladimir Ananiev 
282c79ed194SVladimir Ananiev /*----------- USB -------------------------*/
283c79ed194SVladimir Ananiev 
284c79ed194SVladimir Ananiev static struct omap_usb_config sx1_usb_config __initdata = {
285c79ed194SVladimir Ananiev 	.otg		= 0,
286c79ed194SVladimir Ananiev 	.register_dev	= 1,
287c79ed194SVladimir Ananiev 	.register_host	= 0,
288c79ed194SVladimir Ananiev 	.hmc_mode	= 0,
289c79ed194SVladimir Ananiev 	.pins[0]	= 2,
290c79ed194SVladimir Ananiev 	.pins[1]	= 0,
291c79ed194SVladimir Ananiev 	.pins[2]	= 0,
292c79ed194SVladimir Ananiev };
293c79ed194SVladimir Ananiev 
294c79ed194SVladimir Ananiev /*----------- LCD -------------------------*/
295c79ed194SVladimir Ananiev 
296d25c70cfSBhumika Goyal static const struct omap_lcd_config sx1_lcd_config __initconst = {
297c79ed194SVladimir Ananiev 	.ctrl_name	= "internal",
298c79ed194SVladimir Ananiev };
299c79ed194SVladimir Ananiev 
300c79ed194SVladimir Ananiev /*-----------------------------------------*/
301c79ed194SVladimir Ananiev static struct platform_device *sx1_devices[] __initdata = {
302c79ed194SVladimir Ananiev 	&sx1_flash_device,
303c79ed194SVladimir Ananiev 	&sx1_kp_device,
304c79ed194SVladimir Ananiev };
305e27a93a9STony Lindgren 
306c79ed194SVladimir Ananiev /*-----------------------------------------*/
307e27a93a9STony Lindgren 
308*480c82daSLinus Walleij static struct gpiod_lookup_table sx1_gpio_table = {
309*480c82daSLinus Walleij 	.dev_id = NULL,
310*480c82daSLinus Walleij 	.table = {
311*480c82daSLinus Walleij 		GPIO_LOOKUP("gpio-0-15", 1, "irda_off",
312*480c82daSLinus Walleij 			    GPIO_ACTIVE_HIGH),
313*480c82daSLinus Walleij 		GPIO_LOOKUP("gpio-0-15", 11, "switch",
314*480c82daSLinus Walleij 			    GPIO_ACTIVE_HIGH),
315*480c82daSLinus Walleij 		GPIO_LOOKUP("gpio-0-15", 15, "usb_on",
316*480c82daSLinus Walleij 			    GPIO_ACTIVE_HIGH),
317*480c82daSLinus Walleij 		{ }
318*480c82daSLinus Walleij 	},
319*480c82daSLinus Walleij };
320*480c82daSLinus Walleij 
omap_sx1_init(void)321c79ed194SVladimir Ananiev static void __init omap_sx1_init(void)
322c79ed194SVladimir Ananiev {
323*480c82daSLinus Walleij 	struct gpio_desc *d;
324*480c82daSLinus Walleij 
325c33da3a8SJanusz Krzysztofik 	/* mux pins for uarts */
326c33da3a8SJanusz Krzysztofik 	omap_cfg_reg(UART1_TX);
327c33da3a8SJanusz Krzysztofik 	omap_cfg_reg(UART1_RTS);
328c33da3a8SJanusz Krzysztofik 	omap_cfg_reg(UART2_TX);
329c33da3a8SJanusz Krzysztofik 	omap_cfg_reg(UART2_RTS);
330c33da3a8SJanusz Krzysztofik 	omap_cfg_reg(UART3_TX);
331c33da3a8SJanusz Krzysztofik 	omap_cfg_reg(UART3_RX);
332c33da3a8SJanusz Krzysztofik 
333c79ed194SVladimir Ananiev 	platform_add_devices(sx1_devices, ARRAY_SIZE(sx1_devices));
334c79ed194SVladimir Ananiev 
335c79ed194SVladimir Ananiev 	omap_serial_init();
3361ed16a86SJarkko Nikula 	omap_register_i2c_bus(1, 100, NULL, 0);
337dd0cdd88STony Lindgren 	omap1_usb_init(&sx1_usb_config);
338087c5030SCarlos Eduardo Aguiar 	sx1_mmc_init();
339*480c82daSLinus Walleij 	gpiod_add_lookup_table(&sx1_gpio_table);
340c79ed194SVladimir Ananiev 
341c79ed194SVladimir Ananiev 	/* turn on USB power */
34225985edcSLucas De Marchi 	/* sx1_setusbpower(1); can't do it here because i2c is not ready */
343*480c82daSLinus Walleij 	d = gpiod_get(NULL, "irda_off", GPIOD_OUT_HIGH);
344*480c82daSLinus Walleij 	if (IS_ERR(d))
345*480c82daSLinus Walleij 		pr_err("Unable to get IRDA OFF GPIO descriptor\n");
346*480c82daSLinus Walleij 	else
347*480c82daSLinus Walleij 		gpiod_put(d);
348*480c82daSLinus Walleij 	d = gpiod_get(NULL, "switch", GPIOD_OUT_LOW);
349*480c82daSLinus Walleij 	if (IS_ERR(d))
350*480c82daSLinus Walleij 		pr_err("Unable to get SWITCH GPIO descriptor\n");
351*480c82daSLinus Walleij 	else
352*480c82daSLinus Walleij 		gpiod_put(d);
353*480c82daSLinus Walleij 	d = gpiod_get(NULL, "usb_on", GPIOD_OUT_LOW);
354*480c82daSLinus Walleij 	if (IS_ERR(d))
355*480c82daSLinus Walleij 		pr_err("Unable to get USB ON GPIO descriptor\n");
356*480c82daSLinus Walleij 	else
357*480c82daSLinus Walleij 		gpiod_put(d);
358ddba6c7fSTomi Valkeinen 
359ddba6c7fSTomi Valkeinen 	omapfb_set_lcd_config(&sx1_lcd_config);
360c79ed194SVladimir Ananiev }
361c79ed194SVladimir Ananiev 
362c79ed194SVladimir Ananiev MACHINE_START(SX1, "OMAP310 based Siemens SX1")
363246e389dSNicolas Pitre 	.atag_offset	= 0x100,
3649a99b142SArnd Bergmann 	.map_io		= omap1_map_io,
3657b88e62fSTony Lindgren 	.init_early     = omap1_init_early,
3667b88e62fSTony Lindgren 	.init_irq	= omap1_init_irq,
367c79ed194SVladimir Ananiev 	.init_machine	= omap_sx1_init,
36882c3bd03SShawn Guo 	.init_late	= omap1_init_late,
3696bb27d73SStephen Warren 	.init_time	= omap1_timer_init,
370baa95883SRussell King 	.restart	= omap1_restart,
371c79ed194SVladimir Ananiev MACHINE_END
372