Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2009 Integration Software and Electronic Engineering. |
| 3 | * |
| 4 | * Modified from mach-omap2/board-generic.c |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License version 2 as |
| 8 | * published by the Free Software Foundation. |
| 9 | */ |
| 10 | |
| 11 | #include <linux/kernel.h> |
| 12 | #include <linux/init.h> |
| 13 | #include <linux/platform_device.h> |
| 14 | #include <linux/delay.h> |
| 15 | #include <linux/err.h> |
| 16 | #include <linux/clk.h> |
| 17 | #include <linux/io.h> |
| 18 | #include <linux/gpio.h> |
| 19 | #include <linux/interrupt.h> |
| 20 | |
| 21 | #include <linux/regulator/machine.h> |
Balaji T K | ebeb53e | 2009-12-15 20:09:02 +0530 | [diff] [blame] | 22 | #include <linux/i2c/twl.h> |
Sukumar Ghorai | 3a63833 | 2010-09-15 14:49:23 +0000 | [diff] [blame] | 23 | #include <linux/mmc/host.h> |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 24 | |
| 25 | #include <asm/mach-types.h> |
| 26 | #include <asm/mach/arch.h> |
| 27 | |
| 28 | #include <plat/board.h> |
| 29 | #include <plat/common.h> |
| 30 | #include <plat/gpmc.h> |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 31 | #include <plat/usb.h> |
Enric Balletbo i Serra | 691de27 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 32 | #include <plat/display.h> |
Enric Balletbo i Serra | cddb483 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 33 | #include <plat/onenand.h> |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 34 | |
Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 35 | #include "mux.h" |
Adrian Hunter | d02a900b | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 36 | #include "hsmmc.h" |
Enric Balletbo i Serra | 22f1baa | 2010-02-17 14:09:27 -0800 | [diff] [blame] | 37 | #include "sdram-numonyx-m65kxxxxam.h" |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 38 | |
| 39 | #define IGEP2_SMSC911X_CS 5 |
| 40 | #define IGEP2_SMSC911X_GPIO 176 |
| 41 | #define IGEP2_GPIO_USBH_NRESET 24 |
Enric Balletbo i Serra | 228893f | 2010-03-01 11:18:08 +0000 | [diff] [blame] | 42 | #define IGEP2_GPIO_LED0_GREEN 26 |
| 43 | #define IGEP2_GPIO_LED0_RED 27 |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 44 | #define IGEP2_GPIO_LED1_RED 28 |
Enric Balletbo i Serra | 691de27 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 45 | #define IGEP2_GPIO_DVI_PUP 170 |
Jonas Zetterberg | c67b0d9 | 2010-02-14 19:33:24 +0000 | [diff] [blame] | 46 | #define IGEP2_GPIO_WIFI_NPD 94 |
| 47 | #define IGEP2_GPIO_WIFI_NRESET 95 |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 48 | |
Enric Balletbo i Serra | 3f8c48d | 2010-10-08 10:22:35 -0700 | [diff] [blame^] | 49 | /* |
| 50 | * IGEP2 Hardware Revision Table |
| 51 | * |
| 52 | * -------------------------- |
| 53 | * | Id. | Hw Rev. | HW0 (28) | |
| 54 | * -------------------------- |
| 55 | * | 0 | B/C | high | |
| 56 | * | 1 | C | low | |
| 57 | * -------------------------- |
| 58 | */ |
| 59 | |
| 60 | #define IGEP2_BOARD_HWREV_B 0 |
| 61 | #define IGEP2_BOARD_HWREV_C 1 |
| 62 | |
| 63 | static u8 hwrev; |
| 64 | |
| 65 | static void __init igep2_get_revision(void) |
| 66 | { |
| 67 | u8 ret; |
| 68 | |
| 69 | omap_mux_init_gpio(IGEP2_GPIO_LED1_RED, OMAP_PIN_INPUT); |
| 70 | |
| 71 | if ((gpio_request(IGEP2_GPIO_LED1_RED, "GPIO_HW0_REV") == 0) && |
| 72 | (gpio_direction_input(IGEP2_GPIO_LED1_RED) == 0)) { |
| 73 | ret = gpio_get_value(IGEP2_GPIO_LED1_RED); |
| 74 | if (ret == 0) { |
| 75 | pr_info("IGEP2: Hardware Revision C (B-NON compatible)\n"); |
| 76 | hwrev = IGEP2_BOARD_HWREV_C; |
| 77 | } else if (ret == 1) { |
| 78 | pr_info("IGEP2: Hardware Revision B/C (B compatible)\n"); |
| 79 | hwrev = IGEP2_BOARD_HWREV_B; |
| 80 | } else { |
| 81 | pr_err("IGEP2: Unknown Hardware Revision\n"); |
| 82 | hwrev = -1; |
| 83 | } |
| 84 | } else { |
| 85 | pr_warning("IGEP2: Could not obtain gpio GPIO_HW0_REV\n"); |
| 86 | pr_err("IGEP2: Unknown Hardware Revision\n"); |
| 87 | } |
| 88 | |
| 89 | gpio_free(IGEP2_GPIO_LED1_RED); |
| 90 | } |
| 91 | |
Enric Balletbo i Serra | cddb483 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 92 | #if defined(CONFIG_MTD_ONENAND_OMAP2) || \ |
| 93 | defined(CONFIG_MTD_ONENAND_OMAP2_MODULE) |
| 94 | |
| 95 | #define ONENAND_MAP 0x20000000 |
| 96 | |
| 97 | /* NAND04GR4E1A ( x2 Flash built-in COMBO POP MEMORY ) |
| 98 | * Since the device is equipped with two DataRAMs, and two-plane NAND |
| 99 | * Flash memory array, these two component enables simultaneous program |
| 100 | * of 4KiB. Plane1 has only even blocks such as block0, block2, block4 |
| 101 | * while Plane2 has only odd blocks such as block1, block3, block5. |
| 102 | * So MTD regards it as 4KiB page size and 256KiB block size 64*(2*2048) |
| 103 | */ |
| 104 | |
| 105 | static struct mtd_partition igep2_onenand_partitions[] = { |
| 106 | { |
| 107 | .name = "X-Loader", |
| 108 | .offset = 0, |
| 109 | .size = 2 * (64*(2*2048)) |
| 110 | }, |
| 111 | { |
| 112 | .name = "U-Boot", |
| 113 | .offset = MTDPART_OFS_APPEND, |
| 114 | .size = 6 * (64*(2*2048)), |
| 115 | }, |
| 116 | { |
| 117 | .name = "Environment", |
| 118 | .offset = MTDPART_OFS_APPEND, |
| 119 | .size = 2 * (64*(2*2048)), |
| 120 | }, |
| 121 | { |
| 122 | .name = "Kernel", |
| 123 | .offset = MTDPART_OFS_APPEND, |
| 124 | .size = 12 * (64*(2*2048)), |
| 125 | }, |
| 126 | { |
| 127 | .name = "File System", |
| 128 | .offset = MTDPART_OFS_APPEND, |
| 129 | .size = MTDPART_SIZ_FULL, |
| 130 | }, |
| 131 | }; |
| 132 | |
| 133 | static int igep2_onenand_setup(void __iomem *onenand_base, int freq) |
| 134 | { |
| 135 | /* nothing is required to be setup for onenand as of now */ |
| 136 | return 0; |
| 137 | } |
| 138 | |
| 139 | static struct omap_onenand_platform_data igep2_onenand_data = { |
| 140 | .parts = igep2_onenand_partitions, |
| 141 | .nr_parts = ARRAY_SIZE(igep2_onenand_partitions), |
| 142 | .onenand_setup = igep2_onenand_setup, |
| 143 | .dma_channel = -1, /* disable DMA in OMAP OneNAND driver */ |
| 144 | }; |
| 145 | |
| 146 | static struct platform_device igep2_onenand_device = { |
| 147 | .name = "omap2-onenand", |
| 148 | .id = -1, |
| 149 | .dev = { |
| 150 | .platform_data = &igep2_onenand_data, |
| 151 | }, |
| 152 | }; |
| 153 | |
Manjunath Kondaiah G | 04aeae7 | 2010-10-08 09:58:35 -0700 | [diff] [blame] | 154 | static void __init igep2_flash_init(void) |
Enric Balletbo i Serra | cddb483 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 155 | { |
| 156 | u8 cs = 0; |
| 157 | u8 onenandcs = GPMC_CS_NUM + 1; |
| 158 | |
| 159 | while (cs < GPMC_CS_NUM) { |
| 160 | u32 ret = 0; |
| 161 | ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); |
| 162 | |
| 163 | /* Check if NAND/oneNAND is configured */ |
| 164 | if ((ret & 0xC00) == 0x800) |
| 165 | /* NAND found */ |
| 166 | pr_err("IGEP v2: Unsupported NAND found\n"); |
| 167 | else { |
| 168 | ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG7); |
| 169 | if ((ret & 0x3F) == (ONENAND_MAP >> 24)) |
| 170 | /* ONENAND found */ |
| 171 | onenandcs = cs; |
| 172 | } |
| 173 | cs++; |
| 174 | } |
| 175 | if (onenandcs > GPMC_CS_NUM) { |
| 176 | pr_err("IGEP v2: Unable to find configuration in GPMC\n"); |
| 177 | return; |
| 178 | } |
| 179 | |
| 180 | if (onenandcs < GPMC_CS_NUM) { |
| 181 | igep2_onenand_data.cs = onenandcs; |
| 182 | if (platform_device_register(&igep2_onenand_device) < 0) |
| 183 | pr_err("IGEP v2: Unable to register OneNAND device\n"); |
| 184 | } |
| 185 | } |
| 186 | |
| 187 | #else |
Manjunath Kondaiah G | 04aeae7 | 2010-10-08 09:58:35 -0700 | [diff] [blame] | 188 | static void __init igep2_flash_init(void) {} |
Enric Balletbo i Serra | cddb483 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 189 | #endif |
| 190 | |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 191 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) |
| 192 | |
| 193 | #include <linux/smsc911x.h> |
| 194 | |
| 195 | static struct smsc911x_platform_config igep2_smsc911x_config = { |
| 196 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, |
| 197 | .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, |
| 198 | .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS , |
| 199 | .phy_interface = PHY_INTERFACE_MODE_MII, |
| 200 | }; |
| 201 | |
| 202 | static struct resource igep2_smsc911x_resources[] = { |
| 203 | { |
| 204 | .flags = IORESOURCE_MEM, |
| 205 | }, |
| 206 | { |
| 207 | .start = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO), |
| 208 | .end = OMAP_GPIO_IRQ(IGEP2_SMSC911X_GPIO), |
| 209 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, |
| 210 | }, |
| 211 | }; |
| 212 | |
| 213 | static struct platform_device igep2_smsc911x_device = { |
| 214 | .name = "smsc911x", |
| 215 | .id = 0, |
| 216 | .num_resources = ARRAY_SIZE(igep2_smsc911x_resources), |
| 217 | .resource = igep2_smsc911x_resources, |
| 218 | .dev = { |
| 219 | .platform_data = &igep2_smsc911x_config, |
| 220 | }, |
| 221 | }; |
| 222 | |
| 223 | static inline void __init igep2_init_smsc911x(void) |
| 224 | { |
| 225 | unsigned long cs_mem_base; |
| 226 | |
| 227 | if (gpmc_cs_request(IGEP2_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) { |
| 228 | pr_err("IGEP v2: Failed request for GPMC mem for smsc911x\n"); |
| 229 | gpmc_cs_free(IGEP2_SMSC911X_CS); |
| 230 | return; |
| 231 | } |
| 232 | |
| 233 | igep2_smsc911x_resources[0].start = cs_mem_base + 0x0; |
| 234 | igep2_smsc911x_resources[0].end = cs_mem_base + 0xff; |
| 235 | |
| 236 | if ((gpio_request(IGEP2_SMSC911X_GPIO, "SMSC911X IRQ") == 0) && |
| 237 | (gpio_direction_input(IGEP2_SMSC911X_GPIO) == 0)) { |
| 238 | gpio_export(IGEP2_SMSC911X_GPIO, 0); |
| 239 | } else { |
| 240 | pr_err("IGEP v2: Could not obtain gpio for for SMSC911X IRQ\n"); |
| 241 | return; |
| 242 | } |
| 243 | |
| 244 | platform_device_register(&igep2_smsc911x_device); |
| 245 | } |
| 246 | |
| 247 | #else |
| 248 | static inline void __init igep2_init_smsc911x(void) { } |
| 249 | #endif |
| 250 | |
| 251 | static struct omap_board_config_kernel igep2_config[] __initdata = { |
| 252 | }; |
| 253 | |
| 254 | static struct regulator_consumer_supply igep2_vmmc1_supply = { |
| 255 | .supply = "vmmc", |
| 256 | }; |
| 257 | |
Jonas Zetterberg | c67b0d9 | 2010-02-14 19:33:24 +0000 | [diff] [blame] | 258 | static struct regulator_consumer_supply igep2_vmmc2_supply = { |
| 259 | .supply = "vmmc", |
| 260 | }; |
| 261 | |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 262 | /* VMMC1 for OMAP VDD_MMC1 (i/o) and MMC1 card */ |
| 263 | static struct regulator_init_data igep2_vmmc1 = { |
| 264 | .constraints = { |
| 265 | .min_uV = 1850000, |
| 266 | .max_uV = 3150000, |
| 267 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 268 | | REGULATOR_MODE_STANDBY, |
| 269 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 270 | | REGULATOR_CHANGE_MODE |
| 271 | | REGULATOR_CHANGE_STATUS, |
| 272 | }, |
| 273 | .num_consumer_supplies = 1, |
| 274 | .consumer_supplies = &igep2_vmmc1_supply, |
| 275 | }; |
| 276 | |
Jonas Zetterberg | c67b0d9 | 2010-02-14 19:33:24 +0000 | [diff] [blame] | 277 | /* VMMC2 for OMAP VDD_MMC2 (i/o) and MMC2 WIFI */ |
| 278 | static struct regulator_init_data igep2_vmmc2 = { |
| 279 | .constraints = { |
| 280 | .min_uV = 1850000, |
| 281 | .max_uV = 3150000, |
| 282 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 283 | | REGULATOR_MODE_STANDBY, |
| 284 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 285 | | REGULATOR_CHANGE_MODE |
| 286 | | REGULATOR_CHANGE_STATUS, |
| 287 | }, |
| 288 | .num_consumer_supplies = 1, |
| 289 | .consumer_supplies = &igep2_vmmc2_supply, |
| 290 | }; |
| 291 | |
Adrian Hunter | 68ff042 | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 292 | static struct omap2_hsmmc_info mmc[] = { |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 293 | { |
| 294 | .mmc = 1, |
Sukumar Ghorai | 3a63833 | 2010-09-15 14:49:23 +0000 | [diff] [blame] | 295 | .caps = MMC_CAP_4_BIT_DATA, |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 296 | .gpio_cd = -EINVAL, |
| 297 | .gpio_wp = -EINVAL, |
| 298 | }, |
| 299 | { |
| 300 | .mmc = 2, |
Sukumar Ghorai | 3a63833 | 2010-09-15 14:49:23 +0000 | [diff] [blame] | 301 | .caps = MMC_CAP_4_BIT_DATA, |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 302 | .gpio_cd = -EINVAL, |
| 303 | .gpio_wp = -EINVAL, |
| 304 | }, |
| 305 | {} /* Terminator */ |
| 306 | }; |
| 307 | |
Enric Balletbo i Serra | bee1539 | 2010-10-08 10:22:28 -0700 | [diff] [blame] | 308 | #if defined(CONFIG_LEDS_GPIO) || defined(CONFIG_LEDS_GPIO_MODULE) |
| 309 | #include <linux/leds.h> |
| 310 | |
| 311 | static struct gpio_led igep2_gpio_leds[] = { |
| 312 | [0] = { |
| 313 | .name = "gpio-led:red:d0", |
| 314 | .gpio = IGEP2_GPIO_LED0_RED, |
| 315 | .default_trigger = "default-off" |
| 316 | }, |
| 317 | [1] = { |
| 318 | .name = "gpio-led:green:d0", |
| 319 | .gpio = IGEP2_GPIO_LED0_GREEN, |
| 320 | .default_trigger = "default-off", |
| 321 | }, |
| 322 | [2] = { |
| 323 | .name = "gpio-led:red:d1", |
| 324 | .gpio = IGEP2_GPIO_LED1_RED, |
| 325 | .default_trigger = "default-off", |
| 326 | }, |
| 327 | [3] = { |
| 328 | .name = "gpio-led:green:d1", |
| 329 | .default_trigger = "heartbeat", |
| 330 | .gpio = -EINVAL, /* gets replaced */ |
| 331 | }, |
| 332 | }; |
| 333 | |
| 334 | static struct gpio_led_platform_data igep2_led_pdata = { |
| 335 | .leds = igep2_gpio_leds, |
| 336 | .num_leds = ARRAY_SIZE(igep2_gpio_leds), |
| 337 | }; |
| 338 | |
| 339 | static struct platform_device igep2_led_device = { |
| 340 | .name = "leds-gpio", |
| 341 | .id = -1, |
| 342 | .dev = { |
| 343 | .platform_data = &igep2_led_pdata, |
| 344 | }, |
| 345 | }; |
| 346 | |
| 347 | static void __init igep2_leds_init(void) |
| 348 | { |
| 349 | platform_device_register(&igep2_led_device); |
| 350 | } |
| 351 | |
| 352 | #else |
| 353 | static inline void igep2_leds_init(void) |
| 354 | { |
| 355 | if ((gpio_request(IGEP2_GPIO_LED0_RED, "gpio-led:red:d0") == 0) && |
| 356 | (gpio_direction_output(IGEP2_GPIO_LED0_RED, 1) == 0)) { |
| 357 | gpio_export(IGEP2_GPIO_LED0_RED, 0); |
| 358 | gpio_set_value(IGEP2_GPIO_LED0_RED, 0); |
| 359 | } else |
| 360 | pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_RED\n"); |
| 361 | |
| 362 | if ((gpio_request(IGEP2_GPIO_LED0_GREEN, "gpio-led:green:d0") == 0) && |
| 363 | (gpio_direction_output(IGEP2_GPIO_LED0_GREEN, 1) == 0)) { |
| 364 | gpio_export(IGEP2_GPIO_LED0_GREEN, 0); |
| 365 | gpio_set_value(IGEP2_GPIO_LED0_GREEN, 0); |
| 366 | } else |
| 367 | pr_warning("IGEP v2: Could not obtain gpio GPIO_LED0_GREEN\n"); |
| 368 | |
| 369 | if ((gpio_request(IGEP2_GPIO_LED1_RED, "gpio-led:red:d1") == 0) && |
| 370 | (gpio_direction_output(IGEP2_GPIO_LED1_RED, 1) == 0)) { |
| 371 | gpio_export(IGEP2_GPIO_LED1_RED, 0); |
| 372 | gpio_set_value(IGEP2_GPIO_LED1_RED, 0); |
| 373 | } else |
| 374 | pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_RED\n"); |
| 375 | |
| 376 | } |
| 377 | #endif |
| 378 | |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 379 | static int igep2_twl_gpio_setup(struct device *dev, |
| 380 | unsigned gpio, unsigned ngpio) |
| 381 | { |
| 382 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ |
| 383 | mmc[0].gpio_cd = gpio + 0; |
Adrian Hunter | 68ff042 | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 384 | omap2_hsmmc_init(mmc); |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 385 | |
| 386 | /* link regulators to MMC adapters ... we "know" the |
| 387 | * regulators will be set up only *after* we return. |
| 388 | */ |
| 389 | igep2_vmmc1_supply.dev = mmc[0].dev; |
Jonas Zetterberg | c67b0d9 | 2010-02-14 19:33:24 +0000 | [diff] [blame] | 390 | igep2_vmmc2_supply.dev = mmc[1].dev; |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 391 | |
Enric Balletbo i Serra | 61e118d | 2010-10-08 10:22:19 -0700 | [diff] [blame] | 392 | /* |
| 393 | * REVISIT: need ehci-omap hooks for external VBUS |
| 394 | * power switch and overcurrent detect |
| 395 | */ |
| 396 | if ((gpio_request(gpio + 1, "GPIO_EHCI_NOC") < 0) || |
| 397 | (gpio_direction_input(gpio + 1) < 0)) |
| 398 | pr_err("IGEP2: Could not obtain gpio for EHCI NOC"); |
| 399 | |
| 400 | /* |
| 401 | * TWL4030_GPIO_MAX + 0 == ledA, GPIO_USBH_CPEN |
| 402 | * (out, active low) |
| 403 | */ |
| 404 | if ((gpio_request(gpio + TWL4030_GPIO_MAX, "GPIO_USBH_CPEN") < 0) || |
| 405 | (gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0) < 0)) |
| 406 | pr_err("IGEP2: Could not obtain gpio for USBH_CPEN"); |
| 407 | |
Enric Balletbo i Serra | bee1539 | 2010-10-08 10:22:28 -0700 | [diff] [blame] | 408 | /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ |
| 409 | #if !defined(CONFIG_LEDS_GPIO) && !defined(CONFIG_LEDS_GPIO_MODULE) |
| 410 | if ((gpio_request(gpio+TWL4030_GPIO_MAX+1, "gpio-led:green:d1") == 0) |
| 411 | && (gpio_direction_output(gpio + TWL4030_GPIO_MAX + 1, 1) == 0)) { |
| 412 | gpio_export(gpio + TWL4030_GPIO_MAX + 1, 0); |
| 413 | gpio_set_value(gpio + TWL4030_GPIO_MAX + 1, 0); |
| 414 | } else |
| 415 | pr_warning("IGEP v2: Could not obtain gpio GPIO_LED1_GREEN\n"); |
| 416 | #else |
| 417 | igep2_gpio_leds[3].gpio = gpio + TWL4030_GPIO_MAX + 1; |
| 418 | #endif |
| 419 | |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 420 | return 0; |
| 421 | }; |
| 422 | |
Enric Balletbo i Serra | bee1539 | 2010-10-08 10:22:28 -0700 | [diff] [blame] | 423 | static struct twl4030_gpio_platform_data igep2_twl4030_gpio_pdata = { |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 424 | .gpio_base = OMAP_MAX_GPIO_LINES, |
| 425 | .irq_base = TWL4030_GPIO_IRQ_BASE, |
| 426 | .irq_end = TWL4030_GPIO_IRQ_END, |
Enric Balletbo i Serra | bee1539 | 2010-10-08 10:22:28 -0700 | [diff] [blame] | 427 | .use_leds = true, |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 428 | .setup = igep2_twl_gpio_setup, |
| 429 | }; |
| 430 | |
| 431 | static struct twl4030_usb_data igep2_usb_data = { |
| 432 | .usb_mode = T2_USB_MODE_ULPI, |
| 433 | }; |
| 434 | |
Enric Balletbo i Serra | 691de27 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 435 | static int igep2_enable_dvi(struct omap_dss_device *dssdev) |
| 436 | { |
| 437 | gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1); |
| 438 | |
| 439 | return 0; |
| 440 | } |
| 441 | |
| 442 | static void igep2_disable_dvi(struct omap_dss_device *dssdev) |
| 443 | { |
| 444 | gpio_direction_output(IGEP2_GPIO_DVI_PUP, 0); |
| 445 | } |
| 446 | |
| 447 | static struct omap_dss_device igep2_dvi_device = { |
| 448 | .type = OMAP_DISPLAY_TYPE_DPI, |
| 449 | .name = "dvi", |
| 450 | .driver_name = "generic_panel", |
| 451 | .phy.dpi.data_lines = 24, |
| 452 | .platform_enable = igep2_enable_dvi, |
| 453 | .platform_disable = igep2_disable_dvi, |
| 454 | }; |
| 455 | |
| 456 | static struct omap_dss_device *igep2_dss_devices[] = { |
| 457 | &igep2_dvi_device |
| 458 | }; |
| 459 | |
| 460 | static struct omap_dss_board_info igep2_dss_data = { |
| 461 | .num_devices = ARRAY_SIZE(igep2_dss_devices), |
| 462 | .devices = igep2_dss_devices, |
| 463 | .default_device = &igep2_dvi_device, |
| 464 | }; |
| 465 | |
| 466 | static struct platform_device igep2_dss_device = { |
| 467 | .name = "omapdss", |
| 468 | .id = -1, |
| 469 | .dev = { |
| 470 | .platform_data = &igep2_dss_data, |
| 471 | }, |
| 472 | }; |
| 473 | |
| 474 | static struct regulator_consumer_supply igep2_vpll2_supply = { |
| 475 | .supply = "vdds_dsi", |
| 476 | .dev = &igep2_dss_device.dev, |
| 477 | }; |
| 478 | |
| 479 | static struct regulator_init_data igep2_vpll2 = { |
| 480 | .constraints = { |
| 481 | .name = "VDVI", |
| 482 | .min_uV = 1800000, |
| 483 | .max_uV = 1800000, |
| 484 | .apply_uV = true, |
| 485 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 486 | | REGULATOR_MODE_STANDBY, |
| 487 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 488 | | REGULATOR_CHANGE_STATUS, |
| 489 | }, |
| 490 | .num_consumer_supplies = 1, |
| 491 | .consumer_supplies = &igep2_vpll2_supply, |
| 492 | }; |
| 493 | |
| 494 | static void __init igep2_display_init(void) |
| 495 | { |
| 496 | if (gpio_request(IGEP2_GPIO_DVI_PUP, "GPIO_DVI_PUP") && |
| 497 | gpio_direction_output(IGEP2_GPIO_DVI_PUP, 1)) |
| 498 | pr_err("IGEP v2: Could not obtain gpio GPIO_DVI_PUP\n"); |
| 499 | } |
Enric Balletbo i Serra | 228893f | 2010-03-01 11:18:08 +0000 | [diff] [blame] | 500 | |
Enric Balletbo i Serra | 691de27 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 501 | static struct platform_device *igep2_devices[] __initdata = { |
| 502 | &igep2_dss_device, |
| 503 | }; |
| 504 | |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 505 | static void __init igep2_init_irq(void) |
| 506 | { |
| 507 | omap_board_config = igep2_config; |
| 508 | omap_board_config_size = ARRAY_SIZE(igep2_config); |
Enric Balletbo i Serra | 22f1baa | 2010-02-17 14:09:27 -0800 | [diff] [blame] | 509 | omap2_init_common_hw(m65kxxxxam_sdrc_params, m65kxxxxam_sdrc_params); |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 510 | omap_init_irq(); |
| 511 | omap_gpio_init(); |
| 512 | } |
| 513 | |
Enric Balletbo i Serra | 7f5f23d | 2010-02-17 14:09:25 -0800 | [diff] [blame] | 514 | static struct twl4030_codec_audio_data igep2_audio_data = { |
| 515 | .audio_mclk = 26000000, |
| 516 | }; |
| 517 | |
| 518 | static struct twl4030_codec_data igep2_codec_data = { |
| 519 | .audio_mclk = 26000000, |
| 520 | .audio = &igep2_audio_data, |
| 521 | }; |
| 522 | |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 523 | static struct twl4030_platform_data igep2_twldata = { |
| 524 | .irq_base = TWL4030_IRQ_BASE, |
| 525 | .irq_end = TWL4030_IRQ_END, |
| 526 | |
| 527 | /* platform_data for children goes here */ |
| 528 | .usb = &igep2_usb_data, |
Enric Balletbo i Serra | 7f5f23d | 2010-02-17 14:09:25 -0800 | [diff] [blame] | 529 | .codec = &igep2_codec_data, |
Enric Balletbo i Serra | bee1539 | 2010-10-08 10:22:28 -0700 | [diff] [blame] | 530 | .gpio = &igep2_twl4030_gpio_pdata, |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 531 | .vmmc1 = &igep2_vmmc1, |
Jonas Zetterberg | c67b0d9 | 2010-02-14 19:33:24 +0000 | [diff] [blame] | 532 | .vmmc2 = &igep2_vmmc2, |
Enric Balletbo i Serra | 691de27 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 533 | .vpll2 = &igep2_vpll2, |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 534 | |
| 535 | }; |
| 536 | |
| 537 | static struct i2c_board_info __initdata igep2_i2c_boardinfo[] = { |
| 538 | { |
| 539 | I2C_BOARD_INFO("twl4030", 0x48), |
| 540 | .flags = I2C_CLIENT_WAKE, |
| 541 | .irq = INT_34XX_SYS_NIRQ, |
| 542 | .platform_data = &igep2_twldata, |
| 543 | }, |
| 544 | }; |
| 545 | |
| 546 | static int __init igep2_i2c_init(void) |
| 547 | { |
| 548 | omap_register_i2c_bus(1, 2600, igep2_i2c_boardinfo, |
| 549 | ARRAY_SIZE(igep2_i2c_boardinfo)); |
| 550 | /* Bus 3 is attached to the DVI port where devices like the pico DLP |
| 551 | * projector don't work reliably with 400kHz */ |
| 552 | omap_register_i2c_bus(3, 100, NULL, 0); |
| 553 | return 0; |
| 554 | } |
| 555 | |
Maulik Mankad | 884b836 | 2010-02-17 14:09:30 -0800 | [diff] [blame] | 556 | static struct omap_musb_board_data musb_board_data = { |
| 557 | .interface_type = MUSB_INTERFACE_ULPI, |
| 558 | .mode = MUSB_OTG, |
| 559 | .power = 100, |
| 560 | }; |
| 561 | |
Felipe Balbi | 6f69a18 | 2010-03-04 09:45:53 +0200 | [diff] [blame] | 562 | static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { |
Enric Balletbo i Serra | f6b7453 | 2010-03-01 15:02:36 +0000 | [diff] [blame] | 563 | .port_mode[0] = EHCI_HCD_OMAP_MODE_PHY, |
| 564 | .port_mode[1] = EHCI_HCD_OMAP_MODE_UNKNOWN, |
Enric Balletbo i Serra | d0885486 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 565 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, |
| 566 | |
| 567 | .phy_reset = true, |
Enric Balletbo i Serra | f6b7453 | 2010-03-01 15:02:36 +0000 | [diff] [blame] | 568 | .reset_gpio_port[0] = IGEP2_GPIO_USBH_NRESET, |
| 569 | .reset_gpio_port[1] = -EINVAL, |
Enric Balletbo i Serra | d0885486 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 570 | .reset_gpio_port[2] = -EINVAL, |
| 571 | }; |
| 572 | |
Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 573 | #ifdef CONFIG_OMAP_MUX |
| 574 | static struct omap_board_mux board_mux[] __initdata = { |
| 575 | { .reg_offset = OMAP_MUX_TERMINATOR }, |
| 576 | }; |
| 577 | #else |
| 578 | #define board_mux NULL |
| 579 | #endif |
| 580 | |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 581 | static void __init igep2_init(void) |
| 582 | { |
Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 583 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
Enric Balletbo i Serra | 3f8c48d | 2010-10-08 10:22:35 -0700 | [diff] [blame^] | 584 | |
| 585 | /* Get IGEP2 hardware revision */ |
| 586 | igep2_get_revision(); |
| 587 | |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 588 | igep2_i2c_init(); |
Enric Balletbo i Serra | 691de27 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 589 | platform_add_devices(igep2_devices, ARRAY_SIZE(igep2_devices)); |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 590 | omap_serial_init(); |
Maulik Mankad | 884b836 | 2010-02-17 14:09:30 -0800 | [diff] [blame] | 591 | usb_musb_init(&musb_board_data); |
Enric Balletbo i Serra | d0885486 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 592 | usb_ehci_init(&ehci_pdata); |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 593 | |
Enric Balletbo i Serra | cddb483 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 594 | igep2_flash_init(); |
Enric Balletbo i Serra | bee1539 | 2010-10-08 10:22:28 -0700 | [diff] [blame] | 595 | igep2_leds_init(); |
Enric Balletbo i Serra | 691de27 | 2010-02-17 14:09:26 -0800 | [diff] [blame] | 596 | igep2_display_init(); |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 597 | igep2_init_smsc911x(); |
| 598 | |
Jonas Zetterberg | c67b0d9 | 2010-02-14 19:33:24 +0000 | [diff] [blame] | 599 | /* GPIO W-LAN + Bluetooth combo module */ |
| 600 | if ((gpio_request(IGEP2_GPIO_WIFI_NPD, "GPIO_WIFI_NPD") == 0) && |
| 601 | (gpio_direction_output(IGEP2_GPIO_WIFI_NPD, 1) == 0)) { |
| 602 | gpio_export(IGEP2_GPIO_WIFI_NPD, 0); |
| 603 | /* gpio_set_value(IGEP2_GPIO_WIFI_NPD, 0); */ |
| 604 | } else |
| 605 | pr_warning("IGEP v2: Could not obtain gpio GPIO_WIFI_NPD\n"); |
| 606 | |
| 607 | if ((gpio_request(IGEP2_GPIO_WIFI_NRESET, "GPIO_WIFI_NRESET") == 0) && |
| 608 | (gpio_direction_output(IGEP2_GPIO_WIFI_NRESET, 1) == 0)) { |
| 609 | gpio_export(IGEP2_GPIO_WIFI_NRESET, 0); |
| 610 | gpio_set_value(IGEP2_GPIO_WIFI_NRESET, 0); |
| 611 | udelay(10); |
| 612 | gpio_set_value(IGEP2_GPIO_WIFI_NRESET, 1); |
| 613 | } else |
| 614 | pr_warning("IGEP v2: Could not obtain gpio GPIO_WIFI_NRESET\n"); |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 615 | } |
| 616 | |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 617 | MACHINE_START(IGEP0020, "IGEP v2 board") |
| 618 | .phys_io = 0x48000000, |
| 619 | .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, |
| 620 | .boot_params = 0x80000100, |
Mike Rapoport | 869fef4 | 2010-08-04 14:43:18 +0300 | [diff] [blame] | 621 | .map_io = omap3_map_io, |
Russell King | 71ee7da | 2010-05-23 10:18:16 +0100 | [diff] [blame] | 622 | .reserve = omap_reserve, |
Enric Balletbo i Serra | 58e1116 | 2009-11-18 18:41:07 -0800 | [diff] [blame] | 623 | .init_irq = igep2_init_irq, |
| 624 | .init_machine = igep2_init, |
| 625 | .timer = &omap_timer, |
| 626 | MACHINE_END |