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