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