xref: /linux/arch/arm/mach-omap1/board-sx1.c (revision ce491cf85466c3377228c5a852ea627ec5136956)
1c79ed194SVladimir Ananiev /*
2c79ed194SVladimir Ananiev * linux/arch/arm/mach-omap1/board-sx1.c
3c79ed194SVladimir Ananiev *
4c79ed194SVladimir Ananiev * Modified from board-generic.c
5c79ed194SVladimir Ananiev *
6c79ed194SVladimir Ananiev * Support for the Siemens SX1 mobile phone.
7c79ed194SVladimir Ananiev *
8c79ed194SVladimir Ananiev * Original version : Vladimir Ananiev (Vovan888-at-gmail com)
9c79ed194SVladimir Ananiev *
10c79ed194SVladimir Ananiev * Maintainters : Vladimir Ananiev (aka Vovan888), Sergge
11c79ed194SVladimir Ananiev *		oslik.ru
12c79ed194SVladimir Ananiev *
13c79ed194SVladimir Ananiev * This program is free software; you can redistribute it and/or modify
14c79ed194SVladimir Ananiev * it under the terms of the GNU General Public License version 2 as
15c79ed194SVladimir Ananiev * published by the Free Software Foundation.
16c79ed194SVladimir Ananiev */
17c79ed194SVladimir Ananiev 
18c79ed194SVladimir Ananiev #include <linux/kernel.h>
19c79ed194SVladimir Ananiev #include <linux/init.h>
20c79ed194SVladimir Ananiev #include <linux/input.h>
21c79ed194SVladimir Ananiev #include <linux/platform_device.h>
22c79ed194SVladimir Ananiev #include <linux/notifier.h>
23c79ed194SVladimir Ananiev #include <linux/mtd/mtd.h>
24c79ed194SVladimir Ananiev #include <linux/mtd/partitions.h>
25c79ed194SVladimir Ananiev #include <linux/types.h>
26c79ed194SVladimir Ananiev #include <linux/i2c.h>
27c79ed194SVladimir Ananiev #include <linux/errno.h>
28c79ed194SVladimir Ananiev 
29a09e64fbSRussell King #include <mach/hardware.h>
30c79ed194SVladimir Ananiev #include <asm/mach-types.h>
31c79ed194SVladimir Ananiev #include <asm/mach/arch.h>
32c79ed194SVladimir Ananiev #include <asm/mach/flash.h>
33c79ed194SVladimir Ananiev #include <asm/mach/map.h>
34c79ed194SVladimir Ananiev 
35a09e64fbSRussell King #include <mach/gpio.h>
36*ce491cf8STony Lindgren #include <plat/mux.h>
37*ce491cf8STony Lindgren #include <plat/dma.h>
38*ce491cf8STony Lindgren #include <plat/irda.h>
39*ce491cf8STony Lindgren #include <plat/usb.h>
40*ce491cf8STony Lindgren #include <plat/tc.h>
41*ce491cf8STony Lindgren #include <plat/board.h>
42*ce491cf8STony Lindgren #include <plat/common.h>
43*ce491cf8STony Lindgren #include <plat/keypad.h>
44*ce491cf8STony Lindgren #include <plat/board-sx1.h>
45c79ed194SVladimir Ananiev 
46c79ed194SVladimir Ananiev /* Write to I2C device */
47087c5030SCarlos Eduardo Aguiar int sx1_i2c_write_byte(u8 devaddr, u8 regoffset, u8 value)
48c79ed194SVladimir Ananiev {
49c79ed194SVladimir Ananiev 	struct i2c_adapter *adap;
50c79ed194SVladimir Ananiev 	int err;
51c79ed194SVladimir Ananiev 	struct i2c_msg msg[1];
52c79ed194SVladimir Ananiev 	unsigned char data[2];
53c79ed194SVladimir Ananiev 
54c79ed194SVladimir Ananiev 	adap = i2c_get_adapter(0);
55c79ed194SVladimir Ananiev 	if (!adap)
56c79ed194SVladimir Ananiev 		return -ENODEV;
57c79ed194SVladimir Ananiev 	msg->addr = devaddr;	/* I2C address of chip */
58c79ed194SVladimir Ananiev 	msg->flags = 0;
59c79ed194SVladimir Ananiev 	msg->len = 2;
60c79ed194SVladimir Ananiev 	msg->buf = data;
61c79ed194SVladimir Ananiev 	data[0] = regoffset;	/* register num */
62c79ed194SVladimir Ananiev 	data[1] = value;		/* register data */
63c79ed194SVladimir Ananiev 	err = i2c_transfer(adap, msg, 1);
64c9a2c46dSJean Delvare 	i2c_put_adapter(adap);
65c79ed194SVladimir Ananiev 	if (err >= 0)
66c79ed194SVladimir Ananiev 		return 0;
67c79ed194SVladimir Ananiev 	return err;
68c79ed194SVladimir Ananiev }
69c79ed194SVladimir Ananiev 
70c79ed194SVladimir Ananiev /* Read from I2C device */
71087c5030SCarlos Eduardo Aguiar int sx1_i2c_read_byte(u8 devaddr, u8 regoffset, u8 *value)
72c79ed194SVladimir Ananiev {
73c79ed194SVladimir Ananiev 	struct i2c_adapter *adap;
74c79ed194SVladimir Ananiev 	int err;
75c79ed194SVladimir Ananiev 	struct i2c_msg msg[1];
76c79ed194SVladimir Ananiev 	unsigned char data[2];
77c79ed194SVladimir Ananiev 
78c79ed194SVladimir Ananiev 	adap = i2c_get_adapter(0);
79c79ed194SVladimir Ananiev 	if (!adap)
80c79ed194SVladimir Ananiev 		return -ENODEV;
81c79ed194SVladimir Ananiev 
82c79ed194SVladimir Ananiev 	msg->addr = devaddr;	/* I2C address of chip */
83c79ed194SVladimir Ananiev 	msg->flags = 0;
84c79ed194SVladimir Ananiev 	msg->len = 1;
85c79ed194SVladimir Ananiev 	msg->buf = data;
86c79ed194SVladimir Ananiev 	data[0] = regoffset;	/* register num */
87c79ed194SVladimir Ananiev 	err = i2c_transfer(adap, msg, 1);
88c79ed194SVladimir Ananiev 
89c79ed194SVladimir Ananiev 	msg->addr = devaddr;	/* I2C address */
90c79ed194SVladimir Ananiev 	msg->flags = I2C_M_RD;
91c79ed194SVladimir Ananiev 	msg->len = 1;
92c79ed194SVladimir Ananiev 	msg->buf = data;
93c79ed194SVladimir Ananiev 	err = i2c_transfer(adap, msg, 1);
94c79ed194SVladimir Ananiev 	*value = data[0];
95c9a2c46dSJean Delvare 	i2c_put_adapter(adap);
96c79ed194SVladimir Ananiev 
97c79ed194SVladimir Ananiev 	if (err >= 0)
98c79ed194SVladimir Ananiev 		return 0;
99c79ed194SVladimir Ananiev 	return err;
100c79ed194SVladimir Ananiev }
101c79ed194SVladimir Ananiev /* set keyboard backlight intensity */
102c79ed194SVladimir Ananiev int sx1_setkeylight(u8 keylight)
103c79ed194SVladimir Ananiev {
104c79ed194SVladimir Ananiev 	if (keylight > SOFIA_MAX_LIGHT_VAL)
105c79ed194SVladimir Ananiev 		keylight = SOFIA_MAX_LIGHT_VAL;
106087c5030SCarlos Eduardo Aguiar 	return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_KEYLIGHT_REG, keylight);
107c79ed194SVladimir Ananiev }
108c79ed194SVladimir Ananiev /* get current keylight intensity */
109c79ed194SVladimir Ananiev int sx1_getkeylight(u8 * keylight)
110c79ed194SVladimir Ananiev {
111087c5030SCarlos Eduardo Aguiar 	return sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_KEYLIGHT_REG, keylight);
112c79ed194SVladimir Ananiev }
113c79ed194SVladimir Ananiev /* set LCD backlight intensity */
114c79ed194SVladimir Ananiev int sx1_setbacklight(u8 backlight)
115c79ed194SVladimir Ananiev {
116c79ed194SVladimir Ananiev 	if (backlight > SOFIA_MAX_LIGHT_VAL)
117c79ed194SVladimir Ananiev 		backlight = SOFIA_MAX_LIGHT_VAL;
118087c5030SCarlos Eduardo Aguiar 	return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_BACKLIGHT_REG,
119087c5030SCarlos Eduardo Aguiar 				  backlight);
120c79ed194SVladimir Ananiev }
121c79ed194SVladimir Ananiev /* get current LCD backlight intensity */
122c79ed194SVladimir Ananiev int sx1_getbacklight (u8 * backlight)
123c79ed194SVladimir Ananiev {
124087c5030SCarlos Eduardo Aguiar 	return sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_BACKLIGHT_REG,
125087c5030SCarlos Eduardo Aguiar 				 backlight);
126c79ed194SVladimir Ananiev }
127c79ed194SVladimir Ananiev /* set LCD backlight power on/off */
128c79ed194SVladimir Ananiev int sx1_setmmipower(u8 onoff)
129c79ed194SVladimir Ananiev {
130c79ed194SVladimir Ananiev 	int err;
131c79ed194SVladimir Ananiev 	u8 dat = 0;
132087c5030SCarlos Eduardo Aguiar 	err = sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat);
133c79ed194SVladimir Ananiev 	if (err < 0)
134c79ed194SVladimir Ananiev 		return err;
135c79ed194SVladimir Ananiev 	if (onoff)
136c79ed194SVladimir Ananiev 		dat |= SOFIA_MMILIGHT_POWER;
137c79ed194SVladimir Ananiev 	else
138c79ed194SVladimir Ananiev 		dat &= ~SOFIA_MMILIGHT_POWER;
139087c5030SCarlos Eduardo Aguiar 	return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat);
140c79ed194SVladimir Ananiev }
141087c5030SCarlos Eduardo Aguiar 
142c79ed194SVladimir Ananiev /* set USB power on/off */
143c79ed194SVladimir Ananiev int sx1_setusbpower(u8 onoff)
144c79ed194SVladimir Ananiev {
145c79ed194SVladimir Ananiev 	int err;
146c79ed194SVladimir Ananiev 	u8 dat = 0;
147087c5030SCarlos Eduardo Aguiar 	err = sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat);
148c79ed194SVladimir Ananiev 	if (err < 0)
149c79ed194SVladimir Ananiev 		return err;
150c79ed194SVladimir Ananiev 	if (onoff)
151c79ed194SVladimir Ananiev 		dat |= SOFIA_USB_POWER;
152c79ed194SVladimir Ananiev 	else
153c79ed194SVladimir Ananiev 		dat &= ~SOFIA_USB_POWER;
154087c5030SCarlos Eduardo Aguiar 	return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat);
155c79ed194SVladimir Ananiev }
156c79ed194SVladimir Ananiev 
157c79ed194SVladimir Ananiev EXPORT_SYMBOL(sx1_setkeylight);
158c79ed194SVladimir Ananiev EXPORT_SYMBOL(sx1_getkeylight);
159c79ed194SVladimir Ananiev EXPORT_SYMBOL(sx1_setbacklight);
160c79ed194SVladimir Ananiev EXPORT_SYMBOL(sx1_getbacklight);
161c79ed194SVladimir Ananiev EXPORT_SYMBOL(sx1_setmmipower);
162c79ed194SVladimir Ananiev EXPORT_SYMBOL(sx1_setusbpower);
163c79ed194SVladimir Ananiev 
164c79ed194SVladimir Ananiev /*----------- Keypad -------------------------*/
165c79ed194SVladimir Ananiev 
166c79ed194SVladimir Ananiev static int sx1_keymap[] = {
167c79ed194SVladimir Ananiev 	KEY(5, 3, GROUP_0 | 117), /* camera Qt::Key_F17 */
168c79ed194SVladimir Ananiev 	KEY(0, 4, GROUP_0 | 114), /* voice memo Qt::Key_F14 */
169c79ed194SVladimir Ananiev 	KEY(1, 4, GROUP_2 | 114), /* voice memo */
170c79ed194SVladimir Ananiev 	KEY(2, 4, GROUP_3 | 114), /* voice memo */
171c79ed194SVladimir Ananiev 	KEY(0, 0, GROUP_1 | KEY_F12),	/* red button Qt::Key_Hangup */
172c79ed194SVladimir Ananiev 	KEY(4, 3, GROUP_1 | KEY_LEFT),
173c79ed194SVladimir Ananiev 	KEY(2, 3, GROUP_1 | KEY_DOWN),
174c79ed194SVladimir Ananiev 	KEY(1, 3, GROUP_1 | KEY_RIGHT),
175c79ed194SVladimir Ananiev 	KEY(0, 3, GROUP_1 | KEY_UP),
176c79ed194SVladimir Ananiev 	KEY(3, 3, GROUP_1 | KEY_POWER), /* joystick press or Qt::Key_Select */
177c79ed194SVladimir Ananiev 	KEY(5, 0, GROUP_1 | KEY_1),
178c79ed194SVladimir Ananiev 	KEY(4, 0, GROUP_1 | KEY_2),
179c79ed194SVladimir Ananiev 	KEY(3, 0, GROUP_1 | KEY_3),
180c79ed194SVladimir Ananiev 	KEY(3, 4, GROUP_1 | KEY_4),
181c79ed194SVladimir Ananiev 	KEY(4, 4, GROUP_1 | KEY_5),
182c79ed194SVladimir Ananiev 	KEY(5, 4, GROUP_1 | KEY_KPASTERISK),/* "*" */
183c79ed194SVladimir Ananiev 	KEY(4, 1, GROUP_1 | KEY_6),
184c79ed194SVladimir Ananiev 	KEY(5, 1, GROUP_1 | KEY_7),
185c79ed194SVladimir Ananiev 	KEY(3, 1, GROUP_1 | KEY_8),
186c79ed194SVladimir Ananiev 	KEY(3, 2, GROUP_1 | KEY_9),
187c79ed194SVladimir Ananiev 	KEY(5, 2, GROUP_1 | KEY_0),
188c79ed194SVladimir Ananiev 	KEY(4, 2, GROUP_1 | 113),	/* # F13 Toggle input method Qt::Key_F13 */
189c79ed194SVladimir Ananiev 	KEY(0, 1, GROUP_1 | KEY_F11),	/* green button Qt::Key_Call */
190c79ed194SVladimir Ananiev 	KEY(1, 2, GROUP_1 | KEY_YEN),	/* left soft Qt::Key_Context1 */
191c79ed194SVladimir Ananiev 	KEY(2, 2, GROUP_1 | KEY_F8),	/* right soft Qt::Key_Back */
192c79ed194SVladimir Ananiev 	KEY(2, 1, GROUP_1 | KEY_LEFTSHIFT), /* shift */
193c79ed194SVladimir Ananiev 	KEY(1, 1, GROUP_1 | KEY_BACKSPACE), /* C (clear) */
194c79ed194SVladimir Ananiev 	KEY(0, 2, GROUP_1 | KEY_F7),	/* menu Qt::Key_Menu */
195c79ed194SVladimir Ananiev 	0
196c79ed194SVladimir Ananiev };
197c79ed194SVladimir Ananiev 
198c79ed194SVladimir Ananiev static struct resource sx1_kp_resources[] = {
199c79ed194SVladimir Ananiev 	[0] = {
200c79ed194SVladimir Ananiev 		.start	= INT_KEYBOARD,
201c79ed194SVladimir Ananiev 		.end	= INT_KEYBOARD,
202c79ed194SVladimir Ananiev 		.flags	= IORESOURCE_IRQ,
203c79ed194SVladimir Ananiev 	},
204c79ed194SVladimir Ananiev };
205c79ed194SVladimir Ananiev 
206c79ed194SVladimir Ananiev static struct omap_kp_platform_data sx1_kp_data = {
207c79ed194SVladimir Ananiev 	.rows		= 6,
208c79ed194SVladimir Ananiev 	.cols		= 6,
209c79ed194SVladimir Ananiev 	.keymap	= sx1_keymap,
210c79ed194SVladimir Ananiev 	.keymapsize = ARRAY_SIZE(sx1_keymap),
211c79ed194SVladimir Ananiev 	.delay	= 80,
212c79ed194SVladimir Ananiev };
213c79ed194SVladimir Ananiev 
214c79ed194SVladimir Ananiev static struct platform_device sx1_kp_device = {
215c79ed194SVladimir Ananiev 	.name		= "omap-keypad",
216c79ed194SVladimir Ananiev 	.id		= -1,
217c79ed194SVladimir Ananiev 	.dev		= {
218c79ed194SVladimir Ananiev 		.platform_data = &sx1_kp_data,
219c79ed194SVladimir Ananiev 	},
220c79ed194SVladimir Ananiev 	.num_resources	= ARRAY_SIZE(sx1_kp_resources),
221c79ed194SVladimir Ananiev 	.resource	= sx1_kp_resources,
222c79ed194SVladimir Ananiev };
223c79ed194SVladimir Ananiev 
224c79ed194SVladimir Ananiev /*----------- IRDA -------------------------*/
225c79ed194SVladimir Ananiev 
226c79ed194SVladimir Ananiev static struct omap_irda_config sx1_irda_data = {
227c79ed194SVladimir Ananiev 	.transceiver_cap	= IR_SIRMODE,
228c79ed194SVladimir Ananiev 	.rx_channel		= OMAP_DMA_UART3_RX,
229c79ed194SVladimir Ananiev 	.tx_channel		= OMAP_DMA_UART3_TX,
230c79ed194SVladimir Ananiev 	.dest_start		= UART3_THR,
231c79ed194SVladimir Ananiev 	.src_start		= UART3_RHR,
232c79ed194SVladimir Ananiev 	.tx_trigger		= 0,
233c79ed194SVladimir Ananiev 	.rx_trigger		= 0,
234c79ed194SVladimir Ananiev };
235c79ed194SVladimir Ananiev 
236c79ed194SVladimir Ananiev static struct resource sx1_irda_resources[] = {
237c79ed194SVladimir Ananiev 	[0] = {
238c79ed194SVladimir Ananiev 		.start	= INT_UART3,
239c79ed194SVladimir Ananiev 		.end	= INT_UART3,
240c79ed194SVladimir Ananiev 		.flags	= IORESOURCE_IRQ,
241c79ed194SVladimir Ananiev 	},
242c79ed194SVladimir Ananiev };
243c79ed194SVladimir Ananiev 
244c79ed194SVladimir Ananiev static u64 irda_dmamask = 0xffffffff;
245c79ed194SVladimir Ananiev 
246c79ed194SVladimir Ananiev static struct platform_device sx1_irda_device = {
247c79ed194SVladimir Ananiev 	.name		= "omapirda",
248c79ed194SVladimir Ananiev 	.id		= 0,
249c79ed194SVladimir Ananiev 	.dev		= {
250c79ed194SVladimir Ananiev 		.platform_data	= &sx1_irda_data,
251c79ed194SVladimir Ananiev 		.dma_mask	= &irda_dmamask,
252c79ed194SVladimir Ananiev 	},
253c79ed194SVladimir Ananiev 	.num_resources	= ARRAY_SIZE(sx1_irda_resources),
254c79ed194SVladimir Ananiev 	.resource	= sx1_irda_resources,
255c79ed194SVladimir Ananiev };
256c79ed194SVladimir Ananiev 
257c79ed194SVladimir Ananiev /*----------- MTD -------------------------*/
258c79ed194SVladimir Ananiev 
259c79ed194SVladimir Ananiev static struct mtd_partition sx1_partitions[] = {
260c79ed194SVladimir Ananiev 	/* bootloader (U-Boot, etc) in first sector */
261c79ed194SVladimir Ananiev 	{
262c79ed194SVladimir Ananiev 		.name		= "bootloader",
263c79ed194SVladimir Ananiev 		.offset		= 0x01800000,
264c79ed194SVladimir Ananiev 		.size		= SZ_128K,
265c79ed194SVladimir Ananiev 		.mask_flags	= MTD_WRITEABLE, /* force read-only */
266c79ed194SVladimir Ananiev 	},
267c79ed194SVladimir Ananiev 	/* bootloader params in the next sector */
268c79ed194SVladimir Ananiev 	{
269c79ed194SVladimir Ananiev 		.name		= "params",
270c79ed194SVladimir Ananiev 		.offset		= MTDPART_OFS_APPEND,
271c79ed194SVladimir Ananiev 		.size		= SZ_128K,
272c79ed194SVladimir Ananiev 		.mask_flags	= 0,
273c79ed194SVladimir Ananiev 	},
274c79ed194SVladimir Ananiev 	/* kernel */
275c79ed194SVladimir Ananiev 	{
276c79ed194SVladimir Ananiev 		.name		= "kernel",
277c79ed194SVladimir Ananiev 		.offset		= MTDPART_OFS_APPEND,
278c79ed194SVladimir Ananiev 		.size		= SZ_2M - 2 * SZ_128K,
279c79ed194SVladimir Ananiev 		.mask_flags	= 0
280c79ed194SVladimir Ananiev 	},
281c79ed194SVladimir Ananiev 	/* file system */
282c79ed194SVladimir Ananiev 	{
283c79ed194SVladimir Ananiev 		.name		= "filesystem",
284c79ed194SVladimir Ananiev 		.offset		= MTDPART_OFS_APPEND,
285c79ed194SVladimir Ananiev 		.size		= MTDPART_SIZ_FULL,
286c79ed194SVladimir Ananiev 		.mask_flags	= 0
287c79ed194SVladimir Ananiev 	}
288c79ed194SVladimir Ananiev };
289c79ed194SVladimir Ananiev 
290c79ed194SVladimir Ananiev static struct flash_platform_data sx1_flash_data = {
291c79ed194SVladimir Ananiev 	.map_name	= "cfi_probe",
292c79ed194SVladimir Ananiev 	.width		= 2,
293c79ed194SVladimir Ananiev 	.parts		= sx1_partitions,
294c79ed194SVladimir Ananiev 	.nr_parts	= ARRAY_SIZE(sx1_partitions),
295c79ed194SVladimir Ananiev };
296c79ed194SVladimir Ananiev 
297c79ed194SVladimir Ananiev #ifdef CONFIG_SX1_OLD_FLASH
298c79ed194SVladimir Ananiev /* MTD Intel StrataFlash - old flashes */
299c79ed194SVladimir Ananiev static struct resource sx1_old_flash_resource[] = {
300c79ed194SVladimir Ananiev 	[0] = {
301c79ed194SVladimir Ananiev 		.start	= OMAP_CS0_PHYS,	/* Physical */
302c79ed194SVladimir Ananiev 		.end	= OMAP_CS0_PHYS + SZ_16M - 1,,
303c79ed194SVladimir Ananiev 		.flags	= IORESOURCE_MEM,
304c79ed194SVladimir Ananiev 	},
305c79ed194SVladimir Ananiev 	[1] = {
306c79ed194SVladimir Ananiev 		.start	= OMAP_CS1_PHYS,
307c79ed194SVladimir Ananiev 		.end	= OMAP_CS1_PHYS + SZ_8M - 1,
308c79ed194SVladimir Ananiev 		.flags	= IORESOURCE_MEM,
309c79ed194SVladimir Ananiev 	},
310c79ed194SVladimir Ananiev };
311c79ed194SVladimir Ananiev 
312c79ed194SVladimir Ananiev static struct platform_device sx1_flash_device = {
313c79ed194SVladimir Ananiev 	.name		= "omapflash",
314c79ed194SVladimir Ananiev 	.id		= 0,
315c79ed194SVladimir Ananiev 	.dev		= {
316c79ed194SVladimir Ananiev 		.platform_data	= &sx1_flash_data,
317c79ed194SVladimir Ananiev 	},
318c79ed194SVladimir Ananiev 	.num_resources	= 2,
319c79ed194SVladimir Ananiev 	.resource	= &sx1_old_flash_resource,
320c79ed194SVladimir Ananiev };
321c79ed194SVladimir Ananiev #else
322c79ed194SVladimir Ananiev /* MTD Intel 4000 flash - new flashes */
323c79ed194SVladimir Ananiev static struct resource sx1_new_flash_resource = {
324c79ed194SVladimir Ananiev 	.start		= OMAP_CS0_PHYS,
325c79ed194SVladimir Ananiev 	.end		= OMAP_CS0_PHYS + SZ_32M - 1,
326c79ed194SVladimir Ananiev 	.flags		= IORESOURCE_MEM,
327c79ed194SVladimir Ananiev };
328c79ed194SVladimir Ananiev 
329c79ed194SVladimir Ananiev static struct platform_device sx1_flash_device = {
330c79ed194SVladimir Ananiev 	.name		= "omapflash",
331c79ed194SVladimir Ananiev 	.id		= 0,
332c79ed194SVladimir Ananiev 	.dev		= {
333c79ed194SVladimir Ananiev 		.platform_data	= &sx1_flash_data,
334c79ed194SVladimir Ananiev 	},
335c79ed194SVladimir Ananiev 	.num_resources	= 1,
336c79ed194SVladimir Ananiev 	.resource	= &sx1_new_flash_resource,
337c79ed194SVladimir Ananiev };
338c79ed194SVladimir Ananiev #endif
339c79ed194SVladimir Ananiev 
340c79ed194SVladimir Ananiev /*----------- USB -------------------------*/
341c79ed194SVladimir Ananiev 
342c79ed194SVladimir Ananiev static struct omap_usb_config sx1_usb_config __initdata = {
343c79ed194SVladimir Ananiev 	.otg		= 0,
344c79ed194SVladimir Ananiev 	.register_dev	= 1,
345c79ed194SVladimir Ananiev 	.register_host	= 0,
346c79ed194SVladimir Ananiev 	.hmc_mode	= 0,
347c79ed194SVladimir Ananiev 	.pins[0]	= 2,
348c79ed194SVladimir Ananiev 	.pins[1]	= 0,
349c79ed194SVladimir Ananiev 	.pins[2]	= 0,
350c79ed194SVladimir Ananiev };
351c79ed194SVladimir Ananiev 
352c79ed194SVladimir Ananiev /*----------- LCD -------------------------*/
353c79ed194SVladimir Ananiev 
354c79ed194SVladimir Ananiev static struct platform_device sx1_lcd_device = {
355c79ed194SVladimir Ananiev 	.name		= "lcd_sx1",
356c79ed194SVladimir Ananiev 	.id		= -1,
357c79ed194SVladimir Ananiev };
358c79ed194SVladimir Ananiev 
359c79ed194SVladimir Ananiev static struct omap_lcd_config sx1_lcd_config __initdata = {
360c79ed194SVladimir Ananiev 	.ctrl_name	= "internal",
361c79ed194SVladimir Ananiev };
362c79ed194SVladimir Ananiev 
363c79ed194SVladimir Ananiev /*-----------------------------------------*/
364c79ed194SVladimir Ananiev static struct platform_device *sx1_devices[] __initdata = {
365c79ed194SVladimir Ananiev 	&sx1_flash_device,
366c79ed194SVladimir Ananiev 	&sx1_kp_device,
367c79ed194SVladimir Ananiev 	&sx1_lcd_device,
368c79ed194SVladimir Ananiev 	&sx1_irda_device,
369c79ed194SVladimir Ananiev };
370c79ed194SVladimir Ananiev /*-----------------------------------------*/
371c79ed194SVladimir Ananiev 
372e27a93a9STony Lindgren static struct omap_board_config_kernel sx1_config[] __initdata = {
373c79ed194SVladimir Ananiev 	{ OMAP_TAG_LCD,	&sx1_lcd_config },
374c79ed194SVladimir Ananiev };
375e27a93a9STony Lindgren 
376c79ed194SVladimir Ananiev /*-----------------------------------------*/
377e27a93a9STony Lindgren 
378c79ed194SVladimir Ananiev static void __init omap_sx1_init(void)
379c79ed194SVladimir Ananiev {
380c79ed194SVladimir Ananiev 	platform_add_devices(sx1_devices, ARRAY_SIZE(sx1_devices));
381c79ed194SVladimir Ananiev 
382c79ed194SVladimir Ananiev 	omap_board_config = sx1_config;
383c79ed194SVladimir Ananiev 	omap_board_config_size = ARRAY_SIZE(sx1_config);
384c79ed194SVladimir Ananiev 	omap_serial_init();
3851ed16a86SJarkko Nikula 	omap_register_i2c_bus(1, 100, NULL, 0);
386b0b5aa3fSFelipe Balbi 	omap_usb_init(&sx1_usb_config);
387087c5030SCarlos Eduardo Aguiar 	sx1_mmc_init();
388c79ed194SVladimir Ananiev 
389c79ed194SVladimir Ananiev 	/* turn on USB power */
390c79ed194SVladimir Ananiev 	/* sx1_setusbpower(1); cant do it here because i2c is not ready */
39173069e38SJarkko Nikula 	gpio_request(1, "A_IRDA_OFF");
39273069e38SJarkko Nikula 	gpio_request(11, "A_SWITCH");
39373069e38SJarkko Nikula 	gpio_request(15, "A_USB_ON");
394e918edf7SDavid Brownell 	gpio_direction_output(1, 1);	/*A_IRDA_OFF = 1 */
395e918edf7SDavid Brownell 	gpio_direction_output(11, 0);	/*A_SWITCH = 0 */
396e918edf7SDavid Brownell 	gpio_direction_output(15, 0);	/*A_USB_ON = 0 */
397c79ed194SVladimir Ananiev }
398c79ed194SVladimir Ananiev /*----------------------------------------*/
399c79ed194SVladimir Ananiev static void __init omap_sx1_init_irq(void)
400c79ed194SVladimir Ananiev {
401c79ed194SVladimir Ananiev 	omap1_init_common_hw();
402c79ed194SVladimir Ananiev 	omap_init_irq();
403c79ed194SVladimir Ananiev 	omap_gpio_init();
404c79ed194SVladimir Ananiev }
405c79ed194SVladimir Ananiev /*----------------------------------------*/
406c79ed194SVladimir Ananiev 
407c79ed194SVladimir Ananiev static void __init omap_sx1_map_io(void)
408c79ed194SVladimir Ananiev {
409c79ed194SVladimir Ananiev 	omap1_map_common_io();
410c79ed194SVladimir Ananiev }
411c79ed194SVladimir Ananiev 
412c79ed194SVladimir Ananiev MACHINE_START(SX1, "OMAP310 based Siemens SX1")
413c79ed194SVladimir Ananiev 	.phys_io	= 0xfff00000,
414c79ed194SVladimir Ananiev 	.io_pg_offst	= ((0xfef00000) >> 18) & 0xfffc,
415c79ed194SVladimir Ananiev 	.boot_params	= 0x10000100,
416c79ed194SVladimir Ananiev 	.map_io		= omap_sx1_map_io,
417c79ed194SVladimir Ananiev 	.init_irq		= omap_sx1_init_irq,
418c79ed194SVladimir Ananiev 	.init_machine	= omap_sx1_init,
419c79ed194SVladimir Ananiev 	.timer		= &omap_timer,
420c79ed194SVladimir Ananiev MACHINE_END
421