xref: /linux/arch/arm/mach-omap1/board-sx1.c (revision ddba6c7f7ec6a82ccbce4126d615e73e00b4be12)
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 */
172f8163baSRussell King #include <linux/gpio.h>
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>
25561b036aSLadislav Michl #include <linux/mtd/physmap.h>
26c79ed194SVladimir Ananiev #include <linux/types.h>
27c79ed194SVladimir Ananiev #include <linux/i2c.h>
28c79ed194SVladimir Ananiev #include <linux/errno.h>
29dc28094bSPaul Gortmaker #include <linux/export.h>
30*ddba6c7fSTomi Valkeinen #include <linux/omapfb.h>
31c79ed194SVladimir Ananiev 
32a09e64fbSRussell King #include <mach/hardware.h>
33c79ed194SVladimir Ananiev #include <asm/mach-types.h>
34c79ed194SVladimir Ananiev #include <asm/mach/arch.h>
35c79ed194SVladimir Ananiev #include <asm/mach/map.h>
36c79ed194SVladimir Ananiev 
37561b036aSLadislav Michl #include <plat/flash.h>
38ce491cf8STony Lindgren #include <plat/mux.h>
39ce491cf8STony Lindgren #include <plat/dma.h>
40ce491cf8STony Lindgren #include <plat/irda.h>
41ce491cf8STony Lindgren #include <plat/usb.h>
42ce491cf8STony Lindgren #include <plat/tc.h>
43ce491cf8STony Lindgren #include <plat/board.h>
444e65331cSTony Lindgren #include "common.h"
45ce491cf8STony Lindgren #include <plat/keypad.h>
46ce491cf8STony Lindgren #include <plat/board-sx1.h>
47c79ed194SVladimir Ananiev 
48c79ed194SVladimir Ananiev /* Write to I2C device */
49087c5030SCarlos Eduardo Aguiar int sx1_i2c_write_byte(u8 devaddr, u8 regoffset, u8 value)
50c79ed194SVladimir Ananiev {
51c79ed194SVladimir Ananiev 	struct i2c_adapter *adap;
52c79ed194SVladimir Ananiev 	int err;
53c79ed194SVladimir Ananiev 	struct i2c_msg msg[1];
54c79ed194SVladimir Ananiev 	unsigned char data[2];
55c79ed194SVladimir Ananiev 
56c79ed194SVladimir Ananiev 	adap = i2c_get_adapter(0);
57c79ed194SVladimir Ananiev 	if (!adap)
58c79ed194SVladimir Ananiev 		return -ENODEV;
59c79ed194SVladimir Ananiev 	msg->addr = devaddr;	/* I2C address of chip */
60c79ed194SVladimir Ananiev 	msg->flags = 0;
61c79ed194SVladimir Ananiev 	msg->len = 2;
62c79ed194SVladimir Ananiev 	msg->buf = data;
63c79ed194SVladimir Ananiev 	data[0] = regoffset;	/* register num */
64c79ed194SVladimir Ananiev 	data[1] = value;		/* register data */
65c79ed194SVladimir Ananiev 	err = i2c_transfer(adap, msg, 1);
66c9a2c46dSJean Delvare 	i2c_put_adapter(adap);
67c79ed194SVladimir Ananiev 	if (err >= 0)
68c79ed194SVladimir Ananiev 		return 0;
69c79ed194SVladimir Ananiev 	return err;
70c79ed194SVladimir Ananiev }
71c79ed194SVladimir Ananiev 
72c79ed194SVladimir Ananiev /* Read from I2C device */
73087c5030SCarlos Eduardo Aguiar int sx1_i2c_read_byte(u8 devaddr, u8 regoffset, u8 *value)
74c79ed194SVladimir Ananiev {
75c79ed194SVladimir Ananiev 	struct i2c_adapter *adap;
76c79ed194SVladimir Ananiev 	int err;
77c79ed194SVladimir Ananiev 	struct i2c_msg msg[1];
78c79ed194SVladimir Ananiev 	unsigned char data[2];
79c79ed194SVladimir Ananiev 
80c79ed194SVladimir Ananiev 	adap = i2c_get_adapter(0);
81c79ed194SVladimir Ananiev 	if (!adap)
82c79ed194SVladimir Ananiev 		return -ENODEV;
83c79ed194SVladimir Ananiev 
84c79ed194SVladimir Ananiev 	msg->addr = devaddr;	/* I2C address of chip */
85c79ed194SVladimir Ananiev 	msg->flags = 0;
86c79ed194SVladimir Ananiev 	msg->len = 1;
87c79ed194SVladimir Ananiev 	msg->buf = data;
88c79ed194SVladimir Ananiev 	data[0] = regoffset;	/* register num */
89c79ed194SVladimir Ananiev 	err = i2c_transfer(adap, msg, 1);
90c79ed194SVladimir Ananiev 
91c79ed194SVladimir Ananiev 	msg->addr = devaddr;	/* I2C address */
92c79ed194SVladimir Ananiev 	msg->flags = I2C_M_RD;
93c79ed194SVladimir Ananiev 	msg->len = 1;
94c79ed194SVladimir Ananiev 	msg->buf = data;
95c79ed194SVladimir Ananiev 	err = i2c_transfer(adap, msg, 1);
96c79ed194SVladimir Ananiev 	*value = data[0];
97c9a2c46dSJean Delvare 	i2c_put_adapter(adap);
98c79ed194SVladimir Ananiev 
99c79ed194SVladimir Ananiev 	if (err >= 0)
100c79ed194SVladimir Ananiev 		return 0;
101c79ed194SVladimir Ananiev 	return err;
102c79ed194SVladimir Ananiev }
103c79ed194SVladimir Ananiev /* set keyboard backlight intensity */
104c79ed194SVladimir Ananiev int sx1_setkeylight(u8 keylight)
105c79ed194SVladimir Ananiev {
106c79ed194SVladimir Ananiev 	if (keylight > SOFIA_MAX_LIGHT_VAL)
107c79ed194SVladimir Ananiev 		keylight = SOFIA_MAX_LIGHT_VAL;
108087c5030SCarlos Eduardo Aguiar 	return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_KEYLIGHT_REG, keylight);
109c79ed194SVladimir Ananiev }
110c79ed194SVladimir Ananiev /* get current keylight intensity */
111c79ed194SVladimir Ananiev int sx1_getkeylight(u8 * keylight)
112c79ed194SVladimir Ananiev {
113087c5030SCarlos Eduardo Aguiar 	return sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_KEYLIGHT_REG, keylight);
114c79ed194SVladimir Ananiev }
115c79ed194SVladimir Ananiev /* set LCD backlight intensity */
116c79ed194SVladimir Ananiev int sx1_setbacklight(u8 backlight)
117c79ed194SVladimir Ananiev {
118c79ed194SVladimir Ananiev 	if (backlight > SOFIA_MAX_LIGHT_VAL)
119c79ed194SVladimir Ananiev 		backlight = SOFIA_MAX_LIGHT_VAL;
120087c5030SCarlos Eduardo Aguiar 	return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_BACKLIGHT_REG,
121087c5030SCarlos Eduardo Aguiar 				  backlight);
122c79ed194SVladimir Ananiev }
123c79ed194SVladimir Ananiev /* get current LCD backlight intensity */
124c79ed194SVladimir Ananiev int sx1_getbacklight (u8 * backlight)
125c79ed194SVladimir Ananiev {
126087c5030SCarlos Eduardo Aguiar 	return sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_BACKLIGHT_REG,
127087c5030SCarlos Eduardo Aguiar 				 backlight);
128c79ed194SVladimir Ananiev }
129c79ed194SVladimir Ananiev /* set LCD backlight power on/off */
130c79ed194SVladimir Ananiev int sx1_setmmipower(u8 onoff)
131c79ed194SVladimir Ananiev {
132c79ed194SVladimir Ananiev 	int err;
133c79ed194SVladimir Ananiev 	u8 dat = 0;
134087c5030SCarlos Eduardo Aguiar 	err = sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat);
135c79ed194SVladimir Ananiev 	if (err < 0)
136c79ed194SVladimir Ananiev 		return err;
137c79ed194SVladimir Ananiev 	if (onoff)
138c79ed194SVladimir Ananiev 		dat |= SOFIA_MMILIGHT_POWER;
139c79ed194SVladimir Ananiev 	else
140c79ed194SVladimir Ananiev 		dat &= ~SOFIA_MMILIGHT_POWER;
141087c5030SCarlos Eduardo Aguiar 	return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat);
142c79ed194SVladimir Ananiev }
143087c5030SCarlos Eduardo Aguiar 
144c79ed194SVladimir Ananiev /* set USB power on/off */
145c79ed194SVladimir Ananiev int sx1_setusbpower(u8 onoff)
146c79ed194SVladimir Ananiev {
147c79ed194SVladimir Ananiev 	int err;
148c79ed194SVladimir Ananiev 	u8 dat = 0;
149087c5030SCarlos Eduardo Aguiar 	err = sx1_i2c_read_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, &dat);
150c79ed194SVladimir Ananiev 	if (err < 0)
151c79ed194SVladimir Ananiev 		return err;
152c79ed194SVladimir Ananiev 	if (onoff)
153c79ed194SVladimir Ananiev 		dat |= SOFIA_USB_POWER;
154c79ed194SVladimir Ananiev 	else
155c79ed194SVladimir Ananiev 		dat &= ~SOFIA_USB_POWER;
156087c5030SCarlos Eduardo Aguiar 	return sx1_i2c_write_byte(SOFIA_I2C_ADDR, SOFIA_POWER1_REG, dat);
157c79ed194SVladimir Ananiev }
158c79ed194SVladimir Ananiev 
159c79ed194SVladimir Ananiev EXPORT_SYMBOL(sx1_setkeylight);
160c79ed194SVladimir Ananiev EXPORT_SYMBOL(sx1_getkeylight);
161c79ed194SVladimir Ananiev EXPORT_SYMBOL(sx1_setbacklight);
162c79ed194SVladimir Ananiev EXPORT_SYMBOL(sx1_getbacklight);
163c79ed194SVladimir Ananiev EXPORT_SYMBOL(sx1_setmmipower);
164c79ed194SVladimir Ananiev EXPORT_SYMBOL(sx1_setusbpower);
165c79ed194SVladimir Ananiev 
166c79ed194SVladimir Ananiev /*----------- Keypad -------------------------*/
167c79ed194SVladimir Ananiev 
168da1f026bSJanusz Krzysztofik static const unsigned int sx1_keymap[] = {
169da1f026bSJanusz Krzysztofik 	KEY(3, 5, GROUP_0 | 117), /* camera Qt::Key_F17 */
170da1f026bSJanusz Krzysztofik 	KEY(4, 0, GROUP_0 | 114), /* voice memo Qt::Key_F14 */
171da1f026bSJanusz Krzysztofik 	KEY(4, 1, GROUP_2 | 114), /* voice memo */
172da1f026bSJanusz Krzysztofik 	KEY(4, 2, GROUP_3 | 114), /* voice memo */
173c79ed194SVladimir Ananiev 	KEY(0, 0, GROUP_1 | KEY_F12),	/* red button Qt::Key_Hangup */
174da1f026bSJanusz Krzysztofik 	KEY(3, 4, GROUP_1 | KEY_LEFT),
175da1f026bSJanusz Krzysztofik 	KEY(3, 2, GROUP_1 | KEY_DOWN),
176da1f026bSJanusz Krzysztofik 	KEY(3, 1, GROUP_1 | KEY_RIGHT),
177da1f026bSJanusz Krzysztofik 	KEY(3, 0, GROUP_1 | KEY_UP),
178c79ed194SVladimir Ananiev 	KEY(3, 3, GROUP_1 | KEY_POWER), /* joystick press or Qt::Key_Select */
179da1f026bSJanusz Krzysztofik 	KEY(0, 5, GROUP_1 | KEY_1),
180da1f026bSJanusz Krzysztofik 	KEY(0, 4, GROUP_1 | KEY_2),
181da1f026bSJanusz Krzysztofik 	KEY(0, 3, GROUP_1 | KEY_3),
182da1f026bSJanusz Krzysztofik 	KEY(4, 3, GROUP_1 | KEY_4),
183c79ed194SVladimir Ananiev 	KEY(4, 4, GROUP_1 | KEY_5),
184da1f026bSJanusz Krzysztofik 	KEY(4, 5, GROUP_1 | KEY_KPASTERISK),/* "*" */
185da1f026bSJanusz Krzysztofik 	KEY(1, 4, GROUP_1 | KEY_6),
186da1f026bSJanusz Krzysztofik 	KEY(1, 5, GROUP_1 | KEY_7),
187da1f026bSJanusz Krzysztofik 	KEY(1, 3, GROUP_1 | KEY_8),
188da1f026bSJanusz Krzysztofik 	KEY(2, 3, GROUP_1 | KEY_9),
189da1f026bSJanusz Krzysztofik 	KEY(2, 5, GROUP_1 | KEY_0),
190da1f026bSJanusz Krzysztofik 	KEY(2, 4, GROUP_1 | 113), /* # F13 Toggle input method Qt::Key_F13 */
191da1f026bSJanusz Krzysztofik 	KEY(1, 0, GROUP_1 | KEY_F11),	/* green button Qt::Key_Call */
192da1f026bSJanusz Krzysztofik 	KEY(2, 1, GROUP_1 | KEY_YEN),	/* left soft Qt::Key_Context1 */
193c79ed194SVladimir Ananiev 	KEY(2, 2, GROUP_1 | KEY_F8),	/* right soft Qt::Key_Back */
194da1f026bSJanusz Krzysztofik 	KEY(1, 2, GROUP_1 | KEY_LEFTSHIFT), /* shift */
195c79ed194SVladimir Ananiev 	KEY(1, 1, GROUP_1 | KEY_BACKSPACE), /* C (clear) */
196da1f026bSJanusz Krzysztofik 	KEY(2, 0, GROUP_1 | KEY_F7),	/* menu Qt::Key_Menu */
197c79ed194SVladimir Ananiev };
198c79ed194SVladimir Ananiev 
199c79ed194SVladimir Ananiev static struct resource sx1_kp_resources[] = {
200c79ed194SVladimir Ananiev 	[0] = {
201c79ed194SVladimir Ananiev 		.start	= INT_KEYBOARD,
202c79ed194SVladimir Ananiev 		.end	= INT_KEYBOARD,
203c79ed194SVladimir Ananiev 		.flags	= IORESOURCE_IRQ,
204c79ed194SVladimir Ananiev 	},
205c79ed194SVladimir Ananiev };
206c79ed194SVladimir Ananiev 
207da1f026bSJanusz Krzysztofik static const struct matrix_keymap_data sx1_keymap_data = {
208da1f026bSJanusz Krzysztofik 	.keymap		= sx1_keymap,
209da1f026bSJanusz Krzysztofik 	.keymap_size	= ARRAY_SIZE(sx1_keymap),
210da1f026bSJanusz Krzysztofik };
211da1f026bSJanusz Krzysztofik 
212c79ed194SVladimir Ananiev static struct omap_kp_platform_data sx1_kp_data = {
213c79ed194SVladimir Ananiev 	.rows		= 6,
214c79ed194SVladimir Ananiev 	.cols		= 6,
215da1f026bSJanusz Krzysztofik 	.keymap_data	= &sx1_keymap_data,
216c79ed194SVladimir Ananiev 	.delay	= 80,
217c79ed194SVladimir Ananiev };
218c79ed194SVladimir Ananiev 
219c79ed194SVladimir Ananiev static struct platform_device sx1_kp_device = {
220c79ed194SVladimir Ananiev 	.name		= "omap-keypad",
221c79ed194SVladimir Ananiev 	.id		= -1,
222c79ed194SVladimir Ananiev 	.dev		= {
223c79ed194SVladimir Ananiev 		.platform_data = &sx1_kp_data,
224c79ed194SVladimir Ananiev 	},
225c79ed194SVladimir Ananiev 	.num_resources	= ARRAY_SIZE(sx1_kp_resources),
226c79ed194SVladimir Ananiev 	.resource	= sx1_kp_resources,
227c79ed194SVladimir Ananiev };
228c79ed194SVladimir Ananiev 
229c79ed194SVladimir Ananiev /*----------- IRDA -------------------------*/
230c79ed194SVladimir Ananiev 
231c79ed194SVladimir Ananiev static struct omap_irda_config sx1_irda_data = {
232c79ed194SVladimir Ananiev 	.transceiver_cap	= IR_SIRMODE,
233c79ed194SVladimir Ananiev 	.rx_channel		= OMAP_DMA_UART3_RX,
234c79ed194SVladimir Ananiev 	.tx_channel		= OMAP_DMA_UART3_TX,
235c79ed194SVladimir Ananiev 	.dest_start		= UART3_THR,
236c79ed194SVladimir Ananiev 	.src_start		= UART3_RHR,
237c79ed194SVladimir Ananiev 	.tx_trigger		= 0,
238c79ed194SVladimir Ananiev 	.rx_trigger		= 0,
239c79ed194SVladimir Ananiev };
240c79ed194SVladimir Ananiev 
241c79ed194SVladimir Ananiev static struct resource sx1_irda_resources[] = {
242c79ed194SVladimir Ananiev 	[0] = {
243c79ed194SVladimir Ananiev 		.start	= INT_UART3,
244c79ed194SVladimir Ananiev 		.end	= INT_UART3,
245c79ed194SVladimir Ananiev 		.flags	= IORESOURCE_IRQ,
246c79ed194SVladimir Ananiev 	},
247c79ed194SVladimir Ananiev };
248c79ed194SVladimir Ananiev 
249c79ed194SVladimir Ananiev static u64 irda_dmamask = 0xffffffff;
250c79ed194SVladimir Ananiev 
251c79ed194SVladimir Ananiev static struct platform_device sx1_irda_device = {
252c79ed194SVladimir Ananiev 	.name		= "omapirda",
253c79ed194SVladimir Ananiev 	.id		= 0,
254c79ed194SVladimir Ananiev 	.dev		= {
255c79ed194SVladimir Ananiev 		.platform_data	= &sx1_irda_data,
256c79ed194SVladimir Ananiev 		.dma_mask	= &irda_dmamask,
257c79ed194SVladimir Ananiev 	},
258c79ed194SVladimir Ananiev 	.num_resources	= ARRAY_SIZE(sx1_irda_resources),
259c79ed194SVladimir Ananiev 	.resource	= sx1_irda_resources,
260c79ed194SVladimir Ananiev };
261c79ed194SVladimir Ananiev 
262c79ed194SVladimir Ananiev /*----------- MTD -------------------------*/
263c79ed194SVladimir Ananiev 
264c79ed194SVladimir Ananiev static struct mtd_partition sx1_partitions[] = {
265c79ed194SVladimir Ananiev 	/* bootloader (U-Boot, etc) in first sector */
266c79ed194SVladimir Ananiev 	{
267c79ed194SVladimir Ananiev 		.name		= "bootloader",
268c79ed194SVladimir Ananiev 		.offset		= 0x01800000,
269c79ed194SVladimir Ananiev 		.size		= SZ_128K,
270c79ed194SVladimir Ananiev 		.mask_flags	= MTD_WRITEABLE, /* force read-only */
271c79ed194SVladimir Ananiev 	},
272c79ed194SVladimir Ananiev 	/* bootloader params in the next sector */
273c79ed194SVladimir Ananiev 	{
274c79ed194SVladimir Ananiev 		.name		= "params",
275c79ed194SVladimir Ananiev 		.offset		= MTDPART_OFS_APPEND,
276c79ed194SVladimir Ananiev 		.size		= SZ_128K,
277c79ed194SVladimir Ananiev 		.mask_flags	= 0,
278c79ed194SVladimir Ananiev 	},
279c79ed194SVladimir Ananiev 	/* kernel */
280c79ed194SVladimir Ananiev 	{
281c79ed194SVladimir Ananiev 		.name		= "kernel",
282c79ed194SVladimir Ananiev 		.offset		= MTDPART_OFS_APPEND,
283c79ed194SVladimir Ananiev 		.size		= SZ_2M - 2 * SZ_128K,
284c79ed194SVladimir Ananiev 		.mask_flags	= 0
285c79ed194SVladimir Ananiev 	},
286c79ed194SVladimir Ananiev 	/* file system */
287c79ed194SVladimir Ananiev 	{
288c79ed194SVladimir Ananiev 		.name		= "filesystem",
289c79ed194SVladimir Ananiev 		.offset		= MTDPART_OFS_APPEND,
290c79ed194SVladimir Ananiev 		.size		= MTDPART_SIZ_FULL,
291c79ed194SVladimir Ananiev 		.mask_flags	= 0
292c79ed194SVladimir Ananiev 	}
293c79ed194SVladimir Ananiev };
294c79ed194SVladimir Ananiev 
295561b036aSLadislav Michl static struct physmap_flash_data sx1_flash_data = {
296c79ed194SVladimir Ananiev 	.width		= 2,
297561b036aSLadislav Michl 	.set_vpp	= omap1_set_vpp,
298c79ed194SVladimir Ananiev 	.parts		= sx1_partitions,
299c79ed194SVladimir Ananiev 	.nr_parts	= ARRAY_SIZE(sx1_partitions),
300c79ed194SVladimir Ananiev };
301c79ed194SVladimir Ananiev 
302c79ed194SVladimir Ananiev #ifdef CONFIG_SX1_OLD_FLASH
303c79ed194SVladimir Ananiev /* MTD Intel StrataFlash - old flashes */
304c79ed194SVladimir Ananiev static struct resource sx1_old_flash_resource[] = {
305c79ed194SVladimir Ananiev 	[0] = {
306c79ed194SVladimir Ananiev 		.start	= OMAP_CS0_PHYS,	/* Physical */
307c79ed194SVladimir Ananiev 		.end	= OMAP_CS0_PHYS + SZ_16M - 1,,
308c79ed194SVladimir Ananiev 		.flags	= IORESOURCE_MEM,
309c79ed194SVladimir Ananiev 	},
310c79ed194SVladimir Ananiev 	[1] = {
311c79ed194SVladimir Ananiev 		.start	= OMAP_CS1_PHYS,
312c79ed194SVladimir Ananiev 		.end	= OMAP_CS1_PHYS + SZ_8M - 1,
313c79ed194SVladimir Ananiev 		.flags	= IORESOURCE_MEM,
314c79ed194SVladimir Ananiev 	},
315c79ed194SVladimir Ananiev };
316c79ed194SVladimir Ananiev 
317c79ed194SVladimir Ananiev static struct platform_device sx1_flash_device = {
318561b036aSLadislav Michl 	.name		= "physmap-flash",
319c79ed194SVladimir Ananiev 	.id		= 0,
320c79ed194SVladimir Ananiev 	.dev		= {
321c79ed194SVladimir Ananiev 		.platform_data	= &sx1_flash_data,
322c79ed194SVladimir Ananiev 	},
323c79ed194SVladimir Ananiev 	.num_resources	= 2,
324c79ed194SVladimir Ananiev 	.resource	= &sx1_old_flash_resource,
325c79ed194SVladimir Ananiev };
326c79ed194SVladimir Ananiev #else
327c79ed194SVladimir Ananiev /* MTD Intel 4000 flash - new flashes */
328c79ed194SVladimir Ananiev static struct resource sx1_new_flash_resource = {
329c79ed194SVladimir Ananiev 	.start		= OMAP_CS0_PHYS,
330c79ed194SVladimir Ananiev 	.end		= OMAP_CS0_PHYS + SZ_32M - 1,
331c79ed194SVladimir Ananiev 	.flags		= IORESOURCE_MEM,
332c79ed194SVladimir Ananiev };
333c79ed194SVladimir Ananiev 
334c79ed194SVladimir Ananiev static struct platform_device sx1_flash_device = {
335561b036aSLadislav Michl 	.name		= "physmap-flash",
336c79ed194SVladimir Ananiev 	.id		= 0,
337c79ed194SVladimir Ananiev 	.dev		= {
338c79ed194SVladimir Ananiev 		.platform_data	= &sx1_flash_data,
339c79ed194SVladimir Ananiev 	},
340c79ed194SVladimir Ananiev 	.num_resources	= 1,
341c79ed194SVladimir Ananiev 	.resource	= &sx1_new_flash_resource,
342c79ed194SVladimir Ananiev };
343c79ed194SVladimir Ananiev #endif
344c79ed194SVladimir Ananiev 
345c79ed194SVladimir Ananiev /*----------- USB -------------------------*/
346c79ed194SVladimir Ananiev 
347c79ed194SVladimir Ananiev static struct omap_usb_config sx1_usb_config __initdata = {
348c79ed194SVladimir Ananiev 	.otg		= 0,
349c79ed194SVladimir Ananiev 	.register_dev	= 1,
350c79ed194SVladimir Ananiev 	.register_host	= 0,
351c79ed194SVladimir Ananiev 	.hmc_mode	= 0,
352c79ed194SVladimir Ananiev 	.pins[0]	= 2,
353c79ed194SVladimir Ananiev 	.pins[1]	= 0,
354c79ed194SVladimir Ananiev 	.pins[2]	= 0,
355c79ed194SVladimir Ananiev };
356c79ed194SVladimir Ananiev 
357c79ed194SVladimir Ananiev /*----------- LCD -------------------------*/
358c79ed194SVladimir Ananiev 
359c79ed194SVladimir Ananiev static struct platform_device sx1_lcd_device = {
360c79ed194SVladimir Ananiev 	.name		= "lcd_sx1",
361c79ed194SVladimir Ananiev 	.id		= -1,
362c79ed194SVladimir Ananiev };
363c79ed194SVladimir Ananiev 
364c79ed194SVladimir Ananiev static struct omap_lcd_config sx1_lcd_config __initdata = {
365c79ed194SVladimir Ananiev 	.ctrl_name	= "internal",
366c79ed194SVladimir Ananiev };
367c79ed194SVladimir Ananiev 
368c79ed194SVladimir Ananiev /*-----------------------------------------*/
369c79ed194SVladimir Ananiev static struct platform_device *sx1_devices[] __initdata = {
370c79ed194SVladimir Ananiev 	&sx1_flash_device,
371c79ed194SVladimir Ananiev 	&sx1_kp_device,
372c79ed194SVladimir Ananiev 	&sx1_lcd_device,
373c79ed194SVladimir Ananiev 	&sx1_irda_device,
374c79ed194SVladimir Ananiev };
375e27a93a9STony Lindgren 
376c79ed194SVladimir Ananiev /*-----------------------------------------*/
377e27a93a9STony Lindgren 
378c79ed194SVladimir Ananiev static void __init omap_sx1_init(void)
379c79ed194SVladimir Ananiev {
380c33da3a8SJanusz Krzysztofik 	/* mux pins for uarts */
381c33da3a8SJanusz Krzysztofik 	omap_cfg_reg(UART1_TX);
382c33da3a8SJanusz Krzysztofik 	omap_cfg_reg(UART1_RTS);
383c33da3a8SJanusz Krzysztofik 	omap_cfg_reg(UART2_TX);
384c33da3a8SJanusz Krzysztofik 	omap_cfg_reg(UART2_RTS);
385c33da3a8SJanusz Krzysztofik 	omap_cfg_reg(UART3_TX);
386c33da3a8SJanusz Krzysztofik 	omap_cfg_reg(UART3_RX);
387c33da3a8SJanusz Krzysztofik 
388c79ed194SVladimir Ananiev 	platform_add_devices(sx1_devices, ARRAY_SIZE(sx1_devices));
389c79ed194SVladimir Ananiev 
390c79ed194SVladimir Ananiev 	omap_serial_init();
3911ed16a86SJarkko Nikula 	omap_register_i2c_bus(1, 100, NULL, 0);
392dd0cdd88STony Lindgren 	omap1_usb_init(&sx1_usb_config);
393087c5030SCarlos Eduardo Aguiar 	sx1_mmc_init();
394c79ed194SVladimir Ananiev 
395c79ed194SVladimir Ananiev 	/* turn on USB power */
39625985edcSLucas De Marchi 	/* sx1_setusbpower(1); can't do it here because i2c is not ready */
39773069e38SJarkko Nikula 	gpio_request(1, "A_IRDA_OFF");
39873069e38SJarkko Nikula 	gpio_request(11, "A_SWITCH");
39973069e38SJarkko Nikula 	gpio_request(15, "A_USB_ON");
400e918edf7SDavid Brownell 	gpio_direction_output(1, 1);	/*A_IRDA_OFF = 1 */
401e918edf7SDavid Brownell 	gpio_direction_output(11, 0);	/*A_SWITCH = 0 */
402e918edf7SDavid Brownell 	gpio_direction_output(15, 0);	/*A_USB_ON = 0 */
403*ddba6c7fSTomi Valkeinen 
404*ddba6c7fSTomi Valkeinen 	omapfb_set_lcd_config(&sx1_lcd_config);
405c79ed194SVladimir Ananiev }
406c79ed194SVladimir Ananiev 
407c79ed194SVladimir Ananiev MACHINE_START(SX1, "OMAP310 based Siemens SX1")
408246e389dSNicolas Pitre 	.atag_offset	= 0x100,
4097b88e62fSTony Lindgren 	.map_io		= omap15xx_map_io,
4107b88e62fSTony Lindgren 	.init_early     = omap1_init_early,
41171ee7dadSRussell King 	.reserve	= omap_reserve,
4127b88e62fSTony Lindgren 	.init_irq	= omap1_init_irq,
413c79ed194SVladimir Ananiev 	.init_machine	= omap_sx1_init,
414e74984e4STony Lindgren 	.timer		= &omap1_timer,
415baa95883SRussell King 	.restart	= omap1_restart,
416c79ed194SVladimir Ananiev MACHINE_END
417