Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 1 | /* |
| 2 | * linux/arch/arm/mach-omap2/board-omap3evm.c |
| 3 | * |
| 4 | * Copyright (C) 2008 Texas Instruments |
| 5 | * |
| 6 | * Modified from mach-omap2/board-3430sdp.c |
| 7 | * |
| 8 | * Initial code: Syed Mohammed Khasim |
| 9 | * |
| 10 | * This program is free software; you can redistribute it and/or modify |
| 11 | * it under the terms of the GNU General Public License version 2 as |
| 12 | * published by the Free Software Foundation. |
| 13 | */ |
| 14 | |
| 15 | #include <linux/kernel.h> |
| 16 | #include <linux/init.h> |
| 17 | #include <linux/platform_device.h> |
| 18 | #include <linux/delay.h> |
| 19 | #include <linux/err.h> |
| 20 | #include <linux/clk.h> |
| 21 | #include <linux/gpio.h> |
| 22 | #include <linux/input.h> |
Janusz Krzysztofik | 6135434 | 2009-10-22 14:43:17 -0700 | [diff] [blame] | 23 | #include <linux/input/matrix_keypad.h> |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 24 | #include <linux/leds.h> |
Sriram | 562138a | 2009-11-22 10:11:30 -0800 | [diff] [blame] | 25 | #include <linux/interrupt.h> |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 26 | |
| 27 | #include <linux/spi/spi.h> |
| 28 | #include <linux/spi/ads7846.h> |
| 29 | #include <linux/i2c/twl4030.h> |
Gupta, Ajay Kumar | e8e2ff4 | 2009-07-29 11:58:57 +0530 | [diff] [blame] | 30 | #include <linux/usb/otg.h> |
Sriram | 562138a | 2009-11-22 10:11:30 -0800 | [diff] [blame] | 31 | #include <linux/smsc911x.h> |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 32 | |
Mike Rapoport | 1a7ec13 | 2009-11-22 10:11:29 -0800 | [diff] [blame] | 33 | #include <linux/regulator/machine.h> |
| 34 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 35 | #include <mach/hardware.h> |
| 36 | #include <asm/mach-types.h> |
| 37 | #include <asm/mach/arch.h> |
| 38 | #include <asm/mach/map.h> |
| 39 | |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 40 | #include <plat/board.h> |
| 41 | #include <plat/mux.h> |
| 42 | #include <plat/usb.h> |
| 43 | #include <plat/common.h> |
| 44 | #include <plat/mcspi.h> |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 45 | |
Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 46 | #include "mux.h" |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 47 | #include "sdram-micron-mt46h32m32lf-6.h" |
| 48 | #include "mmc-twl4030.h" |
| 49 | |
| 50 | #define OMAP3_EVM_TS_GPIO 175 |
Ajay Kumar Gupta | e8e51d2 | 2009-11-22 10:11:28 -0800 | [diff] [blame] | 51 | #define OMAP3_EVM_EHCI_VBUS 22 |
| 52 | #define OMAP3_EVM_EHCI_SELECT 61 |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 53 | |
| 54 | #define OMAP3EVM_ETHR_START 0x2c000000 |
| 55 | #define OMAP3EVM_ETHR_SIZE 1024 |
Ajay Kumar Gupta | db40802 | 2009-11-22 10:11:27 -0800 | [diff] [blame] | 56 | #define OMAP3EVM_ETHR_ID_REV 0x50 |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 57 | #define OMAP3EVM_ETHR_GPIO_IRQ 176 |
Sriram | 562138a | 2009-11-22 10:11:30 -0800 | [diff] [blame] | 58 | #define OMAP3EVM_SMSC911X_CS 5 |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 59 | |
Ajay Kumar Gupta | db40802 | 2009-11-22 10:11:27 -0800 | [diff] [blame] | 60 | static u8 omap3_evm_version; |
| 61 | |
| 62 | u8 get_omap3_evm_rev(void) |
| 63 | { |
| 64 | return omap3_evm_version; |
| 65 | } |
| 66 | EXPORT_SYMBOL(get_omap3_evm_rev); |
| 67 | |
| 68 | static void __init omap3_evm_get_revision(void) |
| 69 | { |
| 70 | void __iomem *ioaddr; |
| 71 | unsigned int smsc_id; |
| 72 | |
| 73 | /* Ethernet PHY ID is stored at ID_REV register */ |
| 74 | ioaddr = ioremap_nocache(OMAP3EVM_ETHR_START, SZ_1K); |
| 75 | if (!ioaddr) |
| 76 | return; |
| 77 | smsc_id = readl(ioaddr + OMAP3EVM_ETHR_ID_REV) & 0xFFFF0000; |
| 78 | iounmap(ioaddr); |
| 79 | |
| 80 | switch (smsc_id) { |
| 81 | /*SMSC9115 chipset*/ |
| 82 | case 0x01150000: |
| 83 | omap3_evm_version = OMAP3EVM_BOARD_GEN_1; |
| 84 | break; |
| 85 | /*SMSC 9220 chipset*/ |
| 86 | case 0x92200000: |
| 87 | default: |
| 88 | omap3_evm_version = OMAP3EVM_BOARD_GEN_2; |
| 89 | } |
| 90 | } |
| 91 | |
Sriram | 562138a | 2009-11-22 10:11:30 -0800 | [diff] [blame] | 92 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) |
| 93 | static struct resource omap3evm_smsc911x_resources[] = { |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 94 | [0] = { |
| 95 | .start = OMAP3EVM_ETHR_START, |
| 96 | .end = (OMAP3EVM_ETHR_START + OMAP3EVM_ETHR_SIZE - 1), |
| 97 | .flags = IORESOURCE_MEM, |
| 98 | }, |
| 99 | [1] = { |
| 100 | .start = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ), |
| 101 | .end = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ), |
Sriram | 562138a | 2009-11-22 10:11:30 -0800 | [diff] [blame] | 102 | .flags = (IORESOURCE_IRQ | IRQF_TRIGGER_LOW), |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 103 | }, |
| 104 | }; |
| 105 | |
Sriram | 562138a | 2009-11-22 10:11:30 -0800 | [diff] [blame] | 106 | static struct smsc911x_platform_config smsc911x_config = { |
| 107 | .phy_interface = PHY_INTERFACE_MODE_MII, |
| 108 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, |
| 109 | .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, |
| 110 | .flags = (SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS), |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 111 | }; |
| 112 | |
Sriram | 562138a | 2009-11-22 10:11:30 -0800 | [diff] [blame] | 113 | static struct platform_device omap3evm_smsc911x_device = { |
| 114 | .name = "smsc911x", |
| 115 | .id = -1, |
| 116 | .num_resources = ARRAY_SIZE(omap3evm_smsc911x_resources), |
| 117 | .resource = &omap3evm_smsc911x_resources[0], |
| 118 | .dev = { |
| 119 | .platform_data = &smsc911x_config, |
| 120 | }, |
| 121 | }; |
| 122 | |
| 123 | static inline void __init omap3evm_init_smsc911x(void) |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 124 | { |
| 125 | int eth_cs; |
| 126 | struct clk *l3ck; |
| 127 | unsigned int rate; |
| 128 | |
Sriram | 562138a | 2009-11-22 10:11:30 -0800 | [diff] [blame] | 129 | eth_cs = OMAP3EVM_SMSC911X_CS; |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 130 | |
| 131 | l3ck = clk_get(NULL, "l3_ck"); |
| 132 | if (IS_ERR(l3ck)) |
| 133 | rate = 100000000; |
| 134 | else |
| 135 | rate = clk_get_rate(l3ck); |
| 136 | |
Sriram | 562138a | 2009-11-22 10:11:30 -0800 | [diff] [blame] | 137 | if (gpio_request(OMAP3EVM_ETHR_GPIO_IRQ, "SMSC911x irq") < 0) { |
| 138 | printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n", |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 139 | OMAP3EVM_ETHR_GPIO_IRQ); |
| 140 | return; |
| 141 | } |
| 142 | |
| 143 | gpio_direction_input(OMAP3EVM_ETHR_GPIO_IRQ); |
Sriram | 562138a | 2009-11-22 10:11:30 -0800 | [diff] [blame] | 144 | platform_device_register(&omap3evm_smsc911x_device); |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 145 | } |
| 146 | |
Sriram | 562138a | 2009-11-22 10:11:30 -0800 | [diff] [blame] | 147 | #else |
| 148 | static inline void __init omap3evm_init_smsc911x(void) { return; } |
| 149 | #endif |
| 150 | |
Mike Rapoport | 1a7ec13 | 2009-11-22 10:11:29 -0800 | [diff] [blame] | 151 | static struct regulator_consumer_supply omap3evm_vmmc1_supply = { |
| 152 | .supply = "vmmc", |
| 153 | }; |
| 154 | |
| 155 | static struct regulator_consumer_supply omap3evm_vsim_supply = { |
| 156 | .supply = "vmmc_aux", |
| 157 | }; |
| 158 | |
| 159 | /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ |
| 160 | static struct regulator_init_data omap3evm_vmmc1 = { |
| 161 | .constraints = { |
| 162 | .min_uV = 1850000, |
| 163 | .max_uV = 3150000, |
| 164 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 165 | | REGULATOR_MODE_STANDBY, |
| 166 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 167 | | REGULATOR_CHANGE_MODE |
| 168 | | REGULATOR_CHANGE_STATUS, |
| 169 | }, |
| 170 | .num_consumer_supplies = 1, |
| 171 | .consumer_supplies = &omap3evm_vmmc1_supply, |
| 172 | }; |
| 173 | |
| 174 | /* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */ |
| 175 | static struct regulator_init_data omap3evm_vsim = { |
| 176 | .constraints = { |
| 177 | .min_uV = 1800000, |
| 178 | .max_uV = 3000000, |
| 179 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 180 | | REGULATOR_MODE_STANDBY, |
| 181 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 182 | | REGULATOR_CHANGE_MODE |
| 183 | | REGULATOR_CHANGE_STATUS, |
| 184 | }, |
| 185 | .num_consumer_supplies = 1, |
| 186 | .consumer_supplies = &omap3evm_vsim_supply, |
| 187 | }; |
| 188 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 189 | static struct twl4030_hsmmc_info mmc[] = { |
| 190 | { |
| 191 | .mmc = 1, |
| 192 | .wires = 4, |
| 193 | .gpio_cd = -EINVAL, |
| 194 | .gpio_wp = 63, |
| 195 | }, |
| 196 | {} /* Terminator */ |
| 197 | }; |
| 198 | |
| 199 | static struct gpio_led gpio_leds[] = { |
| 200 | { |
| 201 | .name = "omap3evm::ledb", |
| 202 | /* normally not visible (board underside) */ |
| 203 | .default_trigger = "default-on", |
| 204 | .gpio = -EINVAL, /* gets replaced */ |
| 205 | .active_low = true, |
| 206 | }, |
| 207 | }; |
| 208 | |
| 209 | static struct gpio_led_platform_data gpio_led_info = { |
| 210 | .leds = gpio_leds, |
| 211 | .num_leds = ARRAY_SIZE(gpio_leds), |
| 212 | }; |
| 213 | |
| 214 | static struct platform_device leds_gpio = { |
| 215 | .name = "leds-gpio", |
| 216 | .id = -1, |
| 217 | .dev = { |
| 218 | .platform_data = &gpio_led_info, |
| 219 | }, |
| 220 | }; |
| 221 | |
| 222 | |
| 223 | static int omap3evm_twl_gpio_setup(struct device *dev, |
| 224 | unsigned gpio, unsigned ngpio) |
| 225 | { |
| 226 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ |
| 227 | omap_cfg_reg(L8_34XX_GPIO63); |
| 228 | mmc[0].gpio_cd = gpio + 0; |
| 229 | twl4030_mmc_init(mmc); |
| 230 | |
Mike Rapoport | 1a7ec13 | 2009-11-22 10:11:29 -0800 | [diff] [blame] | 231 | /* link regulators to MMC adapters */ |
| 232 | omap3evm_vmmc1_supply.dev = mmc[0].dev; |
| 233 | omap3evm_vsim_supply.dev = mmc[0].dev; |
| 234 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 235 | /* |
| 236 | * Most GPIOs are for USB OTG. Some are mostly sent to |
| 237 | * the P2 connector; notably LEDA for the LCD backlight. |
| 238 | */ |
| 239 | |
| 240 | /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ |
| 241 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; |
| 242 | |
| 243 | platform_device_register(&leds_gpio); |
| 244 | |
| 245 | return 0; |
| 246 | } |
| 247 | |
| 248 | static struct twl4030_gpio_platform_data omap3evm_gpio_data = { |
| 249 | .gpio_base = OMAP_MAX_GPIO_LINES, |
| 250 | .irq_base = TWL4030_GPIO_IRQ_BASE, |
| 251 | .irq_end = TWL4030_GPIO_IRQ_END, |
| 252 | .use_leds = true, |
| 253 | .setup = omap3evm_twl_gpio_setup, |
| 254 | }; |
| 255 | |
| 256 | static struct twl4030_usb_data omap3evm_usb_data = { |
| 257 | .usb_mode = T2_USB_MODE_ULPI, |
| 258 | }; |
| 259 | |
Tony Lindgren | 4f54333 | 2009-09-24 16:23:16 -0700 | [diff] [blame] | 260 | static int board_keymap[] = { |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 261 | KEY(0, 0, KEY_LEFT), |
| 262 | KEY(0, 1, KEY_RIGHT), |
| 263 | KEY(0, 2, KEY_A), |
| 264 | KEY(0, 3, KEY_B), |
| 265 | KEY(1, 0, KEY_DOWN), |
| 266 | KEY(1, 1, KEY_UP), |
| 267 | KEY(1, 2, KEY_E), |
| 268 | KEY(1, 3, KEY_F), |
| 269 | KEY(2, 0, KEY_ENTER), |
| 270 | KEY(2, 1, KEY_I), |
| 271 | KEY(2, 2, KEY_J), |
| 272 | KEY(2, 3, KEY_K), |
| 273 | KEY(3, 0, KEY_M), |
| 274 | KEY(3, 1, KEY_N), |
| 275 | KEY(3, 2, KEY_O), |
| 276 | KEY(3, 3, KEY_P) |
| 277 | }; |
| 278 | |
Tony Lindgren | 4f54333 | 2009-09-24 16:23:16 -0700 | [diff] [blame] | 279 | static struct matrix_keymap_data board_map_data = { |
| 280 | .keymap = board_keymap, |
| 281 | .keymap_size = ARRAY_SIZE(board_keymap), |
| 282 | }; |
| 283 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 284 | static struct twl4030_keypad_data omap3evm_kp_data = { |
Tony Lindgren | 4f54333 | 2009-09-24 16:23:16 -0700 | [diff] [blame] | 285 | .keymap_data = &board_map_data, |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 286 | .rows = 4, |
| 287 | .cols = 4, |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 288 | .rep = 1, |
| 289 | }; |
| 290 | |
| 291 | static struct twl4030_madc_platform_data omap3evm_madc_data = { |
| 292 | .irq_line = 1, |
| 293 | }; |
| 294 | |
Peter Ujfalusi | e86fa0b | 2009-10-22 13:26:46 +0300 | [diff] [blame] | 295 | static struct twl4030_codec_audio_data omap3evm_audio_data = { |
| 296 | .audio_mclk = 26000000, |
| 297 | }; |
| 298 | |
| 299 | static struct twl4030_codec_data omap3evm_codec_data = { |
Peter Ujfalusi | 6df74ef | 2009-11-04 09:58:18 +0200 | [diff] [blame] | 300 | .audio_mclk = 26000000, |
Peter Ujfalusi | e86fa0b | 2009-10-22 13:26:46 +0300 | [diff] [blame] | 301 | .audio = &omap3evm_audio_data, |
| 302 | }; |
| 303 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 304 | static struct twl4030_platform_data omap3evm_twldata = { |
| 305 | .irq_base = TWL4030_IRQ_BASE, |
| 306 | .irq_end = TWL4030_IRQ_END, |
| 307 | |
| 308 | /* platform_data for children goes here */ |
| 309 | .keypad = &omap3evm_kp_data, |
| 310 | .madc = &omap3evm_madc_data, |
| 311 | .usb = &omap3evm_usb_data, |
| 312 | .gpio = &omap3evm_gpio_data, |
Peter Ujfalusi | e86fa0b | 2009-10-22 13:26:46 +0300 | [diff] [blame] | 313 | .codec = &omap3evm_codec_data, |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 314 | }; |
| 315 | |
| 316 | static struct i2c_board_info __initdata omap3evm_i2c_boardinfo[] = { |
| 317 | { |
| 318 | I2C_BOARD_INFO("twl4030", 0x48), |
| 319 | .flags = I2C_CLIENT_WAKE, |
| 320 | .irq = INT_34XX_SYS_NIRQ, |
| 321 | .platform_data = &omap3evm_twldata, |
| 322 | }, |
| 323 | }; |
| 324 | |
| 325 | static int __init omap3_evm_i2c_init(void) |
| 326 | { |
Mike Rapoport | 1a7ec13 | 2009-11-22 10:11:29 -0800 | [diff] [blame] | 327 | /* |
| 328 | * REVISIT: These entries can be set in omap3evm_twl_data |
| 329 | * after a merge with MFD tree |
| 330 | */ |
| 331 | omap3evm_twldata.vmmc1 = &omap3evm_vmmc1; |
| 332 | omap3evm_twldata.vsim = &omap3evm_vsim; |
| 333 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 334 | omap_register_i2c_bus(1, 2600, omap3evm_i2c_boardinfo, |
| 335 | ARRAY_SIZE(omap3evm_i2c_boardinfo)); |
| 336 | omap_register_i2c_bus(2, 400, NULL, 0); |
| 337 | omap_register_i2c_bus(3, 400, NULL, 0); |
| 338 | return 0; |
| 339 | } |
| 340 | |
| 341 | static struct platform_device omap3_evm_lcd_device = { |
| 342 | .name = "omap3evm_lcd", |
| 343 | .id = -1, |
| 344 | }; |
| 345 | |
| 346 | static struct omap_lcd_config omap3_evm_lcd_config __initdata = { |
| 347 | .ctrl_name = "internal", |
| 348 | }; |
| 349 | |
| 350 | static void ads7846_dev_init(void) |
| 351 | { |
| 352 | if (gpio_request(OMAP3_EVM_TS_GPIO, "ADS7846 pendown") < 0) |
| 353 | printk(KERN_ERR "can't get ads7846 pen down GPIO\n"); |
| 354 | |
| 355 | gpio_direction_input(OMAP3_EVM_TS_GPIO); |
| 356 | |
| 357 | omap_set_gpio_debounce(OMAP3_EVM_TS_GPIO, 1); |
| 358 | omap_set_gpio_debounce_time(OMAP3_EVM_TS_GPIO, 0xa); |
| 359 | } |
| 360 | |
| 361 | static int ads7846_get_pendown_state(void) |
| 362 | { |
| 363 | return !gpio_get_value(OMAP3_EVM_TS_GPIO); |
| 364 | } |
| 365 | |
| 366 | struct ads7846_platform_data ads7846_config = { |
| 367 | .x_max = 0x0fff, |
| 368 | .y_max = 0x0fff, |
| 369 | .x_plate_ohms = 180, |
| 370 | .pressure_max = 255, |
| 371 | .debounce_max = 10, |
| 372 | .debounce_tol = 3, |
| 373 | .debounce_rep = 1, |
| 374 | .get_pendown_state = ads7846_get_pendown_state, |
| 375 | .keep_vref_on = 1, |
| 376 | .settle_delay_usecs = 150, |
| 377 | }; |
| 378 | |
| 379 | static struct omap2_mcspi_device_config ads7846_mcspi_config = { |
| 380 | .turbo_mode = 0, |
| 381 | .single_channel = 1, /* 0: slave, 1: master */ |
| 382 | }; |
| 383 | |
| 384 | struct spi_board_info omap3evm_spi_board_info[] = { |
| 385 | [0] = { |
| 386 | .modalias = "ads7846", |
| 387 | .bus_num = 1, |
| 388 | .chip_select = 0, |
| 389 | .max_speed_hz = 1500000, |
| 390 | .controller_data = &ads7846_mcspi_config, |
| 391 | .irq = OMAP_GPIO_IRQ(OMAP3_EVM_TS_GPIO), |
| 392 | .platform_data = &ads7846_config, |
| 393 | }, |
| 394 | }; |
| 395 | |
Paul Walmsley | b3c6df3 | 2009-09-03 20:14:02 +0300 | [diff] [blame] | 396 | static struct omap_board_config_kernel omap3_evm_config[] __initdata = { |
| 397 | { OMAP_TAG_LCD, &omap3_evm_lcd_config }, |
| 398 | }; |
| 399 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 400 | static void __init omap3_evm_init_irq(void) |
| 401 | { |
Paul Walmsley | b3c6df3 | 2009-09-03 20:14:02 +0300 | [diff] [blame] | 402 | omap_board_config = omap3_evm_config; |
| 403 | omap_board_config_size = ARRAY_SIZE(omap3_evm_config); |
Jean Pihet | 58cda88 | 2009-07-24 19:43:25 -0600 | [diff] [blame] | 404 | omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL); |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 405 | omap_init_irq(); |
| 406 | omap_gpio_init(); |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 407 | } |
| 408 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 409 | static struct platform_device *omap3_evm_devices[] __initdata = { |
| 410 | &omap3_evm_lcd_device, |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 411 | }; |
| 412 | |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 413 | static struct ehci_hcd_omap_platform_data ehci_pdata __initconst = { |
| 414 | |
| 415 | .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN, |
| 416 | .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY, |
| 417 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, |
| 418 | |
| 419 | .phy_reset = true, |
Ajay Kumar Gupta | e8e51d2 | 2009-11-22 10:11:28 -0800 | [diff] [blame] | 420 | /* PHY reset GPIO will be runtime programmed based on EVM version */ |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 421 | .reset_gpio_port[0] = -EINVAL, |
Ajay Kumar Gupta | e8e51d2 | 2009-11-22 10:11:28 -0800 | [diff] [blame] | 422 | .reset_gpio_port[1] = -EINVAL, |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 423 | .reset_gpio_port[2] = -EINVAL |
| 424 | }; |
| 425 | |
Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 426 | #ifdef CONFIG_OMAP_MUX |
| 427 | static struct omap_board_mux board_mux[] __initdata = { |
| 428 | { .reg_offset = OMAP_MUX_TERMINATOR }, |
| 429 | }; |
| 430 | #else |
| 431 | #define board_mux NULL |
| 432 | #endif |
| 433 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 434 | static void __init omap3_evm_init(void) |
| 435 | { |
Ajay Kumar Gupta | db40802 | 2009-11-22 10:11:27 -0800 | [diff] [blame] | 436 | omap3_evm_get_revision(); |
Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 437 | omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); |
Ajay Kumar Gupta | db40802 | 2009-11-22 10:11:27 -0800 | [diff] [blame] | 438 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 439 | omap3_evm_i2c_init(); |
| 440 | |
| 441 | platform_add_devices(omap3_evm_devices, ARRAY_SIZE(omap3_evm_devices)); |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 442 | |
| 443 | spi_register_board_info(omap3evm_spi_board_info, |
| 444 | ARRAY_SIZE(omap3evm_spi_board_info)); |
| 445 | |
| 446 | omap_serial_init(); |
Gupta, Ajay Kumar | e8e2ff4 | 2009-07-29 11:58:57 +0530 | [diff] [blame] | 447 | #ifdef CONFIG_NOP_USB_XCEIV |
| 448 | /* OMAP3EVM uses ISP1504 phy and so register nop transceiver */ |
| 449 | usb_nop_xceiv_register(); |
| 450 | #endif |
Ajay Kumar Gupta | e8e51d2 | 2009-11-22 10:11:28 -0800 | [diff] [blame] | 451 | if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) { |
| 452 | /* enable EHCI VBUS using GPIO22 */ |
| 453 | omap_cfg_reg(AF9_34XX_GPIO22); |
| 454 | gpio_request(OMAP3_EVM_EHCI_VBUS, "enable EHCI VBUS"); |
| 455 | gpio_direction_output(OMAP3_EVM_EHCI_VBUS, 0); |
| 456 | gpio_set_value(OMAP3_EVM_EHCI_VBUS, 1); |
| 457 | |
| 458 | /* Select EHCI port on main board */ |
| 459 | omap_cfg_reg(U3_34XX_GPIO61); |
| 460 | gpio_request(OMAP3_EVM_EHCI_SELECT, "select EHCI port"); |
| 461 | gpio_direction_output(OMAP3_EVM_EHCI_SELECT, 0); |
| 462 | gpio_set_value(OMAP3_EVM_EHCI_SELECT, 0); |
| 463 | |
| 464 | /* setup EHCI phy reset config */ |
| 465 | omap_cfg_reg(AH14_34XX_GPIO21); |
| 466 | ehci_pdata.reset_gpio_port[1] = 21; |
| 467 | |
| 468 | } else { |
| 469 | /* setup EHCI phy reset on MDC */ |
| 470 | omap_cfg_reg(AF4_34XX_GPIO135_OUT); |
| 471 | ehci_pdata.reset_gpio_port[1] = 135; |
| 472 | } |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 473 | usb_musb_init(); |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 474 | usb_ehci_init(&ehci_pdata); |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 475 | ads7846_dev_init(); |
Sriram | 562138a | 2009-11-22 10:11:30 -0800 | [diff] [blame] | 476 | omap3evm_init_smsc911x(); |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 477 | } |
| 478 | |
| 479 | static void __init omap3_evm_map_io(void) |
| 480 | { |
| 481 | omap2_set_globals_343x(); |
| 482 | omap2_map_common_io(); |
| 483 | } |
| 484 | |
| 485 | MACHINE_START(OMAP3EVM, "OMAP3 EVM") |
| 486 | /* Maintainer: Syed Mohammed Khasim - Texas Instruments */ |
| 487 | .phys_io = 0x48000000, |
Santosh Shilimkar | b4224b2 | 2009-10-19 17:25:55 -0700 | [diff] [blame] | 488 | .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 489 | .boot_params = 0x80000100, |
| 490 | .map_io = omap3_evm_map_io, |
| 491 | .init_irq = omap3_evm_init_irq, |
| 492 | .init_machine = omap3_evm_init, |
| 493 | .timer = &omap_timer, |
| 494 | MACHINE_END |