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