Thomas Weber | 476544c | 2010-02-17 14:09:28 -0800 | [diff] [blame] | 1 | /* |
| 2 | * board-devkit8000.c - TimLL Devkit8000 |
| 3 | * |
| 4 | * Copyright (C) 2009 Kim Botherway |
| 5 | * Copyright (C) 2010 Thomas Weber |
| 6 | * |
| 7 | * Modified from mach-omap2/board-omap3beagle.c |
| 8 | * |
| 9 | * Initial code: Syed Mohammed Khasim |
| 10 | * |
| 11 | * This program is free software; you can redistribute it and/or modify |
| 12 | * it under the terms of the GNU General Public License version 2 as |
| 13 | * published by the Free Software Foundation. |
| 14 | */ |
| 15 | |
| 16 | #include <linux/kernel.h> |
| 17 | #include <linux/init.h> |
| 18 | #include <linux/platform_device.h> |
| 19 | #include <linux/delay.h> |
| 20 | #include <linux/err.h> |
| 21 | #include <linux/clk.h> |
| 22 | #include <linux/io.h> |
| 23 | #include <linux/leds.h> |
| 24 | #include <linux/gpio.h> |
| 25 | #include <linux/input.h> |
| 26 | #include <linux/gpio_keys.h> |
| 27 | |
| 28 | #include <linux/mtd/mtd.h> |
| 29 | #include <linux/mtd/partitions.h> |
| 30 | #include <linux/mtd/nand.h> |
| 31 | |
| 32 | #include <linux/regulator/machine.h> |
| 33 | #include <linux/i2c/twl.h> |
| 34 | |
| 35 | #include <mach/hardware.h> |
| 36 | #include <asm/mach-types.h> |
| 37 | #include <asm/mach/arch.h> |
| 38 | #include <asm/mach/map.h> |
| 39 | #include <asm/mach/flash.h> |
| 40 | |
| 41 | #include <plat/board.h> |
| 42 | #include <plat/common.h> |
| 43 | #include <plat/gpmc.h> |
| 44 | #include <plat/nand.h> |
| 45 | #include <plat/usb.h> |
| 46 | #include <plat/timer-gp.h> |
| 47 | #include <plat/display.h> |
| 48 | |
| 49 | #include <plat/mcspi.h> |
| 50 | #include <linux/input/matrix_keypad.h> |
| 51 | #include <linux/spi/spi.h> |
| 52 | #include <linux/spi/ads7846.h> |
| 53 | #include <linux/usb/otg.h> |
| 54 | #include <linux/dm9000.h> |
| 55 | #include <linux/interrupt.h> |
| 56 | |
| 57 | #include "sdram-micron-mt46h32m32lf-6.h" |
| 58 | |
| 59 | #include "mux.h" |
| 60 | #include "hsmmc.h" |
| 61 | |
| 62 | #define GPMC_CS0_BASE 0x60 |
| 63 | #define GPMC_CS_SIZE 0x30 |
| 64 | |
| 65 | #define NAND_BLOCK_SIZE SZ_128K |
| 66 | |
| 67 | #define OMAP_DM9000_GPIO_IRQ 25 |
| 68 | #define OMAP3_DEVKIT_TS_GPIO 27 |
| 69 | |
| 70 | static struct mtd_partition devkit8000_nand_partitions[] = { |
| 71 | /* All the partition sizes are listed in terms of NAND block size */ |
| 72 | { |
| 73 | .name = "X-Loader", |
| 74 | .offset = 0, |
| 75 | .size = 4 * NAND_BLOCK_SIZE, |
| 76 | .mask_flags = MTD_WRITEABLE, /* force read-only */ |
| 77 | }, |
| 78 | { |
| 79 | .name = "U-Boot", |
| 80 | .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */ |
| 81 | .size = 15 * NAND_BLOCK_SIZE, |
| 82 | .mask_flags = MTD_WRITEABLE, /* force read-only */ |
| 83 | }, |
| 84 | { |
| 85 | .name = "U-Boot Env", |
| 86 | .offset = MTDPART_OFS_APPEND, /* Offset = 0x260000 */ |
| 87 | .size = 1 * NAND_BLOCK_SIZE, |
| 88 | }, |
| 89 | { |
| 90 | .name = "Kernel", |
| 91 | .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */ |
| 92 | .size = 32 * NAND_BLOCK_SIZE, |
| 93 | }, |
| 94 | { |
| 95 | .name = "File System", |
| 96 | .offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */ |
| 97 | .size = MTDPART_SIZ_FULL, |
| 98 | }, |
| 99 | }; |
| 100 | |
| 101 | static struct omap_nand_platform_data devkit8000_nand_data = { |
| 102 | .options = NAND_BUSWIDTH_16, |
| 103 | .parts = devkit8000_nand_partitions, |
| 104 | .nr_parts = ARRAY_SIZE(devkit8000_nand_partitions), |
| 105 | .dma_channel = -1, /* disable DMA in OMAP NAND driver */ |
| 106 | }; |
| 107 | |
| 108 | static struct resource devkit8000_nand_resource = { |
| 109 | .flags = IORESOURCE_MEM, |
| 110 | }; |
| 111 | |
| 112 | static struct platform_device devkit8000_nand_device = { |
| 113 | .name = "omap2-nand", |
| 114 | .id = -1, |
| 115 | .dev = { |
| 116 | .platform_data = &devkit8000_nand_data, |
| 117 | }, |
| 118 | .num_resources = 1, |
| 119 | .resource = &devkit8000_nand_resource, |
| 120 | }; |
| 121 | |
| 122 | static struct omap2_hsmmc_info mmc[] = { |
| 123 | { |
| 124 | .mmc = 1, |
| 125 | .wires = 8, |
| 126 | .gpio_wp = 29, |
| 127 | }, |
| 128 | {} /* Terminator */ |
| 129 | }; |
| 130 | static struct omap_board_config_kernel devkit8000_config[] __initdata = { |
| 131 | }; |
| 132 | |
| 133 | static int devkit8000_panel_enable_lcd(struct omap_dss_device *dssdev) |
| 134 | { |
| 135 | twl_i2c_write_u8(TWL4030_MODULE_GPIO, 0x80, REG_GPIODATADIR1); |
| 136 | twl_i2c_write_u8(TWL4030_MODULE_LED, 0x0, 0x0); |
| 137 | |
| 138 | return 0; |
| 139 | } |
| 140 | |
| 141 | static void devkit8000_panel_disable_lcd(struct omap_dss_device *dssdev) |
| 142 | { |
| 143 | } |
| 144 | static int devkit8000_panel_enable_dvi(struct omap_dss_device *dssdev) |
| 145 | { |
| 146 | return 0; |
| 147 | } |
| 148 | |
| 149 | static void devkit8000_panel_disable_dvi(struct omap_dss_device *dssdev) |
| 150 | { |
| 151 | } |
| 152 | |
| 153 | static int devkit8000_panel_enable_tv(struct omap_dss_device *dssdev) |
| 154 | { |
| 155 | |
| 156 | return 0; |
| 157 | } |
| 158 | |
| 159 | static void devkit8000_panel_disable_tv(struct omap_dss_device *dssdev) |
| 160 | { |
| 161 | } |
| 162 | |
| 163 | |
| 164 | static struct regulator_consumer_supply devkit8000_vmmc1_supply = { |
| 165 | .supply = "vmmc", |
| 166 | }; |
| 167 | |
| 168 | static struct regulator_consumer_supply devkit8000_vsim_supply = { |
| 169 | .supply = "vmmc_aux", |
| 170 | }; |
| 171 | |
| 172 | |
| 173 | static struct omap_dss_device devkit8000_lcd_device = { |
| 174 | .name = "lcd", |
| 175 | .driver_name = "innolux_at_panel", |
| 176 | .type = OMAP_DISPLAY_TYPE_DPI, |
| 177 | .phy.dpi.data_lines = 24, |
| 178 | .platform_enable = devkit8000_panel_enable_lcd, |
| 179 | .platform_disable = devkit8000_panel_disable_lcd, |
| 180 | }; |
| 181 | static struct omap_dss_device devkit8000_dvi_device = { |
| 182 | .name = "dvi", |
| 183 | .driver_name = "generic_panel", |
| 184 | .type = OMAP_DISPLAY_TYPE_DPI, |
| 185 | .phy.dpi.data_lines = 24, |
| 186 | .platform_enable = devkit8000_panel_enable_dvi, |
| 187 | .platform_disable = devkit8000_panel_disable_dvi, |
| 188 | }; |
| 189 | |
| 190 | static struct omap_dss_device devkit8000_tv_device = { |
| 191 | .name = "tv", |
| 192 | .driver_name = "venc", |
| 193 | .type = OMAP_DISPLAY_TYPE_VENC, |
| 194 | .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, |
| 195 | .platform_enable = devkit8000_panel_enable_tv, |
| 196 | .platform_disable = devkit8000_panel_disable_tv, |
| 197 | }; |
| 198 | |
| 199 | |
| 200 | static struct omap_dss_device *devkit8000_dss_devices[] = { |
| 201 | &devkit8000_lcd_device, |
| 202 | &devkit8000_dvi_device, |
| 203 | &devkit8000_tv_device, |
| 204 | }; |
| 205 | |
| 206 | static struct omap_dss_board_info devkit8000_dss_data = { |
| 207 | .num_devices = ARRAY_SIZE(devkit8000_dss_devices), |
| 208 | .devices = devkit8000_dss_devices, |
| 209 | .default_device = &devkit8000_lcd_device, |
| 210 | }; |
| 211 | |
| 212 | static struct platform_device devkit8000_dss_device = { |
| 213 | .name = "omapdss", |
| 214 | .id = -1, |
| 215 | .dev = { |
| 216 | .platform_data = &devkit8000_dss_data, |
| 217 | }, |
| 218 | }; |
| 219 | |
| 220 | static struct regulator_consumer_supply devkit8000_vdda_dac_supply = { |
| 221 | .supply = "vdda_dac", |
| 222 | .dev = &devkit8000_dss_device.dev, |
| 223 | }; |
| 224 | |
| 225 | static int board_keymap[] = { |
| 226 | KEY(0, 0, KEY_1), |
| 227 | KEY(1, 0, KEY_2), |
| 228 | KEY(2, 0, KEY_3), |
| 229 | KEY(0, 1, KEY_4), |
| 230 | KEY(1, 1, KEY_5), |
| 231 | KEY(2, 1, KEY_6), |
| 232 | KEY(3, 1, KEY_F5), |
| 233 | KEY(0, 2, KEY_7), |
| 234 | KEY(1, 2, KEY_8), |
| 235 | KEY(2, 2, KEY_9), |
| 236 | KEY(3, 2, KEY_F6), |
| 237 | KEY(0, 3, KEY_F7), |
| 238 | KEY(1, 3, KEY_0), |
| 239 | KEY(2, 3, KEY_F8), |
| 240 | PERSISTENT_KEY(4, 5), |
| 241 | KEY(4, 4, KEY_VOLUMEUP), |
| 242 | KEY(5, 5, KEY_VOLUMEDOWN), |
| 243 | 0 |
| 244 | }; |
| 245 | |
| 246 | static struct matrix_keymap_data board_map_data = { |
| 247 | .keymap = board_keymap, |
| 248 | .keymap_size = ARRAY_SIZE(board_keymap), |
| 249 | }; |
| 250 | |
| 251 | static struct twl4030_keypad_data devkit8000_kp_data = { |
| 252 | .keymap_data = &board_map_data, |
| 253 | .rows = 6, |
| 254 | .cols = 6, |
| 255 | .rep = 1, |
| 256 | }; |
| 257 | |
| 258 | static struct gpio_led gpio_leds[]; |
| 259 | |
| 260 | static int devkit8000_twl_gpio_setup(struct device *dev, |
| 261 | unsigned gpio, unsigned ngpio) |
| 262 | { |
| 263 | omap_mux_init_gpio(29, OMAP_PIN_INPUT); |
| 264 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ |
| 265 | mmc[0].gpio_cd = gpio + 0; |
| 266 | omap2_hsmmc_init(mmc); |
| 267 | |
| 268 | /* link regulators to MMC adapters */ |
| 269 | devkit8000_vmmc1_supply.dev = mmc[0].dev; |
| 270 | devkit8000_vsim_supply.dev = mmc[0].dev; |
| 271 | |
| 272 | /* REVISIT: need ehci-omap hooks for external VBUS |
| 273 | * power switch and overcurrent detect |
| 274 | */ |
| 275 | |
| 276 | gpio_request(gpio + 1, "EHCI_nOC"); |
| 277 | gpio_direction_input(gpio + 1); |
| 278 | |
| 279 | /* TWL4030_GPIO_MAX + 0 == ledA, EHCI nEN_USB_PWR (out, active low) */ |
| 280 | gpio_request(gpio + TWL4030_GPIO_MAX, "nEN_USB_PWR"); |
| 281 | gpio_direction_output(gpio + TWL4030_GPIO_MAX, 1); |
| 282 | |
| 283 | /* TWL4030_GPIO_MAX + 1 == ledB, PMU_STAT (out, active low LED) */ |
| 284 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; |
| 285 | |
| 286 | return 0; |
| 287 | } |
| 288 | |
| 289 | static struct twl4030_gpio_platform_data devkit8000_gpio_data = { |
| 290 | .gpio_base = OMAP_MAX_GPIO_LINES, |
| 291 | .irq_base = TWL4030_GPIO_IRQ_BASE, |
| 292 | .irq_end = TWL4030_GPIO_IRQ_END, |
| 293 | .use_leds = true, |
| 294 | .pullups = BIT(1), |
| 295 | .pulldowns = BIT(2) | BIT(6) | BIT(7) | BIT(8) | BIT(13) |
| 296 | | BIT(15) | BIT(16) | BIT(17), |
| 297 | .setup = devkit8000_twl_gpio_setup, |
| 298 | }; |
| 299 | |
| 300 | static struct regulator_consumer_supply devkit8000_vpll2_supplies[] = { |
| 301 | { |
| 302 | .supply = "vdvi", |
| 303 | .dev = &devkit8000_lcd_device.dev, |
| 304 | }, |
| 305 | { |
| 306 | .supply = "vdss_dsi", |
| 307 | .dev = &devkit8000_dss_device.dev, |
| 308 | } |
| 309 | }; |
| 310 | |
| 311 | /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ |
| 312 | static struct regulator_init_data devkit8000_vmmc1 = { |
| 313 | .constraints = { |
| 314 | .min_uV = 1850000, |
| 315 | .max_uV = 3150000, |
| 316 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 317 | | REGULATOR_MODE_STANDBY, |
| 318 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 319 | | REGULATOR_CHANGE_MODE |
| 320 | | REGULATOR_CHANGE_STATUS, |
| 321 | }, |
| 322 | .num_consumer_supplies = 1, |
| 323 | .consumer_supplies = &devkit8000_vmmc1_supply, |
| 324 | }; |
| 325 | |
| 326 | /* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */ |
| 327 | static struct regulator_init_data devkit8000_vsim = { |
| 328 | .constraints = { |
| 329 | .min_uV = 1800000, |
| 330 | .max_uV = 3000000, |
| 331 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 332 | | REGULATOR_MODE_STANDBY, |
| 333 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 334 | | REGULATOR_CHANGE_MODE |
| 335 | | REGULATOR_CHANGE_STATUS, |
| 336 | }, |
| 337 | .num_consumer_supplies = 1, |
| 338 | .consumer_supplies = &devkit8000_vsim_supply, |
| 339 | }; |
| 340 | |
| 341 | /* VDAC for DSS driving S-Video (8 mA unloaded, max 65 mA) */ |
| 342 | static struct regulator_init_data devkit8000_vdac = { |
| 343 | .constraints = { |
| 344 | .min_uV = 1800000, |
| 345 | .max_uV = 1800000, |
| 346 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 347 | | REGULATOR_MODE_STANDBY, |
| 348 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 349 | | REGULATOR_CHANGE_STATUS, |
| 350 | }, |
| 351 | .num_consumer_supplies = 1, |
| 352 | .consumer_supplies = &devkit8000_vdda_dac_supply, |
| 353 | }; |
| 354 | |
| 355 | /* VPLL2 for digital video outputs */ |
| 356 | static struct regulator_init_data devkit8000_vpll2 = { |
| 357 | .constraints = { |
| 358 | .name = "VDVI", |
| 359 | .min_uV = 1800000, |
| 360 | .max_uV = 1800000, |
| 361 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 362 | | REGULATOR_MODE_STANDBY, |
| 363 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 364 | | REGULATOR_CHANGE_STATUS, |
| 365 | }, |
| 366 | .num_consumer_supplies = ARRAY_SIZE(devkit8000_vpll2_supplies), |
| 367 | .consumer_supplies = devkit8000_vpll2_supplies, |
| 368 | }; |
| 369 | |
| 370 | static struct twl4030_usb_data devkit8000_usb_data = { |
| 371 | .usb_mode = T2_USB_MODE_ULPI, |
| 372 | }; |
| 373 | |
| 374 | static struct twl4030_codec_audio_data devkit8000_audio_data = { |
| 375 | .audio_mclk = 26000000, |
| 376 | }; |
| 377 | |
| 378 | static struct twl4030_codec_data devkit8000_codec_data = { |
| 379 | .audio_mclk = 26000000, |
| 380 | .audio = &devkit8000_audio_data, |
| 381 | }; |
| 382 | |
| 383 | static struct twl4030_platform_data devkit8000_twldata = { |
| 384 | .irq_base = TWL4030_IRQ_BASE, |
| 385 | .irq_end = TWL4030_IRQ_END, |
| 386 | |
| 387 | /* platform_data for children goes here */ |
| 388 | .usb = &devkit8000_usb_data, |
| 389 | .gpio = &devkit8000_gpio_data, |
| 390 | .codec = &devkit8000_codec_data, |
| 391 | .vmmc1 = &devkit8000_vmmc1, |
| 392 | .vsim = &devkit8000_vsim, |
| 393 | .vdac = &devkit8000_vdac, |
| 394 | .vpll2 = &devkit8000_vpll2, |
| 395 | .keypad = &devkit8000_kp_data, |
| 396 | }; |
| 397 | |
| 398 | static struct i2c_board_info __initdata devkit8000_i2c_boardinfo[] = { |
| 399 | { |
| 400 | I2C_BOARD_INFO("twl4030", 0x48), |
| 401 | .flags = I2C_CLIENT_WAKE, |
| 402 | .irq = INT_34XX_SYS_NIRQ, |
| 403 | .platform_data = &devkit8000_twldata, |
| 404 | }, |
| 405 | }; |
| 406 | |
| 407 | static int __init devkit8000_i2c_init(void) |
| 408 | { |
| 409 | omap_register_i2c_bus(1, 2600, devkit8000_i2c_boardinfo, |
| 410 | ARRAY_SIZE(devkit8000_i2c_boardinfo)); |
| 411 | /* Bus 3 is attached to the DVI port where devices like the pico DLP |
| 412 | * projector don't work reliably with 400kHz */ |
| 413 | omap_register_i2c_bus(3, 400, NULL, 0); |
| 414 | return 0; |
| 415 | } |
| 416 | |
| 417 | static struct gpio_led gpio_leds[] = { |
| 418 | { |
| 419 | .name = "led1", |
| 420 | .default_trigger = "heartbeat", |
| 421 | .gpio = 186, |
| 422 | .active_low = true, |
| 423 | }, |
| 424 | { |
| 425 | .name = "led2", |
| 426 | .default_trigger = "mmc0", |
| 427 | .gpio = 163, |
| 428 | .active_low = true, |
| 429 | }, |
| 430 | { |
| 431 | .name = "ledB", |
| 432 | .default_trigger = "none", |
| 433 | .gpio = 153, |
| 434 | .active_low = true, |
| 435 | }, |
| 436 | { |
| 437 | .name = "led3", |
| 438 | .default_trigger = "none", |
| 439 | .gpio = 164, |
| 440 | .active_low = true, |
| 441 | }, |
| 442 | }; |
| 443 | |
| 444 | static struct gpio_led_platform_data gpio_led_info = { |
| 445 | .leds = gpio_leds, |
| 446 | .num_leds = ARRAY_SIZE(gpio_leds), |
| 447 | }; |
| 448 | |
| 449 | static struct platform_device leds_gpio = { |
| 450 | .name = "leds-gpio", |
| 451 | .id = -1, |
| 452 | .dev = { |
| 453 | .platform_data = &gpio_led_info, |
| 454 | }, |
| 455 | }; |
| 456 | |
| 457 | static struct gpio_keys_button gpio_buttons[] = { |
| 458 | { |
| 459 | .code = BTN_EXTRA, |
| 460 | .gpio = 26, |
| 461 | .desc = "user", |
| 462 | .wakeup = 1, |
| 463 | }, |
| 464 | }; |
| 465 | |
| 466 | static struct gpio_keys_platform_data gpio_key_info = { |
| 467 | .buttons = gpio_buttons, |
| 468 | .nbuttons = ARRAY_SIZE(gpio_buttons), |
| 469 | }; |
| 470 | |
| 471 | static struct platform_device keys_gpio = { |
| 472 | .name = "gpio-keys", |
| 473 | .id = -1, |
| 474 | .dev = { |
| 475 | .platform_data = &gpio_key_info, |
| 476 | }, |
| 477 | }; |
| 478 | |
| 479 | |
| 480 | static void __init devkit8000_init_irq(void) |
| 481 | { |
| 482 | omap_board_config = devkit8000_config; |
| 483 | omap_board_config_size = ARRAY_SIZE(devkit8000_config); |
| 484 | omap2_init_common_hw(mt46h32m32lf6_sdrc_params, |
| 485 | mt46h32m32lf6_sdrc_params); |
| 486 | omap_init_irq(); |
| 487 | #ifdef CONFIG_OMAP_32K_TIMER |
| 488 | omap2_gp_clockevent_set_gptimer(12); |
| 489 | #endif |
| 490 | omap_gpio_init(); |
| 491 | } |
| 492 | |
| 493 | static void __init devkit8000_ads7846_init(void) |
| 494 | { |
| 495 | int gpio = OMAP3_DEVKIT_TS_GPIO; |
| 496 | int ret; |
| 497 | |
| 498 | ret = gpio_request(gpio, "ads7846_pen_down"); |
| 499 | if (ret < 0) { |
| 500 | printk(KERN_ERR "Failed to request GPIO %d for " |
| 501 | "ads7846 pen down IRQ\n", gpio); |
| 502 | return; |
| 503 | } |
| 504 | |
| 505 | gpio_direction_input(gpio); |
| 506 | } |
| 507 | |
| 508 | static int ads7846_get_pendown_state(void) |
| 509 | { |
| 510 | return !gpio_get_value(OMAP3_DEVKIT_TS_GPIO); |
| 511 | } |
| 512 | |
| 513 | static struct ads7846_platform_data ads7846_config = { |
| 514 | .x_max = 0x0fff, |
| 515 | .y_max = 0x0fff, |
| 516 | .x_plate_ohms = 180, |
| 517 | .pressure_max = 255, |
| 518 | .debounce_max = 10, |
| 519 | .debounce_tol = 5, |
| 520 | .debounce_rep = 1, |
| 521 | .get_pendown_state = ads7846_get_pendown_state, |
| 522 | .keep_vref_on = 1, |
| 523 | .settle_delay_usecs = 150, |
| 524 | }; |
| 525 | |
| 526 | static struct omap2_mcspi_device_config ads7846_mcspi_config = { |
| 527 | .turbo_mode = 0, |
| 528 | .single_channel = 1, /* 0: slave, 1: master */ |
| 529 | }; |
| 530 | |
| 531 | static struct spi_board_info devkit8000_spi_board_info[] __initdata = { |
| 532 | { |
| 533 | .modalias = "ads7846", |
| 534 | .bus_num = 2, |
| 535 | .chip_select = 0, |
| 536 | .max_speed_hz = 1500000, |
| 537 | .controller_data = &ads7846_mcspi_config, |
| 538 | .irq = OMAP_GPIO_IRQ(OMAP3_DEVKIT_TS_GPIO), |
| 539 | .platform_data = &ads7846_config, |
| 540 | } |
| 541 | }; |
| 542 | |
| 543 | #define OMAP_DM9000_BASE 0x2c000000 |
| 544 | |
| 545 | static struct resource omap_dm9000_resources[] = { |
| 546 | [0] = { |
| 547 | .start = OMAP_DM9000_BASE, |
| 548 | .end = (OMAP_DM9000_BASE + 0x4 - 1), |
| 549 | .flags = IORESOURCE_MEM, |
| 550 | }, |
| 551 | [1] = { |
| 552 | .start = (OMAP_DM9000_BASE + 0x400), |
| 553 | .end = (OMAP_DM9000_BASE + 0x400 + 0x4 - 1), |
| 554 | .flags = IORESOURCE_MEM, |
| 555 | }, |
| 556 | [2] = { |
| 557 | .start = OMAP_GPIO_IRQ(OMAP_DM9000_GPIO_IRQ), |
| 558 | .flags = IORESOURCE_IRQ | IRQF_TRIGGER_LOW, |
| 559 | }, |
| 560 | }; |
| 561 | |
| 562 | static struct dm9000_plat_data omap_dm9000_platdata = { |
| 563 | .flags = DM9000_PLATF_16BITONLY, |
| 564 | }; |
| 565 | |
| 566 | static struct platform_device omap_dm9000_dev = { |
| 567 | .name = "dm9000", |
| 568 | .id = -1, |
| 569 | .num_resources = ARRAY_SIZE(omap_dm9000_resources), |
| 570 | .resource = omap_dm9000_resources, |
| 571 | .dev = { |
| 572 | .platform_data = &omap_dm9000_platdata, |
| 573 | }, |
| 574 | }; |
| 575 | |
| 576 | static void __init omap_dm9000_init(void) |
| 577 | { |
| 578 | if (gpio_request(OMAP_DM9000_GPIO_IRQ, "dm9000 irq") < 0) { |
| 579 | printk(KERN_ERR "Failed to request GPIO%d for dm9000 IRQ\n", |
| 580 | OMAP_DM9000_GPIO_IRQ); |
| 581 | return; |
| 582 | } |
| 583 | |
| 584 | gpio_direction_input(OMAP_DM9000_GPIO_IRQ); |
| 585 | } |
| 586 | |
| 587 | static struct platform_device *devkit8000_devices[] __initdata = { |
| 588 | &devkit8000_dss_device, |
| 589 | &leds_gpio, |
| 590 | &keys_gpio, |
| 591 | &omap_dm9000_dev, |
| 592 | }; |
| 593 | |
| 594 | static void __init devkit8000_flash_init(void) |
| 595 | { |
| 596 | u8 cs = 0; |
| 597 | u8 nandcs = GPMC_CS_NUM + 1; |
| 598 | |
| 599 | u32 gpmc_base_add = OMAP34XX_GPMC_VIRT; |
| 600 | |
| 601 | /* find out the chip-select on which NAND exists */ |
| 602 | while (cs < GPMC_CS_NUM) { |
| 603 | u32 ret = 0; |
| 604 | ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); |
| 605 | |
| 606 | if ((ret & 0xC00) == 0x800) { |
| 607 | printk(KERN_INFO "Found NAND on CS%d\n", cs); |
| 608 | if (nandcs > GPMC_CS_NUM) |
| 609 | nandcs = cs; |
| 610 | } |
| 611 | cs++; |
| 612 | } |
| 613 | |
| 614 | if (nandcs > GPMC_CS_NUM) { |
| 615 | printk(KERN_INFO "NAND: Unable to find configuration " |
| 616 | "in GPMC\n "); |
| 617 | return; |
| 618 | } |
| 619 | |
| 620 | if (nandcs < GPMC_CS_NUM) { |
| 621 | devkit8000_nand_data.cs = nandcs; |
| 622 | devkit8000_nand_data.gpmc_cs_baseaddr = (void *) |
| 623 | (gpmc_base_add + GPMC_CS0_BASE + nandcs * GPMC_CS_SIZE); |
| 624 | devkit8000_nand_data.gpmc_baseaddr = (void *) |
| 625 | (gpmc_base_add); |
| 626 | |
| 627 | printk(KERN_INFO "Registering NAND on CS%d\n", nandcs); |
| 628 | if (platform_device_register(&devkit8000_nand_device) < 0) |
| 629 | printk(KERN_ERR "Unable to register NAND device\n"); |
| 630 | } |
| 631 | } |
| 632 | |
Maulik Mankad | 884b836 | 2010-02-17 14:09:30 -0800 | [diff] [blame] | 633 | static struct omap_musb_board_data musb_board_data = { |
| 634 | .interface_type = MUSB_INTERFACE_ULPI, |
| 635 | .mode = MUSB_OTG, |
| 636 | .power = 100, |
| 637 | }; |
| 638 | |
Felipe Balbi | 6f69a18 | 2010-03-04 09:45:53 +0200 | [diff] [blame] | 639 | static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { |
Thomas Weber | 476544c | 2010-02-17 14:09:28 -0800 | [diff] [blame] | 640 | |
| 641 | .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY, |
Thomas Weber | 2135bb5 | 2010-03-24 12:52:16 +0000 | [diff] [blame^] | 642 | .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN, |
Thomas Weber | 476544c | 2010-02-17 14:09:28 -0800 | [diff] [blame] | 643 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, |
| 644 | |
| 645 | .phy_reset = true, |
| 646 | .reset_gpio_port[0] = -EINVAL, |
Thomas Weber | 2135bb5 | 2010-03-24 12:52:16 +0000 | [diff] [blame^] | 647 | .reset_gpio_port[1] = -EINVAL, |
Thomas Weber | 476544c | 2010-02-17 14:09:28 -0800 | [diff] [blame] | 648 | .reset_gpio_port[2] = -EINVAL |
| 649 | }; |
| 650 | |
| 651 | static void __init devkit8000_init(void) |
| 652 | { |
| 653 | devkit8000_i2c_init(); |
| 654 | platform_add_devices(devkit8000_devices, |
| 655 | ARRAY_SIZE(devkit8000_devices)); |
| 656 | omap_board_config = devkit8000_config; |
| 657 | omap_board_config_size = ARRAY_SIZE(devkit8000_config); |
| 658 | |
| 659 | spi_register_board_info(devkit8000_spi_board_info, |
| 660 | ARRAY_SIZE(devkit8000_spi_board_info)); |
| 661 | |
| 662 | omap_serial_init(); |
| 663 | |
| 664 | omap_dm9000_init(); |
| 665 | |
| 666 | devkit8000_ads7846_init(); |
| 667 | |
| 668 | omap_mux_init_gpio(170, OMAP_PIN_INPUT); |
| 669 | |
| 670 | gpio_request(170, "DVI_nPD"); |
| 671 | /* REVISIT leave DVI powered down until it's needed ... */ |
| 672 | gpio_direction_output(170, true); |
| 673 | |
Maulik Mankad | 884b836 | 2010-02-17 14:09:30 -0800 | [diff] [blame] | 674 | usb_musb_init(&musb_board_data); |
Thomas Weber | 476544c | 2010-02-17 14:09:28 -0800 | [diff] [blame] | 675 | usb_ehci_init(&ehci_pdata); |
| 676 | devkit8000_flash_init(); |
| 677 | |
| 678 | /* Ensure SDRC pins are mux'd for self-refresh */ |
| 679 | omap_mux_init_signal("sdr_cke0", OMAP_PIN_OUTPUT); |
| 680 | omap_mux_init_signal("sdr_cke1", OMAP_PIN_OUTPUT); |
| 681 | } |
| 682 | |
| 683 | static void __init devkit8000_map_io(void) |
| 684 | { |
| 685 | omap2_set_globals_343x(); |
| 686 | omap34xx_map_common_io(); |
| 687 | } |
| 688 | |
| 689 | MACHINE_START(DEVKIT8000, "OMAP3 Devkit8000") |
| 690 | .phys_io = 0x48000000, |
| 691 | .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, |
| 692 | .boot_params = 0x80000100, |
| 693 | .map_io = devkit8000_map_io, |
| 694 | .init_irq = devkit8000_init_irq, |
| 695 | .init_machine = devkit8000_init, |
| 696 | .timer = &omap_timer, |
| 697 | MACHINE_END |