Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 1 | /* |
| 2 | * board-overo.c (Gumstix Overo) |
| 3 | * |
| 4 | * Initial code: Steve Sakoman <steve@sakoman.com> |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or |
| 7 | * modify it under the terms of the GNU General Public License |
| 8 | * version 2 as published by the Free Software Foundation. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, but |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 13 | * General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program; if not, write to the Free Software |
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA |
| 18 | * 02110-1301 USA |
| 19 | * |
| 20 | */ |
| 21 | |
| 22 | #include <linux/clk.h> |
| 23 | #include <linux/delay.h> |
| 24 | #include <linux/err.h> |
| 25 | #include <linux/init.h> |
| 26 | #include <linux/io.h> |
| 27 | #include <linux/kernel.h> |
| 28 | #include <linux/platform_device.h> |
Santosh Shilimkar | b07682b | 2009-12-13 20:05:51 +0100 | [diff] [blame] | 29 | #include <linux/i2c/twl.h> |
David Brownell | bb3b9d8 | 2009-05-28 14:04:03 -0700 | [diff] [blame] | 30 | #include <linux/regulator/machine.h> |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 31 | |
| 32 | #include <linux/mtd/mtd.h> |
| 33 | #include <linux/mtd/nand.h> |
| 34 | #include <linux/mtd/partitions.h> |
| 35 | |
| 36 | #include <asm/mach-types.h> |
| 37 | #include <asm/mach/arch.h> |
| 38 | #include <asm/mach/flash.h> |
| 39 | #include <asm/mach/map.h> |
| 40 | |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 41 | #include <plat/board.h> |
| 42 | #include <plat/common.h> |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 43 | #include <mach/gpio.h> |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 44 | #include <plat/gpmc.h> |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 45 | #include <mach/hardware.h> |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 46 | #include <plat/nand.h> |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 47 | #include <plat/usb.h> |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 48 | |
Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 49 | #include "mux.h" |
Paul Walmsley | 2e12bd7 | 2009-05-28 14:03:59 -0700 | [diff] [blame] | 50 | #include "sdram-micron-mt46h32m32lf-6.h" |
Adrian Hunter | d02a900 | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 51 | #include "hsmmc.h" |
Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 52 | |
Tony Lindgren | 0d4d9ab | 2009-03-23 18:07:38 -0700 | [diff] [blame] | 53 | #define OVERO_GPIO_BT_XGATE 15 |
| 54 | #define OVERO_GPIO_W2W_NRESET 16 |
Kevin Hilman | 6fd210a | 2009-07-20 09:09:23 -0700 | [diff] [blame] | 55 | #define OVERO_GPIO_PENDOWN 114 |
Tony Lindgren | 0d4d9ab | 2009-03-23 18:07:38 -0700 | [diff] [blame] | 56 | #define OVERO_GPIO_BT_NRESET 164 |
| 57 | #define OVERO_GPIO_USBH_CPEN 168 |
| 58 | #define OVERO_GPIO_USBH_NRESET 183 |
| 59 | |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 60 | #define NAND_BLOCK_SIZE SZ_128K |
| 61 | #define GPMC_CS0_BASE 0x60 |
| 62 | #define GPMC_CS_SIZE 0x30 |
| 63 | |
Steve Sakoman | 172ef27 | 2009-02-02 06:27:49 +0000 | [diff] [blame] | 64 | #define OVERO_SMSC911X_CS 5 |
| 65 | #define OVERO_SMSC911X_GPIO 176 |
| 66 | |
Steve Sakoman | c6a8131 | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 67 | #if defined(CONFIG_TOUCHSCREEN_ADS7846) || \ |
| 68 | defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) |
| 69 | |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 70 | #include <plat/mcspi.h> |
Steve Sakoman | c6a8131 | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 71 | #include <linux/spi/spi.h> |
| 72 | #include <linux/spi/ads7846.h> |
| 73 | |
| 74 | static struct omap2_mcspi_device_config ads7846_mcspi_config = { |
| 75 | .turbo_mode = 0, |
| 76 | .single_channel = 1, /* 0: slave, 1: master */ |
| 77 | }; |
| 78 | |
| 79 | static int ads7846_get_pendown_state(void) |
| 80 | { |
| 81 | return !gpio_get_value(OVERO_GPIO_PENDOWN); |
| 82 | } |
| 83 | |
| 84 | static struct ads7846_platform_data ads7846_config = { |
| 85 | .x_max = 0x0fff, |
| 86 | .y_max = 0x0fff, |
| 87 | .x_plate_ohms = 180, |
| 88 | .pressure_max = 255, |
| 89 | .debounce_max = 10, |
| 90 | .debounce_tol = 3, |
| 91 | .debounce_rep = 1, |
| 92 | .get_pendown_state = ads7846_get_pendown_state, |
| 93 | .keep_vref_on = 1, |
| 94 | }; |
| 95 | |
| 96 | static struct spi_board_info overo_spi_board_info[] __initdata = { |
| 97 | { |
| 98 | .modalias = "ads7846", |
| 99 | .bus_num = 1, |
| 100 | .chip_select = 0, |
| 101 | .max_speed_hz = 1500000, |
| 102 | .controller_data = &ads7846_mcspi_config, |
| 103 | .irq = OMAP_GPIO_IRQ(OVERO_GPIO_PENDOWN), |
| 104 | .platform_data = &ads7846_config, |
| 105 | } |
| 106 | }; |
| 107 | |
| 108 | static void __init overo_ads7846_init(void) |
| 109 | { |
| 110 | if ((gpio_request(OVERO_GPIO_PENDOWN, "ADS7846_PENDOWN") == 0) && |
| 111 | (gpio_direction_input(OVERO_GPIO_PENDOWN) == 0)) { |
| 112 | gpio_export(OVERO_GPIO_PENDOWN, 0); |
| 113 | } else { |
| 114 | printk(KERN_ERR "could not obtain gpio for ADS7846_PENDOWN\n"); |
| 115 | return; |
| 116 | } |
| 117 | |
| 118 | spi_register_board_info(overo_spi_board_info, |
| 119 | ARRAY_SIZE(overo_spi_board_info)); |
| 120 | } |
| 121 | |
| 122 | #else |
| 123 | static inline void __init overo_ads7846_init(void) { return; } |
| 124 | #endif |
| 125 | |
Steve Sakoman | 172ef27 | 2009-02-02 06:27:49 +0000 | [diff] [blame] | 126 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) |
| 127 | |
| 128 | #include <linux/smsc911x.h> |
| 129 | |
| 130 | static struct resource overo_smsc911x_resources[] = { |
| 131 | { |
| 132 | .name = "smsc911x-memory", |
| 133 | .flags = IORESOURCE_MEM, |
| 134 | }, |
| 135 | { |
| 136 | .flags = IORESOURCE_IRQ | IORESOURCE_IRQ_LOWLEVEL, |
| 137 | }, |
| 138 | }; |
| 139 | |
| 140 | static struct smsc911x_platform_config overo_smsc911x_config = { |
| 141 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, |
| 142 | .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, |
| 143 | .flags = SMSC911X_USE_32BIT , |
| 144 | .phy_interface = PHY_INTERFACE_MODE_MII, |
| 145 | }; |
| 146 | |
| 147 | static struct platform_device overo_smsc911x_device = { |
| 148 | .name = "smsc911x", |
| 149 | .id = -1, |
| 150 | .num_resources = ARRAY_SIZE(overo_smsc911x_resources), |
Sergio Aguirre | 5032902 | 2009-08-10 14:49:50 +0300 | [diff] [blame] | 151 | .resource = overo_smsc911x_resources, |
Steve Sakoman | 172ef27 | 2009-02-02 06:27:49 +0000 | [diff] [blame] | 152 | .dev = { |
| 153 | .platform_data = &overo_smsc911x_config, |
| 154 | }, |
| 155 | }; |
| 156 | |
| 157 | static inline void __init overo_init_smsc911x(void) |
| 158 | { |
| 159 | unsigned long cs_mem_base; |
| 160 | |
| 161 | if (gpmc_cs_request(OVERO_SMSC911X_CS, SZ_16M, &cs_mem_base) < 0) { |
| 162 | printk(KERN_ERR "Failed request for GPMC mem for smsc911x\n"); |
| 163 | return; |
| 164 | } |
| 165 | |
| 166 | overo_smsc911x_resources[0].start = cs_mem_base + 0x0; |
| 167 | overo_smsc911x_resources[0].end = cs_mem_base + 0xff; |
| 168 | |
| 169 | if ((gpio_request(OVERO_SMSC911X_GPIO, "SMSC911X IRQ") == 0) && |
| 170 | (gpio_direction_input(OVERO_SMSC911X_GPIO) == 0)) { |
| 171 | gpio_export(OVERO_SMSC911X_GPIO, 0); |
| 172 | } else { |
| 173 | printk(KERN_ERR "could not obtain gpio for SMSC911X IRQ\n"); |
| 174 | return; |
| 175 | } |
| 176 | |
| 177 | overo_smsc911x_resources[1].start = OMAP_GPIO_IRQ(OVERO_SMSC911X_GPIO); |
| 178 | overo_smsc911x_resources[1].end = 0; |
| 179 | |
| 180 | platform_device_register(&overo_smsc911x_device); |
| 181 | } |
| 182 | |
| 183 | #else |
| 184 | static inline void __init overo_init_smsc911x(void) { return; } |
| 185 | #endif |
| 186 | |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 187 | static struct mtd_partition overo_nand_partitions[] = { |
| 188 | { |
| 189 | .name = "xloader", |
| 190 | .offset = 0, /* Offset = 0x00000 */ |
| 191 | .size = 4 * NAND_BLOCK_SIZE, |
| 192 | .mask_flags = MTD_WRITEABLE |
| 193 | }, |
| 194 | { |
| 195 | .name = "uboot", |
| 196 | .offset = MTDPART_OFS_APPEND, /* Offset = 0x80000 */ |
| 197 | .size = 14 * NAND_BLOCK_SIZE, |
| 198 | }, |
| 199 | { |
| 200 | .name = "uboot environment", |
| 201 | .offset = MTDPART_OFS_APPEND, /* Offset = 0x240000 */ |
| 202 | .size = 2 * NAND_BLOCK_SIZE, |
| 203 | }, |
| 204 | { |
| 205 | .name = "linux", |
| 206 | .offset = MTDPART_OFS_APPEND, /* Offset = 0x280000 */ |
| 207 | .size = 32 * NAND_BLOCK_SIZE, |
| 208 | }, |
| 209 | { |
| 210 | .name = "rootfs", |
| 211 | .offset = MTDPART_OFS_APPEND, /* Offset = 0x680000 */ |
| 212 | .size = MTDPART_SIZ_FULL, |
| 213 | }, |
| 214 | }; |
| 215 | |
| 216 | static struct omap_nand_platform_data overo_nand_data = { |
| 217 | .parts = overo_nand_partitions, |
| 218 | .nr_parts = ARRAY_SIZE(overo_nand_partitions), |
| 219 | .dma_channel = -1, /* disable DMA in OMAP NAND driver */ |
| 220 | }; |
| 221 | |
| 222 | static struct resource overo_nand_resource = { |
| 223 | .flags = IORESOURCE_MEM, |
| 224 | }; |
| 225 | |
| 226 | static struct platform_device overo_nand_device = { |
| 227 | .name = "omap2-nand", |
| 228 | .id = -1, |
| 229 | .dev = { |
| 230 | .platform_data = &overo_nand_data, |
| 231 | }, |
| 232 | .num_resources = 1, |
| 233 | .resource = &overo_nand_resource, |
| 234 | }; |
| 235 | |
| 236 | |
| 237 | static void __init overo_flash_init(void) |
| 238 | { |
| 239 | u8 cs = 0; |
| 240 | u8 nandcs = GPMC_CS_NUM + 1; |
| 241 | |
| 242 | u32 gpmc_base_add = OMAP34XX_GPMC_VIRT; |
| 243 | |
| 244 | /* find out the chip-select on which NAND exists */ |
| 245 | while (cs < GPMC_CS_NUM) { |
| 246 | u32 ret = 0; |
| 247 | ret = gpmc_cs_read_reg(cs, GPMC_CS_CONFIG1); |
| 248 | |
| 249 | if ((ret & 0xC00) == 0x800) { |
| 250 | printk(KERN_INFO "Found NAND on CS%d\n", cs); |
| 251 | if (nandcs > GPMC_CS_NUM) |
| 252 | nandcs = cs; |
| 253 | } |
| 254 | cs++; |
| 255 | } |
| 256 | |
| 257 | if (nandcs > GPMC_CS_NUM) { |
| 258 | printk(KERN_INFO "NAND: Unable to find configuration " |
| 259 | "in GPMC\n "); |
| 260 | return; |
| 261 | } |
| 262 | |
| 263 | if (nandcs < GPMC_CS_NUM) { |
| 264 | overo_nand_data.cs = nandcs; |
| 265 | overo_nand_data.gpmc_cs_baseaddr = (void *) |
| 266 | (gpmc_base_add + GPMC_CS0_BASE + nandcs * GPMC_CS_SIZE); |
| 267 | overo_nand_data.gpmc_baseaddr = (void *) (gpmc_base_add); |
| 268 | |
| 269 | printk(KERN_INFO "Registering NAND on CS%d\n", nandcs); |
| 270 | if (platform_device_register(&overo_nand_device) < 0) |
| 271 | printk(KERN_ERR "Unable to register NAND device\n"); |
| 272 | } |
| 273 | } |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 274 | |
Adrian Hunter | 68ff042 | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 275 | static struct omap2_hsmmc_info mmc[] = { |
David Brownell | bb3b9d8 | 2009-05-28 14:04:03 -0700 | [diff] [blame] | 276 | { |
| 277 | .mmc = 1, |
| 278 | .wires = 4, |
| 279 | .gpio_cd = -EINVAL, |
| 280 | .gpio_wp = -EINVAL, |
| 281 | }, |
| 282 | { |
| 283 | .mmc = 2, |
| 284 | .wires = 4, |
| 285 | .gpio_cd = -EINVAL, |
| 286 | .gpio_wp = -EINVAL, |
| 287 | .transceiver = true, |
| 288 | .ocr_mask = 0x00100000, /* 3.3V */ |
| 289 | }, |
| 290 | {} /* Terminator */ |
| 291 | }; |
| 292 | |
| 293 | static struct regulator_consumer_supply overo_vmmc1_supply = { |
| 294 | .supply = "vmmc", |
| 295 | }; |
| 296 | |
| 297 | static int overo_twl_gpio_setup(struct device *dev, |
| 298 | unsigned gpio, unsigned ngpio) |
| 299 | { |
Adrian Hunter | 68ff042 | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 300 | omap2_hsmmc_init(mmc); |
David Brownell | bb3b9d8 | 2009-05-28 14:04:03 -0700 | [diff] [blame] | 301 | |
| 302 | overo_vmmc1_supply.dev = mmc[0].dev; |
| 303 | |
| 304 | return 0; |
| 305 | } |
| 306 | |
Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 307 | static struct twl4030_gpio_platform_data overo_gpio_data = { |
| 308 | .gpio_base = OMAP_MAX_GPIO_LINES, |
| 309 | .irq_base = TWL4030_GPIO_IRQ_BASE, |
| 310 | .irq_end = TWL4030_GPIO_IRQ_END, |
David Brownell | bb3b9d8 | 2009-05-28 14:04:03 -0700 | [diff] [blame] | 311 | .setup = overo_twl_gpio_setup, |
Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 312 | }; |
| 313 | |
David Brownell | bb3b9d8 | 2009-05-28 14:04:03 -0700 | [diff] [blame] | 314 | static struct twl4030_usb_data overo_usb_data = { |
| 315 | .usb_mode = T2_USB_MODE_ULPI, |
| 316 | }; |
| 317 | |
| 318 | static struct regulator_init_data overo_vmmc1 = { |
| 319 | .constraints = { |
| 320 | .min_uV = 1850000, |
| 321 | .max_uV = 3150000, |
| 322 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 323 | | REGULATOR_MODE_STANDBY, |
| 324 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 325 | | REGULATOR_CHANGE_MODE |
| 326 | | REGULATOR_CHANGE_STATUS, |
| 327 | }, |
| 328 | .num_consumer_supplies = 1, |
| 329 | .consumer_supplies = &overo_vmmc1_supply, |
| 330 | }; |
| 331 | |
Peter Ujfalusi | e86fa0b | 2009-10-22 13:26:46 +0300 | [diff] [blame] | 332 | static struct twl4030_codec_audio_data overo_audio_data = { |
| 333 | .audio_mclk = 26000000, |
| 334 | }; |
| 335 | |
| 336 | static struct twl4030_codec_data overo_codec_data = { |
Peter Ujfalusi | 6df74ef | 2009-11-04 09:58:18 +0200 | [diff] [blame] | 337 | .audio_mclk = 26000000, |
Peter Ujfalusi | e86fa0b | 2009-10-22 13:26:46 +0300 | [diff] [blame] | 338 | .audio = &overo_audio_data, |
| 339 | }; |
| 340 | |
David Brownell | bb3b9d8 | 2009-05-28 14:04:03 -0700 | [diff] [blame] | 341 | /* mmc2 (WLAN) and Bluetooth don't use twl4030 regulators */ |
| 342 | |
Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 343 | static struct twl4030_platform_data overo_twldata = { |
| 344 | .irq_base = TWL4030_IRQ_BASE, |
| 345 | .irq_end = TWL4030_IRQ_END, |
| 346 | .gpio = &overo_gpio_data, |
David Brownell | bb3b9d8 | 2009-05-28 14:04:03 -0700 | [diff] [blame] | 347 | .usb = &overo_usb_data, |
Peter Ujfalusi | e86fa0b | 2009-10-22 13:26:46 +0300 | [diff] [blame] | 348 | .codec = &overo_codec_data, |
David Brownell | bb3b9d8 | 2009-05-28 14:04:03 -0700 | [diff] [blame] | 349 | .vmmc1 = &overo_vmmc1, |
Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 350 | }; |
| 351 | |
| 352 | static struct i2c_board_info __initdata overo_i2c_boardinfo[] = { |
| 353 | { |
David Brownell | bb3b9d8 | 2009-05-28 14:04:03 -0700 | [diff] [blame] | 354 | I2C_BOARD_INFO("tps65950", 0x48), |
Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 355 | .flags = I2C_CLIENT_WAKE, |
| 356 | .irq = INT_34XX_SYS_NIRQ, |
| 357 | .platform_data = &overo_twldata, |
| 358 | }, |
| 359 | }; |
| 360 | |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 361 | static int __init overo_i2c_init(void) |
| 362 | { |
Tony Lindgren | 90c62bf | 2008-12-10 17:37:17 -0800 | [diff] [blame] | 363 | omap_register_i2c_bus(1, 2600, overo_i2c_boardinfo, |
| 364 | ARRAY_SIZE(overo_i2c_boardinfo)); |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 365 | /* i2c2 pins are used for gpio */ |
| 366 | omap_register_i2c_bus(3, 400, NULL, 0); |
| 367 | return 0; |
| 368 | } |
| 369 | |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 370 | static struct platform_device overo_lcd_device = { |
| 371 | .name = "overo_lcd", |
| 372 | .id = -1, |
| 373 | }; |
| 374 | |
| 375 | static struct omap_lcd_config overo_lcd_config __initdata = { |
| 376 | .ctrl_name = "internal", |
| 377 | }; |
| 378 | |
| 379 | static struct omap_board_config_kernel overo_config[] __initdata = { |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 380 | { OMAP_TAG_LCD, &overo_lcd_config }, |
| 381 | }; |
| 382 | |
Paul Walmsley | b3c6df3 | 2009-09-03 20:14:02 +0300 | [diff] [blame] | 383 | static void __init overo_init_irq(void) |
| 384 | { |
| 385 | omap_board_config = overo_config; |
| 386 | omap_board_config_size = ARRAY_SIZE(overo_config); |
| 387 | omap2_init_common_hw(mt46h32m32lf6_sdrc_params, |
| 388 | mt46h32m32lf6_sdrc_params); |
| 389 | omap_init_irq(); |
| 390 | omap_gpio_init(); |
| 391 | } |
| 392 | |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 393 | static struct platform_device *overo_devices[] __initdata = { |
| 394 | &overo_lcd_device, |
| 395 | }; |
| 396 | |
Felipe Balbi | 6f69a18 | 2010-03-04 09:45:53 +0200 | [diff] [blame] | 397 | static const struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 398 | .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN, |
| 399 | .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY, |
| 400 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, |
| 401 | |
| 402 | .phy_reset = true, |
| 403 | .reset_gpio_port[0] = -EINVAL, |
| 404 | .reset_gpio_port[1] = OVERO_GPIO_USBH_NRESET, |
| 405 | .reset_gpio_port[2] = -EINVAL |
| 406 | }; |
| 407 | |
Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 408 | #ifdef CONFIG_OMAP_MUX |
| 409 | static struct omap_board_mux board_mux[] __initdata = { |
| 410 | { .reg_offset = OMAP_MUX_TERMINATOR }, |
| 411 | }; |
| 412 | #else |
| 413 | #define board_mux NULL |
| 414 | #endif |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 415 | |
Maulik Mankad | 884b836 | 2010-02-17 14:09:30 -0800 | [diff] [blame] | 416 | static struct omap_musb_board_data musb_board_data = { |
| 417 | .interface_type = MUSB_INTERFACE_ULPI, |
| 418 | .mode = MUSB_OTG, |
| 419 | .power = 100, |
| 420 | }; |
| 421 | |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 422 | static void __init overo_init(void) |
| 423 | { |
Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 424 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 425 | overo_i2c_init(); |
| 426 | platform_add_devices(overo_devices, ARRAY_SIZE(overo_devices)); |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 427 | omap_serial_init(); |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 428 | overo_flash_init(); |
Maulik Mankad | 884b836 | 2010-02-17 14:09:30 -0800 | [diff] [blame] | 429 | usb_musb_init(&musb_board_data); |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 430 | usb_ehci_init(&ehci_pdata); |
Steve Sakoman | c6a8131 | 2009-03-23 18:38:16 -0700 | [diff] [blame] | 431 | overo_ads7846_init(); |
Steve Sakoman | 172ef27 | 2009-02-02 06:27:49 +0000 | [diff] [blame] | 432 | overo_init_smsc911x(); |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 433 | |
Jean Pihet | 9fb9741 | 2009-07-24 19:43:25 -0600 | [diff] [blame] | 434 | /* Ensure SDRC pins are mux'd for self-refresh */ |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 435 | omap_mux_init_signal("sdrc_cke0", OMAP_PIN_OUTPUT); |
| 436 | omap_mux_init_signal("sdrc_cke1", OMAP_PIN_OUTPUT); |
Jean Pihet | 9fb9741 | 2009-07-24 19:43:25 -0600 | [diff] [blame] | 437 | |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 438 | if ((gpio_request(OVERO_GPIO_W2W_NRESET, |
| 439 | "OVERO_GPIO_W2W_NRESET") == 0) && |
| 440 | (gpio_direction_output(OVERO_GPIO_W2W_NRESET, 1) == 0)) { |
| 441 | gpio_export(OVERO_GPIO_W2W_NRESET, 0); |
| 442 | gpio_set_value(OVERO_GPIO_W2W_NRESET, 0); |
| 443 | udelay(10); |
| 444 | gpio_set_value(OVERO_GPIO_W2W_NRESET, 1); |
| 445 | } else { |
| 446 | printk(KERN_ERR "could not obtain gpio for " |
| 447 | "OVERO_GPIO_W2W_NRESET\n"); |
| 448 | } |
| 449 | |
| 450 | if ((gpio_request(OVERO_GPIO_BT_XGATE, "OVERO_GPIO_BT_XGATE") == 0) && |
| 451 | (gpio_direction_output(OVERO_GPIO_BT_XGATE, 0) == 0)) |
| 452 | gpio_export(OVERO_GPIO_BT_XGATE, 0); |
| 453 | else |
| 454 | printk(KERN_ERR "could not obtain gpio for OVERO_GPIO_BT_XGATE\n"); |
| 455 | |
| 456 | if ((gpio_request(OVERO_GPIO_BT_NRESET, "OVERO_GPIO_BT_NRESET") == 0) && |
| 457 | (gpio_direction_output(OVERO_GPIO_BT_NRESET, 1) == 0)) { |
| 458 | gpio_export(OVERO_GPIO_BT_NRESET, 0); |
| 459 | gpio_set_value(OVERO_GPIO_BT_NRESET, 0); |
| 460 | mdelay(6); |
| 461 | gpio_set_value(OVERO_GPIO_BT_NRESET, 1); |
| 462 | } else { |
| 463 | printk(KERN_ERR "could not obtain gpio for " |
| 464 | "OVERO_GPIO_BT_NRESET\n"); |
| 465 | } |
| 466 | |
| 467 | if ((gpio_request(OVERO_GPIO_USBH_CPEN, "OVERO_GPIO_USBH_CPEN") == 0) && |
| 468 | (gpio_direction_output(OVERO_GPIO_USBH_CPEN, 1) == 0)) |
| 469 | gpio_export(OVERO_GPIO_USBH_CPEN, 0); |
| 470 | else |
| 471 | printk(KERN_ERR "could not obtain gpio for " |
| 472 | "OVERO_GPIO_USBH_CPEN\n"); |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 473 | } |
| 474 | |
| 475 | static void __init overo_map_io(void) |
| 476 | { |
| 477 | omap2_set_globals_343x(); |
Tony Lindgren | 6fbd55d | 2010-02-12 12:26:47 -0800 | [diff] [blame] | 478 | omap34xx_map_common_io(); |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 479 | } |
| 480 | |
| 481 | MACHINE_START(OVERO, "Gumstix Overo") |
| 482 | .phys_io = 0x48000000, |
Santosh Shilimkar | b4224b2 | 2009-10-19 17:25:55 -0700 | [diff] [blame] | 483 | .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, |
Steve Sakoman | eba2645 | 2008-10-09 17:51:43 +0300 | [diff] [blame] | 484 | .boot_params = 0x80000100, |
| 485 | .map_io = overo_map_io, |
| 486 | .init_irq = overo_init_irq, |
| 487 | .init_machine = overo_init, |
| 488 | .timer = &omap_timer, |
| 489 | MACHINE_END |