xref: /linux/arch/arm/mach-omap1/board-sx1.c (revision a09e64fbc0094e3073dbb09c3b4bfe4ab669244b)
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 
29*a09e64fbSRussell 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 
35*a09e64fbSRussell King #include <mach/gpio.h>
36*a09e64fbSRussell King #include <mach/mux.h>
37*a09e64fbSRussell King #include <mach/irda.h>
38*a09e64fbSRussell King #include <mach/usb.h>
39*a09e64fbSRussell King #include <mach/tc.h>
40*a09e64fbSRussell King #include <mach/board.h>
41*a09e64fbSRussell King #include <mach/common.h>
42*a09e64fbSRussell King #include <mach/mcbsp.h>
43*a09e64fbSRussell King #include <mach/omap-alsa.h>
44*a09e64fbSRussell King #include <mach/keypad.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 /*----------- McBSP & Sound -------------------------*/
258c79ed194SVladimir Ananiev 
259c79ed194SVladimir Ananiev /* Playback interface - McBSP1 */
260c79ed194SVladimir Ananiev static struct omap_mcbsp_reg_cfg mcbsp1_regs = {
261c79ed194SVladimir Ananiev 	.spcr2	= XINTM(3),	/* SPCR2=30 */
262c79ed194SVladimir Ananiev 	.spcr1	= RINTM(3),	/* SPCR1=30 */
263c79ed194SVladimir Ananiev 	.rcr2	= 0,	/* RCR2 =00 */
264c79ed194SVladimir Ananiev 	.rcr1	= RFRLEN1(1) | RWDLEN1(OMAP_MCBSP_WORD_16),	/* RCR1=140 */
265c79ed194SVladimir Ananiev 	.xcr2	= 0,	/* XCR2 = 0 */
266c79ed194SVladimir Ananiev 	.xcr1	= XFRLEN1(1) | XWDLEN1(OMAP_MCBSP_WORD_16),	/* XCR1 = 140 */
267c79ed194SVladimir Ananiev 	.srgr1	= FWID(15) | CLKGDV(12),	/* SRGR1=0f0c */
268c79ed194SVladimir Ananiev 	.srgr2	= FSGM | FPER(31),	/* SRGR2=101f */
269c79ed194SVladimir Ananiev 	.pcr0	= FSXM | FSRM | CLKXM | CLKRM | FSXP | FSRP | CLKXP | CLKRP,
270c79ed194SVladimir Ananiev 						/* PCR0 =0f0f */
271c79ed194SVladimir Ananiev };
272c79ed194SVladimir Ananiev 
273c79ed194SVladimir Ananiev static struct omap_alsa_codec_config sx1_alsa_config = {
274c79ed194SVladimir Ananiev 	.name			= "SX1 EGold",
275c79ed194SVladimir Ananiev 	.mcbsp_regs_alsa	= &mcbsp1_regs,
276c79ed194SVladimir Ananiev };
277c79ed194SVladimir Ananiev 
278c79ed194SVladimir Ananiev static struct platform_device sx1_mcbsp1_device = {
279c79ed194SVladimir Ananiev 	.name	= "omap_alsa_mcbsp",
280c79ed194SVladimir Ananiev 	.id	= 1,
281c79ed194SVladimir Ananiev 	.dev = {
282c79ed194SVladimir Ananiev 		.platform_data	= &sx1_alsa_config,
283c79ed194SVladimir Ananiev 	},
284c79ed194SVladimir Ananiev };
285c79ed194SVladimir Ananiev 
286c79ed194SVladimir Ananiev /*----------- MTD -------------------------*/
287c79ed194SVladimir Ananiev 
288c79ed194SVladimir Ananiev static struct mtd_partition sx1_partitions[] = {
289c79ed194SVladimir Ananiev 	/* bootloader (U-Boot, etc) in first sector */
290c79ed194SVladimir Ananiev 	{
291c79ed194SVladimir Ananiev 		.name		= "bootloader",
292c79ed194SVladimir Ananiev 		.offset		= 0x01800000,
293c79ed194SVladimir Ananiev 		.size		= SZ_128K,
294c79ed194SVladimir Ananiev 		.mask_flags	= MTD_WRITEABLE, /* force read-only */
295c79ed194SVladimir Ananiev 	},
296c79ed194SVladimir Ananiev 	/* bootloader params in the next sector */
297c79ed194SVladimir Ananiev 	{
298c79ed194SVladimir Ananiev 		.name		= "params",
299c79ed194SVladimir Ananiev 		.offset		= MTDPART_OFS_APPEND,
300c79ed194SVladimir Ananiev 		.size		= SZ_128K,
301c79ed194SVladimir Ananiev 		.mask_flags	= 0,
302c79ed194SVladimir Ananiev 	},
303c79ed194SVladimir Ananiev 	/* kernel */
304c79ed194SVladimir Ananiev 	{
305c79ed194SVladimir Ananiev 		.name		= "kernel",
306c79ed194SVladimir Ananiev 		.offset		= MTDPART_OFS_APPEND,
307c79ed194SVladimir Ananiev 		.size		= SZ_2M - 2 * SZ_128K,
308c79ed194SVladimir Ananiev 		.mask_flags	= 0
309c79ed194SVladimir Ananiev 	},
310c79ed194SVladimir Ananiev 	/* file system */
311c79ed194SVladimir Ananiev 	{
312c79ed194SVladimir Ananiev 		.name		= "filesystem",
313c79ed194SVladimir Ananiev 		.offset		= MTDPART_OFS_APPEND,
314c79ed194SVladimir Ananiev 		.size		= MTDPART_SIZ_FULL,
315c79ed194SVladimir Ananiev 		.mask_flags	= 0
316c79ed194SVladimir Ananiev 	}
317c79ed194SVladimir Ananiev };
318c79ed194SVladimir Ananiev 
319c79ed194SVladimir Ananiev static struct flash_platform_data sx1_flash_data = {
320c79ed194SVladimir Ananiev 	.map_name	= "cfi_probe",
321c79ed194SVladimir Ananiev 	.width		= 2,
322c79ed194SVladimir Ananiev 	.parts		= sx1_partitions,
323c79ed194SVladimir Ananiev 	.nr_parts	= ARRAY_SIZE(sx1_partitions),
324c79ed194SVladimir Ananiev };
325c79ed194SVladimir Ananiev 
326c79ed194SVladimir Ananiev #ifdef CONFIG_SX1_OLD_FLASH
327c79ed194SVladimir Ananiev /* MTD Intel StrataFlash - old flashes */
328c79ed194SVladimir Ananiev static struct resource sx1_old_flash_resource[] = {
329c79ed194SVladimir Ananiev 	[0] = {
330c79ed194SVladimir Ananiev 		.start	= OMAP_CS0_PHYS,	/* Physical */
331c79ed194SVladimir Ananiev 		.end	= OMAP_CS0_PHYS + SZ_16M - 1,,
332c79ed194SVladimir Ananiev 		.flags	= IORESOURCE_MEM,
333c79ed194SVladimir Ananiev 	},
334c79ed194SVladimir Ananiev 	[1] = {
335c79ed194SVladimir Ananiev 		.start	= OMAP_CS1_PHYS,
336c79ed194SVladimir Ananiev 		.end	= OMAP_CS1_PHYS + SZ_8M - 1,
337c79ed194SVladimir Ananiev 		.flags	= IORESOURCE_MEM,
338c79ed194SVladimir Ananiev 	},
339c79ed194SVladimir Ananiev };
340c79ed194SVladimir Ananiev 
341c79ed194SVladimir Ananiev static struct platform_device sx1_flash_device = {
342c79ed194SVladimir Ananiev 	.name		= "omapflash",
343c79ed194SVladimir Ananiev 	.id		= 0,
344c79ed194SVladimir Ananiev 	.dev		= {
345c79ed194SVladimir Ananiev 		.platform_data	= &sx1_flash_data,
346c79ed194SVladimir Ananiev 	},
347c79ed194SVladimir Ananiev 	.num_resources	= 2,
348c79ed194SVladimir Ananiev 	.resource	= &sx1_old_flash_resource,
349c79ed194SVladimir Ananiev };
350c79ed194SVladimir Ananiev #else
351c79ed194SVladimir Ananiev /* MTD Intel 4000 flash - new flashes */
352c79ed194SVladimir Ananiev static struct resource sx1_new_flash_resource = {
353c79ed194SVladimir Ananiev 	.start		= OMAP_CS0_PHYS,
354c79ed194SVladimir Ananiev 	.end		= OMAP_CS0_PHYS + SZ_32M - 1,
355c79ed194SVladimir Ananiev 	.flags		= IORESOURCE_MEM,
356c79ed194SVladimir Ananiev };
357c79ed194SVladimir Ananiev 
358c79ed194SVladimir Ananiev static struct platform_device sx1_flash_device = {
359c79ed194SVladimir Ananiev 	.name		= "omapflash",
360c79ed194SVladimir Ananiev 	.id		= 0,
361c79ed194SVladimir Ananiev 	.dev		= {
362c79ed194SVladimir Ananiev 		.platform_data	= &sx1_flash_data,
363c79ed194SVladimir Ananiev 	},
364c79ed194SVladimir Ananiev 	.num_resources	= 1,
365c79ed194SVladimir Ananiev 	.resource	= &sx1_new_flash_resource,
366c79ed194SVladimir Ananiev };
367c79ed194SVladimir Ananiev #endif
368c79ed194SVladimir Ananiev 
369c79ed194SVladimir Ananiev /*----------- USB -------------------------*/
370c79ed194SVladimir Ananiev 
371c79ed194SVladimir Ananiev static struct omap_usb_config sx1_usb_config __initdata = {
372c79ed194SVladimir Ananiev 	.otg		= 0,
373c79ed194SVladimir Ananiev 	.register_dev	= 1,
374c79ed194SVladimir Ananiev 	.register_host	= 0,
375c79ed194SVladimir Ananiev 	.hmc_mode	= 0,
376c79ed194SVladimir Ananiev 	.pins[0]	= 2,
377c79ed194SVladimir Ananiev 	.pins[1]	= 0,
378c79ed194SVladimir Ananiev 	.pins[2]	= 0,
379c79ed194SVladimir Ananiev };
380c79ed194SVladimir Ananiev 
381c79ed194SVladimir Ananiev /*----------- MMC -------------------------*/
382c79ed194SVladimir Ananiev 
383c79ed194SVladimir Ananiev static struct omap_mmc_config sx1_mmc_config __initdata = {
384c79ed194SVladimir Ananiev 	.mmc [0] = {
385c79ed194SVladimir Ananiev 		.enabled	= 1,
386c79ed194SVladimir Ananiev 		.wire4		= 0,
387c79ed194SVladimir Ananiev 	},
388c79ed194SVladimir Ananiev };
389c79ed194SVladimir Ananiev 
390c79ed194SVladimir Ananiev /*----------- LCD -------------------------*/
391c79ed194SVladimir Ananiev 
392c79ed194SVladimir Ananiev static struct platform_device sx1_lcd_device = {
393c79ed194SVladimir Ananiev 	.name		= "lcd_sx1",
394c79ed194SVladimir Ananiev 	.id		= -1,
395c79ed194SVladimir Ananiev };
396c79ed194SVladimir Ananiev 
397c79ed194SVladimir Ananiev static struct omap_lcd_config sx1_lcd_config __initdata = {
398c79ed194SVladimir Ananiev 	.ctrl_name	= "internal",
399c79ed194SVladimir Ananiev };
400c79ed194SVladimir Ananiev 
401c79ed194SVladimir Ananiev /*-----------------------------------------*/
402c79ed194SVladimir Ananiev static struct platform_device *sx1_devices[] __initdata = {
403c79ed194SVladimir Ananiev 	&sx1_flash_device,
404c79ed194SVladimir Ananiev 	&sx1_kp_device,
405c79ed194SVladimir Ananiev 	&sx1_lcd_device,
406c79ed194SVladimir Ananiev 	&sx1_mcbsp1_device,
407c79ed194SVladimir Ananiev 	&sx1_irda_device,
408c79ed194SVladimir Ananiev };
409c79ed194SVladimir Ananiev /*-----------------------------------------*/
410c79ed194SVladimir Ananiev 
411c79ed194SVladimir Ananiev static struct omap_uart_config sx1_uart_config __initdata = {
412c79ed194SVladimir Ananiev 	.enabled_uarts = ((1 << 0) | (1 << 1) | (1 << 2)),
413c79ed194SVladimir Ananiev };
414c79ed194SVladimir Ananiev 
415e27a93a9STony Lindgren static struct omap_board_config_kernel sx1_config[] __initdata = {
416c79ed194SVladimir Ananiev 	{ OMAP_TAG_USB,	&sx1_usb_config },
417c79ed194SVladimir Ananiev 	{ OMAP_TAG_MMC,	&sx1_mmc_config },
418c79ed194SVladimir Ananiev 	{ OMAP_TAG_LCD,	&sx1_lcd_config },
419c79ed194SVladimir Ananiev 	{ OMAP_TAG_UART,	&sx1_uart_config },
420c79ed194SVladimir Ananiev };
421e27a93a9STony Lindgren 
422c79ed194SVladimir Ananiev /*-----------------------------------------*/
423e27a93a9STony Lindgren 
424c79ed194SVladimir Ananiev static void __init omap_sx1_init(void)
425c79ed194SVladimir Ananiev {
426c79ed194SVladimir Ananiev 	platform_add_devices(sx1_devices, ARRAY_SIZE(sx1_devices));
427c79ed194SVladimir Ananiev 
428c79ed194SVladimir Ananiev 	omap_board_config = sx1_config;
429c79ed194SVladimir Ananiev 	omap_board_config_size = ARRAY_SIZE(sx1_config);
430c79ed194SVladimir Ananiev 	omap_serial_init();
4311ed16a86SJarkko Nikula 	omap_register_i2c_bus(1, 100, NULL, 0);
432087c5030SCarlos Eduardo Aguiar 	sx1_mmc_init();
433c79ed194SVladimir Ananiev 
434c79ed194SVladimir Ananiev 	/* turn on USB power */
435c79ed194SVladimir Ananiev 	/* sx1_setusbpower(1); cant do it here because i2c is not ready */
436c79ed194SVladimir Ananiev 	omap_request_gpio(1);	/* A_IRDA_OFF */
437c79ed194SVladimir Ananiev 	omap_request_gpio(11);	/* A_SWITCH */
438c79ed194SVladimir Ananiev 	omap_request_gpio(15);	/* A_USB_ON */
439c79ed194SVladimir Ananiev 	omap_set_gpio_direction(1, 0);/* gpio1 -> output */
440c79ed194SVladimir Ananiev 	omap_set_gpio_direction(11, 0);/* gpio11 -> output */
441c79ed194SVladimir Ananiev 	omap_set_gpio_direction(15, 0);/* gpio15 -> output */
442c79ed194SVladimir Ananiev 	/* set GPIO data */
443c79ed194SVladimir Ananiev 	omap_set_gpio_dataout(1, 1);/*A_IRDA_OFF = 1 */
444c79ed194SVladimir Ananiev 	omap_set_gpio_dataout(11, 0);/*A_SWITCH = 0 */
445c79ed194SVladimir Ananiev 	omap_set_gpio_dataout(15, 0);/*A_USB_ON = 0 */
446c79ed194SVladimir Ananiev 
447c79ed194SVladimir Ananiev }
448c79ed194SVladimir Ananiev /*----------------------------------------*/
449c79ed194SVladimir Ananiev static void __init omap_sx1_init_irq(void)
450c79ed194SVladimir Ananiev {
451c79ed194SVladimir Ananiev 	omap1_init_common_hw();
452c79ed194SVladimir Ananiev 	omap_init_irq();
453c79ed194SVladimir Ananiev 	omap_gpio_init();
454c79ed194SVladimir Ananiev }
455c79ed194SVladimir Ananiev /*----------------------------------------*/
456c79ed194SVladimir Ananiev 
457c79ed194SVladimir Ananiev static void __init omap_sx1_map_io(void)
458c79ed194SVladimir Ananiev {
459c79ed194SVladimir Ananiev 	omap1_map_common_io();
460c79ed194SVladimir Ananiev }
461c79ed194SVladimir Ananiev 
462c79ed194SVladimir Ananiev MACHINE_START(SX1, "OMAP310 based Siemens SX1")
463c79ed194SVladimir Ananiev 	.phys_io	= 0xfff00000,
464c79ed194SVladimir Ananiev 	.io_pg_offst	= ((0xfef00000) >> 18) & 0xfffc,
465c79ed194SVladimir Ananiev 	.boot_params	= 0x10000100,
466c79ed194SVladimir Ananiev 	.map_io		= omap_sx1_map_io,
467c79ed194SVladimir Ananiev 	.init_irq		= omap_sx1_init_irq,
468c79ed194SVladimir Ananiev 	.init_machine	= omap_sx1_init,
469c79ed194SVladimir Ananiev 	.timer		= &omap_timer,
470c79ed194SVladimir Ananiev MACHINE_END
471