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> |
Balaji T K | ebeb53e | 2009-12-15 20:09:02 +0530 | [diff] [blame] | 29 | #include <linux/i2c/twl.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 | |
Eyal Reizer | 741927f | 2011-01-27 09:49:49 +0000 | [diff] [blame] | 33 | #include <linux/wl12xx.h> |
| 34 | #include <linux/regulator/fixed.h> |
Mike Rapoport | 1a7ec13 | 2009-11-22 10:11:29 -0800 | [diff] [blame] | 35 | #include <linux/regulator/machine.h> |
Sukumar Ghorai | 3a63833 | 2010-09-15 14:49:23 +0000 | [diff] [blame] | 36 | #include <linux/mmc/host.h> |
Mike Rapoport | 1a7ec13 | 2009-11-22 10:11:29 -0800 | [diff] [blame] | 37 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 38 | #include <mach/hardware.h> |
| 39 | #include <asm/mach-types.h> |
| 40 | #include <asm/mach/arch.h> |
| 41 | #include <asm/mach/map.h> |
| 42 | |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 43 | #include <plat/board.h> |
Tony Lindgren | ce491cf | 2009-10-20 09:40:47 -0700 | [diff] [blame] | 44 | #include <plat/usb.h> |
| 45 | #include <plat/common.h> |
| 46 | #include <plat/mcspi.h> |
Vaibhav Hiremath | 703e306 | 2010-01-04 15:34:16 +0100 | [diff] [blame] | 47 | #include <plat/display.h> |
Bryan Wu | 89747c9 | 2010-11-17 13:34:34 +0000 | [diff] [blame] | 48 | #include <plat/panel-generic-dpi.h> |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 49 | |
Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 50 | #include "mux.h" |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 51 | #include "sdram-micron-mt46h32m32lf-6.h" |
Adrian Hunter | d02a900 | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 52 | #include "hsmmc.h" |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 53 | |
| 54 | #define OMAP3_EVM_TS_GPIO 175 |
Ajay Kumar Gupta | e8e51d2 | 2009-11-22 10:11:28 -0800 | [diff] [blame] | 55 | #define OMAP3_EVM_EHCI_VBUS 22 |
| 56 | #define OMAP3_EVM_EHCI_SELECT 61 |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 57 | |
| 58 | #define OMAP3EVM_ETHR_START 0x2c000000 |
| 59 | #define OMAP3EVM_ETHR_SIZE 1024 |
Ajay Kumar Gupta | db40802 | 2009-11-22 10:11:27 -0800 | [diff] [blame] | 60 | #define OMAP3EVM_ETHR_ID_REV 0x50 |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 61 | #define OMAP3EVM_ETHR_GPIO_IRQ 176 |
Sriram | 562138a | 2009-11-22 10:11:30 -0800 | [diff] [blame] | 62 | #define OMAP3EVM_SMSC911X_CS 5 |
Vaibhav Hiremath | 9bc64b8 | 2011-01-24 19:25:55 +0000 | [diff] [blame] | 63 | /* |
| 64 | * Eth Reset signal |
| 65 | * 64 = Generation 1 (<=RevD) |
| 66 | * 7 = Generation 2 (>=RevE) |
| 67 | */ |
| 68 | #define OMAP3EVM_GEN1_ETHR_GPIO_RST 64 |
| 69 | #define OMAP3EVM_GEN2_ETHR_GPIO_RST 7 |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 70 | |
Ajay Kumar Gupta | db40802 | 2009-11-22 10:11:27 -0800 | [diff] [blame] | 71 | static u8 omap3_evm_version; |
| 72 | |
| 73 | u8 get_omap3_evm_rev(void) |
| 74 | { |
| 75 | return omap3_evm_version; |
| 76 | } |
| 77 | EXPORT_SYMBOL(get_omap3_evm_rev); |
| 78 | |
| 79 | static void __init omap3_evm_get_revision(void) |
| 80 | { |
| 81 | void __iomem *ioaddr; |
| 82 | unsigned int smsc_id; |
| 83 | |
| 84 | /* Ethernet PHY ID is stored at ID_REV register */ |
| 85 | ioaddr = ioremap_nocache(OMAP3EVM_ETHR_START, SZ_1K); |
| 86 | if (!ioaddr) |
| 87 | return; |
| 88 | smsc_id = readl(ioaddr + OMAP3EVM_ETHR_ID_REV) & 0xFFFF0000; |
| 89 | iounmap(ioaddr); |
| 90 | |
| 91 | switch (smsc_id) { |
| 92 | /*SMSC9115 chipset*/ |
| 93 | case 0x01150000: |
| 94 | omap3_evm_version = OMAP3EVM_BOARD_GEN_1; |
| 95 | break; |
| 96 | /*SMSC 9220 chipset*/ |
| 97 | case 0x92200000: |
| 98 | default: |
| 99 | omap3_evm_version = OMAP3EVM_BOARD_GEN_2; |
| 100 | } |
| 101 | } |
| 102 | |
Sriram | 562138a | 2009-11-22 10:11:30 -0800 | [diff] [blame] | 103 | #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) |
| 104 | static struct resource omap3evm_smsc911x_resources[] = { |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 105 | [0] = { |
| 106 | .start = OMAP3EVM_ETHR_START, |
| 107 | .end = (OMAP3EVM_ETHR_START + OMAP3EVM_ETHR_SIZE - 1), |
| 108 | .flags = IORESOURCE_MEM, |
| 109 | }, |
| 110 | [1] = { |
| 111 | .start = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ), |
| 112 | .end = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ), |
Sriram | 562138a | 2009-11-22 10:11:30 -0800 | [diff] [blame] | 113 | .flags = (IORESOURCE_IRQ | IRQF_TRIGGER_LOW), |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 114 | }, |
| 115 | }; |
| 116 | |
Sriram | 562138a | 2009-11-22 10:11:30 -0800 | [diff] [blame] | 117 | static struct smsc911x_platform_config smsc911x_config = { |
| 118 | .phy_interface = PHY_INTERFACE_MODE_MII, |
| 119 | .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW, |
| 120 | .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN, |
| 121 | .flags = (SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS), |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 122 | }; |
| 123 | |
Sriram | 562138a | 2009-11-22 10:11:30 -0800 | [diff] [blame] | 124 | static struct platform_device omap3evm_smsc911x_device = { |
| 125 | .name = "smsc911x", |
| 126 | .id = -1, |
| 127 | .num_resources = ARRAY_SIZE(omap3evm_smsc911x_resources), |
| 128 | .resource = &omap3evm_smsc911x_resources[0], |
| 129 | .dev = { |
| 130 | .platform_data = &smsc911x_config, |
| 131 | }, |
| 132 | }; |
| 133 | |
| 134 | static inline void __init omap3evm_init_smsc911x(void) |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 135 | { |
Vaibhav Hiremath | 9bc64b8 | 2011-01-24 19:25:55 +0000 | [diff] [blame] | 136 | int eth_cs, eth_rst; |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 137 | struct clk *l3ck; |
| 138 | unsigned int rate; |
| 139 | |
Vaibhav Hiremath | 9bc64b8 | 2011-01-24 19:25:55 +0000 | [diff] [blame] | 140 | if (get_omap3_evm_rev() == OMAP3EVM_BOARD_GEN_1) |
| 141 | eth_rst = OMAP3EVM_GEN1_ETHR_GPIO_RST; |
| 142 | else |
| 143 | eth_rst = OMAP3EVM_GEN2_ETHR_GPIO_RST; |
| 144 | |
Sriram | 562138a | 2009-11-22 10:11:30 -0800 | [diff] [blame] | 145 | eth_cs = OMAP3EVM_SMSC911X_CS; |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 146 | |
| 147 | l3ck = clk_get(NULL, "l3_ck"); |
| 148 | if (IS_ERR(l3ck)) |
| 149 | rate = 100000000; |
| 150 | else |
| 151 | rate = clk_get_rate(l3ck); |
| 152 | |
Vaibhav Hiremath | 9bc64b8 | 2011-01-24 19:25:55 +0000 | [diff] [blame] | 153 | /* Configure ethernet controller reset gpio */ |
| 154 | if (cpu_is_omap3430()) { |
| 155 | if (gpio_request(eth_rst, "SMSC911x gpio") < 0) { |
| 156 | pr_err(KERN_ERR "Failed to request %d for smsc911x\n", |
| 157 | eth_rst); |
| 158 | return; |
| 159 | } |
| 160 | |
| 161 | if (gpio_direction_output(eth_rst, 1) < 0) { |
| 162 | pr_err(KERN_ERR "Failed to set direction of %d for" \ |
| 163 | " smsc911x\n", eth_rst); |
| 164 | return; |
| 165 | } |
| 166 | /* reset pulse to ethernet controller*/ |
| 167 | usleep_range(150, 220); |
| 168 | gpio_set_value(eth_rst, 0); |
| 169 | usleep_range(150, 220); |
| 170 | gpio_set_value(eth_rst, 1); |
| 171 | usleep_range(1, 2); |
| 172 | } |
| 173 | |
Sriram | 562138a | 2009-11-22 10:11:30 -0800 | [diff] [blame] | 174 | if (gpio_request(OMAP3EVM_ETHR_GPIO_IRQ, "SMSC911x irq") < 0) { |
| 175 | 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] | 176 | OMAP3EVM_ETHR_GPIO_IRQ); |
| 177 | return; |
| 178 | } |
| 179 | |
| 180 | gpio_direction_input(OMAP3EVM_ETHR_GPIO_IRQ); |
Sriram | 562138a | 2009-11-22 10:11:30 -0800 | [diff] [blame] | 181 | platform_device_register(&omap3evm_smsc911x_device); |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 182 | } |
| 183 | |
Sriram | 562138a | 2009-11-22 10:11:30 -0800 | [diff] [blame] | 184 | #else |
| 185 | static inline void __init omap3evm_init_smsc911x(void) { return; } |
| 186 | #endif |
| 187 | |
Vaibhav Hiremath | 703e306 | 2010-01-04 15:34:16 +0100 | [diff] [blame] | 188 | /* |
| 189 | * OMAP3EVM LCD Panel control signals |
| 190 | */ |
| 191 | #define OMAP3EVM_LCD_PANEL_LR 2 |
| 192 | #define OMAP3EVM_LCD_PANEL_UD 3 |
| 193 | #define OMAP3EVM_LCD_PANEL_INI 152 |
| 194 | #define OMAP3EVM_LCD_PANEL_ENVDD 153 |
| 195 | #define OMAP3EVM_LCD_PANEL_QVGA 154 |
| 196 | #define OMAP3EVM_LCD_PANEL_RESB 155 |
| 197 | #define OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO 210 |
| 198 | #define OMAP3EVM_DVI_PANEL_EN_GPIO 199 |
| 199 | |
| 200 | static int lcd_enabled; |
| 201 | static int dvi_enabled; |
| 202 | |
| 203 | static void __init omap3_evm_display_init(void) |
| 204 | { |
| 205 | int r; |
| 206 | |
| 207 | r = gpio_request(OMAP3EVM_LCD_PANEL_RESB, "lcd_panel_resb"); |
| 208 | if (r) { |
| 209 | printk(KERN_ERR "failed to get lcd_panel_resb\n"); |
| 210 | return; |
| 211 | } |
| 212 | gpio_direction_output(OMAP3EVM_LCD_PANEL_RESB, 1); |
| 213 | |
| 214 | r = gpio_request(OMAP3EVM_LCD_PANEL_INI, "lcd_panel_ini"); |
| 215 | if (r) { |
| 216 | printk(KERN_ERR "failed to get lcd_panel_ini\n"); |
| 217 | goto err_1; |
| 218 | } |
| 219 | gpio_direction_output(OMAP3EVM_LCD_PANEL_INI, 1); |
| 220 | |
| 221 | r = gpio_request(OMAP3EVM_LCD_PANEL_QVGA, "lcd_panel_qvga"); |
| 222 | if (r) { |
| 223 | printk(KERN_ERR "failed to get lcd_panel_qvga\n"); |
| 224 | goto err_2; |
| 225 | } |
| 226 | gpio_direction_output(OMAP3EVM_LCD_PANEL_QVGA, 0); |
| 227 | |
| 228 | r = gpio_request(OMAP3EVM_LCD_PANEL_LR, "lcd_panel_lr"); |
| 229 | if (r) { |
| 230 | printk(KERN_ERR "failed to get lcd_panel_lr\n"); |
| 231 | goto err_3; |
| 232 | } |
| 233 | gpio_direction_output(OMAP3EVM_LCD_PANEL_LR, 1); |
| 234 | |
| 235 | r = gpio_request(OMAP3EVM_LCD_PANEL_UD, "lcd_panel_ud"); |
| 236 | if (r) { |
| 237 | printk(KERN_ERR "failed to get lcd_panel_ud\n"); |
| 238 | goto err_4; |
| 239 | } |
| 240 | gpio_direction_output(OMAP3EVM_LCD_PANEL_UD, 1); |
| 241 | |
| 242 | r = gpio_request(OMAP3EVM_LCD_PANEL_ENVDD, "lcd_panel_envdd"); |
| 243 | if (r) { |
| 244 | printk(KERN_ERR "failed to get lcd_panel_envdd\n"); |
| 245 | goto err_5; |
| 246 | } |
| 247 | gpio_direction_output(OMAP3EVM_LCD_PANEL_ENVDD, 0); |
| 248 | |
| 249 | return; |
| 250 | |
| 251 | err_5: |
| 252 | gpio_free(OMAP3EVM_LCD_PANEL_UD); |
| 253 | err_4: |
| 254 | gpio_free(OMAP3EVM_LCD_PANEL_LR); |
| 255 | err_3: |
| 256 | gpio_free(OMAP3EVM_LCD_PANEL_QVGA); |
| 257 | err_2: |
| 258 | gpio_free(OMAP3EVM_LCD_PANEL_INI); |
| 259 | err_1: |
| 260 | gpio_free(OMAP3EVM_LCD_PANEL_RESB); |
| 261 | |
| 262 | } |
| 263 | |
| 264 | static int omap3_evm_enable_lcd(struct omap_dss_device *dssdev) |
| 265 | { |
| 266 | if (dvi_enabled) { |
| 267 | printk(KERN_ERR "cannot enable LCD, DVI is enabled\n"); |
| 268 | return -EINVAL; |
| 269 | } |
| 270 | gpio_set_value(OMAP3EVM_LCD_PANEL_ENVDD, 0); |
| 271 | |
| 272 | if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) |
Vaibhav Hiremath | f186e9b | 2011-01-25 17:37:37 +0000 | [diff] [blame] | 273 | gpio_set_value_cansleep(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 0); |
Vaibhav Hiremath | 703e306 | 2010-01-04 15:34:16 +0100 | [diff] [blame] | 274 | else |
Vaibhav Hiremath | f186e9b | 2011-01-25 17:37:37 +0000 | [diff] [blame] | 275 | gpio_set_value_cansleep(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 1); |
Vaibhav Hiremath | 703e306 | 2010-01-04 15:34:16 +0100 | [diff] [blame] | 276 | |
| 277 | lcd_enabled = 1; |
| 278 | return 0; |
| 279 | } |
| 280 | |
| 281 | static void omap3_evm_disable_lcd(struct omap_dss_device *dssdev) |
| 282 | { |
| 283 | gpio_set_value(OMAP3EVM_LCD_PANEL_ENVDD, 1); |
| 284 | |
| 285 | if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) |
Vaibhav Hiremath | f186e9b | 2011-01-25 17:37:37 +0000 | [diff] [blame] | 286 | gpio_set_value_cansleep(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 1); |
Vaibhav Hiremath | 703e306 | 2010-01-04 15:34:16 +0100 | [diff] [blame] | 287 | else |
Vaibhav Hiremath | f186e9b | 2011-01-25 17:37:37 +0000 | [diff] [blame] | 288 | gpio_set_value_cansleep(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 0); |
Vaibhav Hiremath | 703e306 | 2010-01-04 15:34:16 +0100 | [diff] [blame] | 289 | |
| 290 | lcd_enabled = 0; |
| 291 | } |
| 292 | |
| 293 | static struct omap_dss_device omap3_evm_lcd_device = { |
| 294 | .name = "lcd", |
| 295 | .driver_name = "sharp_ls_panel", |
| 296 | .type = OMAP_DISPLAY_TYPE_DPI, |
| 297 | .phy.dpi.data_lines = 18, |
| 298 | .platform_enable = omap3_evm_enable_lcd, |
| 299 | .platform_disable = omap3_evm_disable_lcd, |
| 300 | }; |
| 301 | |
| 302 | static int omap3_evm_enable_tv(struct omap_dss_device *dssdev) |
| 303 | { |
| 304 | return 0; |
| 305 | } |
| 306 | |
| 307 | static void omap3_evm_disable_tv(struct omap_dss_device *dssdev) |
| 308 | { |
| 309 | } |
| 310 | |
| 311 | static struct omap_dss_device omap3_evm_tv_device = { |
| 312 | .name = "tv", |
| 313 | .driver_name = "venc", |
| 314 | .type = OMAP_DISPLAY_TYPE_VENC, |
| 315 | .phy.venc.type = OMAP_DSS_VENC_TYPE_SVIDEO, |
| 316 | .platform_enable = omap3_evm_enable_tv, |
| 317 | .platform_disable = omap3_evm_disable_tv, |
| 318 | }; |
| 319 | |
| 320 | static int omap3_evm_enable_dvi(struct omap_dss_device *dssdev) |
| 321 | { |
| 322 | if (lcd_enabled) { |
| 323 | printk(KERN_ERR "cannot enable DVI, LCD is enabled\n"); |
| 324 | return -EINVAL; |
| 325 | } |
| 326 | |
Vaibhav Hiremath | f186e9b | 2011-01-25 17:37:37 +0000 | [diff] [blame] | 327 | gpio_set_value_cansleep(OMAP3EVM_DVI_PANEL_EN_GPIO, 1); |
Vaibhav Hiremath | 703e306 | 2010-01-04 15:34:16 +0100 | [diff] [blame] | 328 | |
| 329 | dvi_enabled = 1; |
| 330 | return 0; |
| 331 | } |
| 332 | |
| 333 | static void omap3_evm_disable_dvi(struct omap_dss_device *dssdev) |
| 334 | { |
Vaibhav Hiremath | f186e9b | 2011-01-25 17:37:37 +0000 | [diff] [blame] | 335 | gpio_set_value_cansleep(OMAP3EVM_DVI_PANEL_EN_GPIO, 0); |
Vaibhav Hiremath | 703e306 | 2010-01-04 15:34:16 +0100 | [diff] [blame] | 336 | |
| 337 | dvi_enabled = 0; |
| 338 | } |
| 339 | |
Bryan Wu | 89747c9 | 2010-11-17 13:34:34 +0000 | [diff] [blame] | 340 | static struct panel_generic_dpi_data dvi_panel = { |
| 341 | .name = "generic", |
Vaibhav Hiremath | 703e306 | 2010-01-04 15:34:16 +0100 | [diff] [blame] | 342 | .platform_enable = omap3_evm_enable_dvi, |
| 343 | .platform_disable = omap3_evm_disable_dvi, |
| 344 | }; |
| 345 | |
Bryan Wu | 89747c9 | 2010-11-17 13:34:34 +0000 | [diff] [blame] | 346 | static struct omap_dss_device omap3_evm_dvi_device = { |
| 347 | .name = "dvi", |
| 348 | .type = OMAP_DISPLAY_TYPE_DPI, |
| 349 | .driver_name = "generic_dpi_panel", |
| 350 | .data = &dvi_panel, |
| 351 | .phy.dpi.data_lines = 24, |
| 352 | }; |
| 353 | |
Vaibhav Hiremath | 703e306 | 2010-01-04 15:34:16 +0100 | [diff] [blame] | 354 | static struct omap_dss_device *omap3_evm_dss_devices[] = { |
| 355 | &omap3_evm_lcd_device, |
| 356 | &omap3_evm_tv_device, |
| 357 | &omap3_evm_dvi_device, |
| 358 | }; |
| 359 | |
| 360 | static struct omap_dss_board_info omap3_evm_dss_data = { |
| 361 | .num_devices = ARRAY_SIZE(omap3_evm_dss_devices), |
| 362 | .devices = omap3_evm_dss_devices, |
| 363 | .default_device = &omap3_evm_lcd_device, |
| 364 | }; |
| 365 | |
Mike Rapoport | 1a7ec13 | 2009-11-22 10:11:29 -0800 | [diff] [blame] | 366 | static struct regulator_consumer_supply omap3evm_vmmc1_supply = { |
| 367 | .supply = "vmmc", |
| 368 | }; |
| 369 | |
| 370 | static struct regulator_consumer_supply omap3evm_vsim_supply = { |
| 371 | .supply = "vmmc_aux", |
| 372 | }; |
| 373 | |
| 374 | /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ |
| 375 | static struct regulator_init_data omap3evm_vmmc1 = { |
| 376 | .constraints = { |
| 377 | .min_uV = 1850000, |
| 378 | .max_uV = 3150000, |
| 379 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 380 | | REGULATOR_MODE_STANDBY, |
| 381 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 382 | | REGULATOR_CHANGE_MODE |
| 383 | | REGULATOR_CHANGE_STATUS, |
| 384 | }, |
| 385 | .num_consumer_supplies = 1, |
| 386 | .consumer_supplies = &omap3evm_vmmc1_supply, |
| 387 | }; |
| 388 | |
| 389 | /* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */ |
| 390 | static struct regulator_init_data omap3evm_vsim = { |
| 391 | .constraints = { |
| 392 | .min_uV = 1800000, |
| 393 | .max_uV = 3000000, |
| 394 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 395 | | REGULATOR_MODE_STANDBY, |
| 396 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 397 | | REGULATOR_CHANGE_MODE |
| 398 | | REGULATOR_CHANGE_STATUS, |
| 399 | }, |
| 400 | .num_consumer_supplies = 1, |
| 401 | .consumer_supplies = &omap3evm_vsim_supply, |
| 402 | }; |
| 403 | |
Adrian Hunter | 68ff042 | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 404 | static struct omap2_hsmmc_info mmc[] = { |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 405 | { |
| 406 | .mmc = 1, |
Sukumar Ghorai | 3a63833 | 2010-09-15 14:49:23 +0000 | [diff] [blame] | 407 | .caps = MMC_CAP_4_BIT_DATA, |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 408 | .gpio_cd = -EINVAL, |
| 409 | .gpio_wp = 63, |
| 410 | }, |
Eyal Reizer | 741927f | 2011-01-27 09:49:49 +0000 | [diff] [blame] | 411 | #ifdef CONFIG_WL12XX_PLATFORM_DATA |
| 412 | { |
| 413 | .name = "wl1271", |
| 414 | .mmc = 2, |
| 415 | .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD, |
| 416 | .gpio_wp = -EINVAL, |
| 417 | .gpio_cd = -EINVAL, |
| 418 | .nonremovable = true, |
| 419 | }, |
| 420 | #endif |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 421 | {} /* Terminator */ |
| 422 | }; |
| 423 | |
| 424 | static struct gpio_led gpio_leds[] = { |
| 425 | { |
| 426 | .name = "omap3evm::ledb", |
| 427 | /* normally not visible (board underside) */ |
| 428 | .default_trigger = "default-on", |
| 429 | .gpio = -EINVAL, /* gets replaced */ |
| 430 | .active_low = true, |
| 431 | }, |
| 432 | }; |
| 433 | |
| 434 | static struct gpio_led_platform_data gpio_led_info = { |
| 435 | .leds = gpio_leds, |
| 436 | .num_leds = ARRAY_SIZE(gpio_leds), |
| 437 | }; |
| 438 | |
| 439 | static struct platform_device leds_gpio = { |
| 440 | .name = "leds-gpio", |
| 441 | .id = -1, |
| 442 | .dev = { |
| 443 | .platform_data = &gpio_led_info, |
| 444 | }, |
| 445 | }; |
| 446 | |
| 447 | |
| 448 | static int omap3evm_twl_gpio_setup(struct device *dev, |
| 449 | unsigned gpio, unsigned ngpio) |
| 450 | { |
Vaibhav Hiremath | 42fc8ca | 2011-01-25 17:37:40 +0000 | [diff] [blame] | 451 | int r; |
| 452 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 453 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 454 | omap_mux_init_gpio(63, OMAP_PIN_INPUT); |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 455 | mmc[0].gpio_cd = gpio + 0; |
Adrian Hunter | 68ff042 | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 456 | omap2_hsmmc_init(mmc); |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 457 | |
Mike Rapoport | 1a7ec13 | 2009-11-22 10:11:29 -0800 | [diff] [blame] | 458 | /* link regulators to MMC adapters */ |
| 459 | omap3evm_vmmc1_supply.dev = mmc[0].dev; |
| 460 | omap3evm_vsim_supply.dev = mmc[0].dev; |
| 461 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 462 | /* |
| 463 | * Most GPIOs are for USB OTG. Some are mostly sent to |
| 464 | * the P2 connector; notably LEDA for the LCD backlight. |
| 465 | */ |
| 466 | |
Vaibhav Hiremath | 703e306 | 2010-01-04 15:34:16 +0100 | [diff] [blame] | 467 | /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */ |
Vaibhav Hiremath | 42fc8ca | 2011-01-25 17:37:40 +0000 | [diff] [blame] | 468 | r = gpio_request(gpio + TWL4030_GPIO_MAX, "EN_LCD_BKL"); |
| 469 | if (!r) |
| 470 | r = gpio_direction_output(gpio + TWL4030_GPIO_MAX, |
| 471 | (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) ? 1 : 0); |
| 472 | if (r) |
| 473 | printk(KERN_ERR "failed to get/set lcd_bkl gpio\n"); |
Vaibhav Hiremath | 703e306 | 2010-01-04 15:34:16 +0100 | [diff] [blame] | 474 | |
| 475 | /* gpio + 7 == DVI Enable */ |
| 476 | gpio_request(gpio + 7, "EN_DVI"); |
| 477 | gpio_direction_output(gpio + 7, 0); |
| 478 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 479 | /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ |
| 480 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; |
| 481 | |
| 482 | platform_device_register(&leds_gpio); |
| 483 | |
| 484 | return 0; |
| 485 | } |
| 486 | |
| 487 | static struct twl4030_gpio_platform_data omap3evm_gpio_data = { |
| 488 | .gpio_base = OMAP_MAX_GPIO_LINES, |
| 489 | .irq_base = TWL4030_GPIO_IRQ_BASE, |
| 490 | .irq_end = TWL4030_GPIO_IRQ_END, |
| 491 | .use_leds = true, |
| 492 | .setup = omap3evm_twl_gpio_setup, |
| 493 | }; |
| 494 | |
| 495 | static struct twl4030_usb_data omap3evm_usb_data = { |
| 496 | .usb_mode = T2_USB_MODE_ULPI, |
| 497 | }; |
| 498 | |
Manjunath Kondaiah G | bead437 | 2010-10-08 10:01:13 -0700 | [diff] [blame] | 499 | static uint32_t board_keymap[] = { |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 500 | KEY(0, 0, KEY_LEFT), |
Sanjeev Premi | 0621d75 | 2010-02-17 14:09:24 -0800 | [diff] [blame] | 501 | KEY(0, 1, KEY_DOWN), |
| 502 | KEY(0, 2, KEY_ENTER), |
| 503 | KEY(0, 3, KEY_M), |
| 504 | |
| 505 | KEY(1, 0, KEY_RIGHT), |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 506 | KEY(1, 1, KEY_UP), |
Sanjeev Premi | 0621d75 | 2010-02-17 14:09:24 -0800 | [diff] [blame] | 507 | KEY(1, 2, KEY_I), |
| 508 | KEY(1, 3, KEY_N), |
| 509 | |
| 510 | KEY(2, 0, KEY_A), |
| 511 | KEY(2, 1, KEY_E), |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 512 | KEY(2, 2, KEY_J), |
Sanjeev Premi | 0621d75 | 2010-02-17 14:09:24 -0800 | [diff] [blame] | 513 | KEY(2, 3, KEY_O), |
| 514 | |
| 515 | KEY(3, 0, KEY_B), |
| 516 | KEY(3, 1, KEY_F), |
| 517 | KEY(3, 2, KEY_K), |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 518 | KEY(3, 3, KEY_P) |
| 519 | }; |
| 520 | |
Tony Lindgren | 4f54333 | 2009-09-24 16:23:16 -0700 | [diff] [blame] | 521 | static struct matrix_keymap_data board_map_data = { |
| 522 | .keymap = board_keymap, |
| 523 | .keymap_size = ARRAY_SIZE(board_keymap), |
| 524 | }; |
| 525 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 526 | static struct twl4030_keypad_data omap3evm_kp_data = { |
Tony Lindgren | 4f54333 | 2009-09-24 16:23:16 -0700 | [diff] [blame] | 527 | .keymap_data = &board_map_data, |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 528 | .rows = 4, |
| 529 | .cols = 4, |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 530 | .rep = 1, |
| 531 | }; |
| 532 | |
| 533 | static struct twl4030_madc_platform_data omap3evm_madc_data = { |
| 534 | .irq_line = 1, |
| 535 | }; |
| 536 | |
Ilkka Koskinen | 6a58baf | 2011-03-02 13:24:05 +0000 | [diff] [blame^] | 537 | static struct twl4030_codec_audio_data omap3evm_audio_data; |
Peter Ujfalusi | e86fa0b | 2009-10-22 13:26:46 +0300 | [diff] [blame] | 538 | |
| 539 | static struct twl4030_codec_data omap3evm_codec_data = { |
Peter Ujfalusi | 6df74ef | 2009-11-04 09:58:18 +0200 | [diff] [blame] | 540 | .audio_mclk = 26000000, |
Peter Ujfalusi | e86fa0b | 2009-10-22 13:26:46 +0300 | [diff] [blame] | 541 | .audio = &omap3evm_audio_data, |
| 542 | }; |
| 543 | |
Senthilvadivu Guruswamy | 1dde973 | 2011-01-24 06:21:53 +0000 | [diff] [blame] | 544 | static struct regulator_consumer_supply omap3_evm_vdda_dac_supply = |
| 545 | REGULATOR_SUPPLY("vdda_dac", "omapdss"); |
Vaibhav Hiremath | 703e306 | 2010-01-04 15:34:16 +0100 | [diff] [blame] | 546 | |
| 547 | /* VDAC for DSS driving S-Video */ |
| 548 | static struct regulator_init_data omap3_evm_vdac = { |
| 549 | .constraints = { |
| 550 | .min_uV = 1800000, |
| 551 | .max_uV = 1800000, |
| 552 | .apply_uV = true, |
| 553 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 554 | | REGULATOR_MODE_STANDBY, |
| 555 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 556 | | REGULATOR_CHANGE_STATUS, |
| 557 | }, |
| 558 | .num_consumer_supplies = 1, |
| 559 | .consumer_supplies = &omap3_evm_vdda_dac_supply, |
| 560 | }; |
| 561 | |
| 562 | /* VPLL2 for digital video outputs */ |
Vaibhav Hiremath | f3fe53c | 2010-03-19 11:21:19 +0000 | [diff] [blame] | 563 | static struct regulator_consumer_supply omap3_evm_vpll2_supply = |
| 564 | REGULATOR_SUPPLY("vdds_dsi", "omapdss"); |
Vaibhav Hiremath | 703e306 | 2010-01-04 15:34:16 +0100 | [diff] [blame] | 565 | |
| 566 | static struct regulator_init_data omap3_evm_vpll2 = { |
| 567 | .constraints = { |
Vaibhav Hiremath | 703e306 | 2010-01-04 15:34:16 +0100 | [diff] [blame] | 568 | .min_uV = 1800000, |
| 569 | .max_uV = 1800000, |
| 570 | .apply_uV = true, |
| 571 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 572 | | REGULATOR_MODE_STANDBY, |
| 573 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 574 | | REGULATOR_CHANGE_STATUS, |
| 575 | }, |
| 576 | .num_consumer_supplies = 1, |
| 577 | .consumer_supplies = &omap3_evm_vpll2_supply, |
| 578 | }; |
| 579 | |
Vaibhav Hiremath | 410491d | 2011-01-25 17:37:38 +0000 | [diff] [blame] | 580 | /* ads7846 on SPI */ |
| 581 | static struct regulator_consumer_supply omap3evm_vio_supply = |
| 582 | REGULATOR_SUPPLY("vcc", "spi1.0"); |
| 583 | |
| 584 | /* VIO for ads7846 */ |
| 585 | static struct regulator_init_data omap3evm_vio = { |
| 586 | .constraints = { |
| 587 | .min_uV = 1800000, |
| 588 | .max_uV = 1800000, |
| 589 | .apply_uV = true, |
| 590 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 591 | | REGULATOR_MODE_STANDBY, |
| 592 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 593 | | REGULATOR_CHANGE_STATUS, |
| 594 | }, |
| 595 | .num_consumer_supplies = 1, |
| 596 | .consumer_supplies = &omap3evm_vio_supply, |
| 597 | }; |
| 598 | |
Eyal Reizer | 741927f | 2011-01-27 09:49:49 +0000 | [diff] [blame] | 599 | #ifdef CONFIG_WL12XX_PLATFORM_DATA |
| 600 | |
| 601 | #define OMAP3EVM_WLAN_PMENA_GPIO (150) |
| 602 | #define OMAP3EVM_WLAN_IRQ_GPIO (149) |
| 603 | |
| 604 | static struct regulator_consumer_supply omap3evm_vmmc2_supply = { |
| 605 | .supply = "vmmc", |
| 606 | .dev_name = "mmci-omap-hs.1", |
| 607 | }; |
| 608 | |
| 609 | /* VMMC2 for driving the WL12xx module */ |
| 610 | static struct regulator_init_data omap3evm_vmmc2 = { |
| 611 | .constraints = { |
| 612 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
| 613 | }, |
| 614 | .num_consumer_supplies = 1, |
| 615 | .consumer_supplies = &omap3evm_vmmc2_supply, |
| 616 | }; |
| 617 | |
| 618 | static struct fixed_voltage_config omap3evm_vwlan = { |
| 619 | .supply_name = "vwl1271", |
| 620 | .microvolts = 1800000, /* 1.80V */ |
| 621 | .gpio = OMAP3EVM_WLAN_PMENA_GPIO, |
| 622 | .startup_delay = 70000, /* 70ms */ |
| 623 | .enable_high = 1, |
| 624 | .enabled_at_boot = 0, |
| 625 | .init_data = &omap3evm_vmmc2, |
| 626 | }; |
| 627 | |
| 628 | static struct platform_device omap3evm_vwlan_device = { |
| 629 | .name = "reg-fixed-voltage", |
| 630 | .id = 1, |
| 631 | .dev = { |
| 632 | .platform_data = &omap3evm_vwlan, |
| 633 | }, |
| 634 | }; |
| 635 | |
| 636 | struct wl12xx_platform_data omap3evm_wlan_data __initdata = { |
| 637 | .irq = OMAP_GPIO_IRQ(OMAP3EVM_WLAN_IRQ_GPIO), |
| 638 | /* ref clock is 38.4 MHz */ |
| 639 | .board_ref_clock = 2, |
| 640 | }; |
| 641 | #endif |
| 642 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 643 | static struct twl4030_platform_data omap3evm_twldata = { |
| 644 | .irq_base = TWL4030_IRQ_BASE, |
| 645 | .irq_end = TWL4030_IRQ_END, |
| 646 | |
| 647 | /* platform_data for children goes here */ |
| 648 | .keypad = &omap3evm_kp_data, |
| 649 | .madc = &omap3evm_madc_data, |
| 650 | .usb = &omap3evm_usb_data, |
| 651 | .gpio = &omap3evm_gpio_data, |
Peter Ujfalusi | e86fa0b | 2009-10-22 13:26:46 +0300 | [diff] [blame] | 652 | .codec = &omap3evm_codec_data, |
Vaibhav Hiremath | 703e306 | 2010-01-04 15:34:16 +0100 | [diff] [blame] | 653 | .vdac = &omap3_evm_vdac, |
| 654 | .vpll2 = &omap3_evm_vpll2, |
Vaibhav Hiremath | 410491d | 2011-01-25 17:37:38 +0000 | [diff] [blame] | 655 | .vio = &omap3evm_vio, |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 656 | }; |
| 657 | |
| 658 | static struct i2c_board_info __initdata omap3evm_i2c_boardinfo[] = { |
| 659 | { |
| 660 | I2C_BOARD_INFO("twl4030", 0x48), |
| 661 | .flags = I2C_CLIENT_WAKE, |
| 662 | .irq = INT_34XX_SYS_NIRQ, |
| 663 | .platform_data = &omap3evm_twldata, |
| 664 | }, |
| 665 | }; |
| 666 | |
| 667 | static int __init omap3_evm_i2c_init(void) |
| 668 | { |
Mike Rapoport | 1a7ec13 | 2009-11-22 10:11:29 -0800 | [diff] [blame] | 669 | /* |
| 670 | * REVISIT: These entries can be set in omap3evm_twl_data |
| 671 | * after a merge with MFD tree |
| 672 | */ |
| 673 | omap3evm_twldata.vmmc1 = &omap3evm_vmmc1; |
| 674 | omap3evm_twldata.vsim = &omap3evm_vsim; |
| 675 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 676 | omap_register_i2c_bus(1, 2600, omap3evm_i2c_boardinfo, |
| 677 | ARRAY_SIZE(omap3evm_i2c_boardinfo)); |
| 678 | omap_register_i2c_bus(2, 400, NULL, 0); |
| 679 | omap_register_i2c_bus(3, 400, NULL, 0); |
| 680 | return 0; |
| 681 | } |
| 682 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 683 | static void ads7846_dev_init(void) |
| 684 | { |
| 685 | if (gpio_request(OMAP3_EVM_TS_GPIO, "ADS7846 pendown") < 0) |
| 686 | printk(KERN_ERR "can't get ads7846 pen down GPIO\n"); |
| 687 | |
| 688 | gpio_direction_input(OMAP3_EVM_TS_GPIO); |
Felipe Balbi | 48feb33 | 2010-05-26 14:42:24 -0700 | [diff] [blame] | 689 | gpio_set_debounce(OMAP3_EVM_TS_GPIO, 310); |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 690 | } |
| 691 | |
| 692 | static int ads7846_get_pendown_state(void) |
| 693 | { |
| 694 | return !gpio_get_value(OMAP3_EVM_TS_GPIO); |
| 695 | } |
| 696 | |
Manjunath Kondaiah G | 3881573 | 2010-10-08 09:56:37 -0700 | [diff] [blame] | 697 | static struct ads7846_platform_data ads7846_config = { |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 698 | .x_max = 0x0fff, |
| 699 | .y_max = 0x0fff, |
| 700 | .x_plate_ohms = 180, |
| 701 | .pressure_max = 255, |
| 702 | .debounce_max = 10, |
| 703 | .debounce_tol = 3, |
| 704 | .debounce_rep = 1, |
| 705 | .get_pendown_state = ads7846_get_pendown_state, |
| 706 | .keep_vref_on = 1, |
| 707 | .settle_delay_usecs = 150, |
Ranjith Lohithakshan | 7a44ad2 | 2010-05-08 12:39:21 +0530 | [diff] [blame] | 708 | .wakeup = true, |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 709 | }; |
| 710 | |
| 711 | static struct omap2_mcspi_device_config ads7846_mcspi_config = { |
| 712 | .turbo_mode = 0, |
| 713 | .single_channel = 1, /* 0: slave, 1: master */ |
| 714 | }; |
| 715 | |
Manjunath Kondaiah G | 3881573 | 2010-10-08 09:56:37 -0700 | [diff] [blame] | 716 | static struct spi_board_info omap3evm_spi_board_info[] = { |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 717 | [0] = { |
| 718 | .modalias = "ads7846", |
| 719 | .bus_num = 1, |
| 720 | .chip_select = 0, |
| 721 | .max_speed_hz = 1500000, |
| 722 | .controller_data = &ads7846_mcspi_config, |
| 723 | .irq = OMAP_GPIO_IRQ(OMAP3_EVM_TS_GPIO), |
| 724 | .platform_data = &ads7846_config, |
| 725 | }, |
| 726 | }; |
| 727 | |
Paul Walmsley | b3c6df3 | 2009-09-03 20:14:02 +0300 | [diff] [blame] | 728 | static struct omap_board_config_kernel omap3_evm_config[] __initdata = { |
Paul Walmsley | b3c6df3 | 2009-09-03 20:14:02 +0300 | [diff] [blame] | 729 | }; |
| 730 | |
Russell King - ARM Linux | 3dc3bad | 2011-02-14 15:40:20 -0800 | [diff] [blame] | 731 | static void __init omap3_evm_init_early(void) |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 732 | { |
Paul Walmsley | 4805734 | 2010-12-21 15:25:10 -0700 | [diff] [blame] | 733 | omap2_init_common_infrastructure(); |
| 734 | omap2_init_common_devices(mt46h32m32lf6_sdrc_params, NULL); |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 735 | } |
| 736 | |
Felipe Balbi | 6f69a18 | 2010-03-04 09:45:53 +0200 | [diff] [blame] | 737 | static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = { |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 738 | |
| 739 | .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN, |
| 740 | .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY, |
| 741 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, |
| 742 | |
| 743 | .phy_reset = true, |
Ajay Kumar Gupta | e8e51d2 | 2009-11-22 10:11:28 -0800 | [diff] [blame] | 744 | /* PHY reset GPIO will be runtime programmed based on EVM version */ |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 745 | .reset_gpio_port[0] = -EINVAL, |
Ajay Kumar Gupta | e8e51d2 | 2009-11-22 10:11:28 -0800 | [diff] [blame] | 746 | .reset_gpio_port[1] = -EINVAL, |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 747 | .reset_gpio_port[2] = -EINVAL |
| 748 | }; |
| 749 | |
Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 750 | #ifdef CONFIG_OMAP_MUX |
Vaibhav Hiremath | 904c545 | 2011-01-25 17:37:39 +0000 | [diff] [blame] | 751 | static struct omap_board_mux omap35x_board_mux[] __initdata = { |
Sanjeev Premi | aa6912d8 | 2010-02-17 14:09:23 -0800 | [diff] [blame] | 752 | OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP | |
Ranjith Lohithakshan | f3a8cde | 2010-05-03 17:07:51 +0530 | [diff] [blame] | 753 | OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW | |
Sanjeev Premi | aa6912d8 | 2010-02-17 14:09:23 -0800 | [diff] [blame] | 754 | OMAP_PIN_OFF_WAKEUPENABLE), |
Sanjeev Premi | 87520aa | 2010-02-17 14:09:24 -0800 | [diff] [blame] | 755 | OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP | |
Vaibhav Hiremath | 854c122 | 2011-01-25 17:37:41 +0000 | [diff] [blame] | 756 | OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW | |
| 757 | OMAP_PIN_OFF_WAKEUPENABLE), |
Vaibhav Hiremath | 9bc64b8 | 2011-01-24 19:25:55 +0000 | [diff] [blame] | 758 | OMAP3_MUX(SYS_BOOT5, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP | |
| 759 | OMAP_PIN_OFF_NONE), |
| 760 | OMAP3_MUX(GPMC_WAIT2, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP | |
| 761 | OMAP_PIN_OFF_NONE), |
Eyal Reizer | 741927f | 2011-01-27 09:49:49 +0000 | [diff] [blame] | 762 | #ifdef CONFIG_WL12XX_PLATFORM_DATA |
| 763 | /* WLAN IRQ - GPIO 149 */ |
| 764 | OMAP3_MUX(UART1_RTS, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP), |
| 765 | |
| 766 | /* WLAN POWER ENABLE - GPIO 150 */ |
| 767 | OMAP3_MUX(UART1_CTS, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), |
| 768 | |
| 769 | /* MMC2 SDIO pin muxes for WL12xx */ |
| 770 | OMAP3_MUX(SDMMC2_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP), |
| 771 | OMAP3_MUX(SDMMC2_CMD, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP), |
| 772 | OMAP3_MUX(SDMMC2_DAT0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP), |
| 773 | OMAP3_MUX(SDMMC2_DAT1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP), |
| 774 | OMAP3_MUX(SDMMC2_DAT2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP), |
| 775 | OMAP3_MUX(SDMMC2_DAT3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP), |
| 776 | #endif |
Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 777 | { .reg_offset = OMAP_MUX_TERMINATOR }, |
| 778 | }; |
Vaibhav Hiremath | 904c545 | 2011-01-25 17:37:39 +0000 | [diff] [blame] | 779 | |
| 780 | static struct omap_board_mux omap36x_board_mux[] __initdata = { |
| 781 | OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP | |
| 782 | OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW | |
| 783 | OMAP_PIN_OFF_WAKEUPENABLE), |
| 784 | OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP | |
Vaibhav Hiremath | 854c122 | 2011-01-25 17:37:41 +0000 | [diff] [blame] | 785 | OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW | |
| 786 | OMAP_PIN_OFF_WAKEUPENABLE), |
Vaibhav Hiremath | 904c545 | 2011-01-25 17:37:39 +0000 | [diff] [blame] | 787 | /* AM/DM37x EVM: DSS data bus muxed with sys_boot */ |
| 788 | OMAP3_MUX(DSS_DATA18, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE), |
| 789 | OMAP3_MUX(DSS_DATA19, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE), |
| 790 | OMAP3_MUX(DSS_DATA22, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE), |
| 791 | OMAP3_MUX(DSS_DATA21, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE), |
| 792 | OMAP3_MUX(DSS_DATA22, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE), |
| 793 | OMAP3_MUX(DSS_DATA23, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE), |
| 794 | OMAP3_MUX(SYS_BOOT0, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE), |
| 795 | OMAP3_MUX(SYS_BOOT1, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE), |
| 796 | OMAP3_MUX(SYS_BOOT3, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE), |
| 797 | OMAP3_MUX(SYS_BOOT4, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE), |
| 798 | OMAP3_MUX(SYS_BOOT5, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE), |
| 799 | OMAP3_MUX(SYS_BOOT6, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE), |
| 800 | |
| 801 | { .reg_offset = OMAP_MUX_TERMINATOR }, |
| 802 | }; |
| 803 | #else |
| 804 | #define omap35x_board_mux NULL |
| 805 | #define omap36x_board_mux NULL |
Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 806 | #endif |
| 807 | |
Maulik Mankad | 884b836 | 2010-02-17 14:09:30 -0800 | [diff] [blame] | 808 | static struct omap_musb_board_data musb_board_data = { |
| 809 | .interface_type = MUSB_INTERFACE_ULPI, |
| 810 | .mode = MUSB_OTG, |
| 811 | .power = 100, |
| 812 | }; |
| 813 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 814 | static void __init omap3_evm_init(void) |
| 815 | { |
Ajay Kumar Gupta | db40802 | 2009-11-22 10:11:27 -0800 | [diff] [blame] | 816 | omap3_evm_get_revision(); |
Vaibhav Hiremath | 904c545 | 2011-01-25 17:37:39 +0000 | [diff] [blame] | 817 | |
| 818 | if (cpu_is_omap3630()) |
| 819 | omap3_mux_init(omap36x_board_mux, OMAP_PACKAGE_CBB); |
| 820 | else |
| 821 | omap3_mux_init(omap35x_board_mux, OMAP_PACKAGE_CBB); |
Ajay Kumar Gupta | db40802 | 2009-11-22 10:11:27 -0800 | [diff] [blame] | 822 | |
Tony Lindgren | e41cccf | 2011-02-24 14:36:03 -0800 | [diff] [blame] | 823 | omap_board_config = omap3_evm_config; |
| 824 | omap_board_config_size = ARRAY_SIZE(omap3_evm_config); |
| 825 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 826 | omap3_evm_i2c_init(); |
| 827 | |
Senthilvadivu Guruswamy | d5e1322 | 2011-02-22 11:24:50 +0200 | [diff] [blame] | 828 | omap_display_init(&omap3_evm_dss_data); |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 829 | |
| 830 | spi_register_board_info(omap3evm_spi_board_info, |
| 831 | ARRAY_SIZE(omap3evm_spi_board_info)); |
| 832 | |
| 833 | omap_serial_init(); |
Maulik Mankad | 1a4f463 | 2010-02-17 14:09:29 -0800 | [diff] [blame] | 834 | |
Gupta, Ajay Kumar | e8e2ff4 | 2009-07-29 11:58:57 +0530 | [diff] [blame] | 835 | /* OMAP3EVM uses ISP1504 phy and so register nop transceiver */ |
| 836 | usb_nop_xceiv_register(); |
Maulik Mankad | 1a4f463 | 2010-02-17 14:09:29 -0800 | [diff] [blame] | 837 | |
Ajay Kumar Gupta | e8e51d2 | 2009-11-22 10:11:28 -0800 | [diff] [blame] | 838 | if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) { |
| 839 | /* enable EHCI VBUS using GPIO22 */ |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 840 | omap_mux_init_gpio(22, OMAP_PIN_INPUT_PULLUP); |
Ajay Kumar Gupta | e8e51d2 | 2009-11-22 10:11:28 -0800 | [diff] [blame] | 841 | gpio_request(OMAP3_EVM_EHCI_VBUS, "enable EHCI VBUS"); |
| 842 | gpio_direction_output(OMAP3_EVM_EHCI_VBUS, 0); |
| 843 | gpio_set_value(OMAP3_EVM_EHCI_VBUS, 1); |
| 844 | |
| 845 | /* Select EHCI port on main board */ |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 846 | omap_mux_init_gpio(61, OMAP_PIN_INPUT_PULLUP); |
Ajay Kumar Gupta | e8e51d2 | 2009-11-22 10:11:28 -0800 | [diff] [blame] | 847 | gpio_request(OMAP3_EVM_EHCI_SELECT, "select EHCI port"); |
| 848 | gpio_direction_output(OMAP3_EVM_EHCI_SELECT, 0); |
| 849 | gpio_set_value(OMAP3_EVM_EHCI_SELECT, 0); |
| 850 | |
| 851 | /* setup EHCI phy reset config */ |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 852 | omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP); |
Ajay Kumar Gupta | e8e51d2 | 2009-11-22 10:11:28 -0800 | [diff] [blame] | 853 | ehci_pdata.reset_gpio_port[1] = 21; |
| 854 | |
Ajay Kumar Gupta | 58815fa | 2010-03-25 13:25:27 +0200 | [diff] [blame] | 855 | /* EVM REV >= E can supply 500mA with EXTVBUS programming */ |
| 856 | musb_board_data.power = 500; |
| 857 | musb_board_data.extvbus = 1; |
Ajay Kumar Gupta | e8e51d2 | 2009-11-22 10:11:28 -0800 | [diff] [blame] | 858 | } else { |
| 859 | /* setup EHCI phy reset on MDC */ |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 860 | omap_mux_init_gpio(135, OMAP_PIN_OUTPUT); |
Ajay Kumar Gupta | e8e51d2 | 2009-11-22 10:11:28 -0800 | [diff] [blame] | 861 | ehci_pdata.reset_gpio_port[1] = 135; |
| 862 | } |
Maulik Mankad | 884b836 | 2010-02-17 14:09:30 -0800 | [diff] [blame] | 863 | usb_musb_init(&musb_board_data); |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 864 | usb_ehci_init(&ehci_pdata); |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 865 | ads7846_dev_init(); |
Sriram | 562138a | 2009-11-22 10:11:30 -0800 | [diff] [blame] | 866 | omap3evm_init_smsc911x(); |
Vaibhav Hiremath | 703e306 | 2010-01-04 15:34:16 +0100 | [diff] [blame] | 867 | omap3_evm_display_init(); |
Eyal Reizer | 741927f | 2011-01-27 09:49:49 +0000 | [diff] [blame] | 868 | |
| 869 | #ifdef CONFIG_WL12XX_PLATFORM_DATA |
| 870 | /* WL12xx WLAN Init */ |
| 871 | if (wl12xx_set_platform_data(&omap3evm_wlan_data)) |
| 872 | pr_err("error setting wl12xx data\n"); |
| 873 | platform_device_register(&omap3evm_vwlan_device); |
| 874 | #endif |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 875 | } |
| 876 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 877 | MACHINE_START(OMAP3EVM, "OMAP3 EVM") |
| 878 | /* Maintainer: Syed Mohammed Khasim - Texas Instruments */ |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 879 | .boot_params = 0x80000100, |
Russell King | 71ee7da | 2010-05-23 10:18:16 +0100 | [diff] [blame] | 880 | .reserve = omap_reserve, |
Russell King - ARM Linux | 3dc3bad | 2011-02-14 15:40:20 -0800 | [diff] [blame] | 881 | .map_io = omap3_map_io, |
| 882 | .init_early = omap3_evm_init_early, |
| 883 | .init_irq = omap_init_irq, |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 884 | .init_machine = omap3_evm_init, |
| 885 | .timer = &omap_timer, |
| 886 | MACHINE_END |