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 | d02a900b | 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 | |
| 366 | static struct platform_device omap3_evm_dss_device = { |
| 367 | .name = "omapdss", |
| 368 | .id = -1, |
| 369 | .dev = { |
| 370 | .platform_data = &omap3_evm_dss_data, |
| 371 | }, |
| 372 | }; |
| 373 | |
Mike Rapoport | 1a7ec13 | 2009-11-22 10:11:29 -0800 | [diff] [blame] | 374 | static struct regulator_consumer_supply omap3evm_vmmc1_supply = { |
| 375 | .supply = "vmmc", |
| 376 | }; |
| 377 | |
| 378 | static struct regulator_consumer_supply omap3evm_vsim_supply = { |
| 379 | .supply = "vmmc_aux", |
| 380 | }; |
| 381 | |
| 382 | /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */ |
| 383 | static struct regulator_init_data omap3evm_vmmc1 = { |
| 384 | .constraints = { |
| 385 | .min_uV = 1850000, |
| 386 | .max_uV = 3150000, |
| 387 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 388 | | REGULATOR_MODE_STANDBY, |
| 389 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 390 | | REGULATOR_CHANGE_MODE |
| 391 | | REGULATOR_CHANGE_STATUS, |
| 392 | }, |
| 393 | .num_consumer_supplies = 1, |
| 394 | .consumer_supplies = &omap3evm_vmmc1_supply, |
| 395 | }; |
| 396 | |
| 397 | /* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */ |
| 398 | static struct regulator_init_data omap3evm_vsim = { |
| 399 | .constraints = { |
| 400 | .min_uV = 1800000, |
| 401 | .max_uV = 3000000, |
| 402 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 403 | | REGULATOR_MODE_STANDBY, |
| 404 | .valid_ops_mask = REGULATOR_CHANGE_VOLTAGE |
| 405 | | REGULATOR_CHANGE_MODE |
| 406 | | REGULATOR_CHANGE_STATUS, |
| 407 | }, |
| 408 | .num_consumer_supplies = 1, |
| 409 | .consumer_supplies = &omap3evm_vsim_supply, |
| 410 | }; |
| 411 | |
Adrian Hunter | 68ff042 | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 412 | static struct omap2_hsmmc_info mmc[] = { |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 413 | { |
| 414 | .mmc = 1, |
Sukumar Ghorai | 3a63833 | 2010-09-15 14:49:23 +0000 | [diff] [blame] | 415 | .caps = MMC_CAP_4_BIT_DATA, |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 416 | .gpio_cd = -EINVAL, |
| 417 | .gpio_wp = 63, |
| 418 | }, |
Eyal Reizer | 741927f | 2011-01-27 09:49:49 +0000 | [diff] [blame] | 419 | #ifdef CONFIG_WL12XX_PLATFORM_DATA |
| 420 | { |
| 421 | .name = "wl1271", |
| 422 | .mmc = 2, |
| 423 | .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD, |
| 424 | .gpio_wp = -EINVAL, |
| 425 | .gpio_cd = -EINVAL, |
| 426 | .nonremovable = true, |
| 427 | }, |
| 428 | #endif |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 429 | {} /* Terminator */ |
| 430 | }; |
| 431 | |
| 432 | static struct gpio_led gpio_leds[] = { |
| 433 | { |
| 434 | .name = "omap3evm::ledb", |
| 435 | /* normally not visible (board underside) */ |
| 436 | .default_trigger = "default-on", |
| 437 | .gpio = -EINVAL, /* gets replaced */ |
| 438 | .active_low = true, |
| 439 | }, |
| 440 | }; |
| 441 | |
| 442 | static struct gpio_led_platform_data gpio_led_info = { |
| 443 | .leds = gpio_leds, |
| 444 | .num_leds = ARRAY_SIZE(gpio_leds), |
| 445 | }; |
| 446 | |
| 447 | static struct platform_device leds_gpio = { |
| 448 | .name = "leds-gpio", |
| 449 | .id = -1, |
| 450 | .dev = { |
| 451 | .platform_data = &gpio_led_info, |
| 452 | }, |
| 453 | }; |
| 454 | |
| 455 | |
| 456 | static int omap3evm_twl_gpio_setup(struct device *dev, |
| 457 | unsigned gpio, unsigned ngpio) |
| 458 | { |
Vaibhav Hiremath | 42fc8ca | 2011-01-25 17:37:40 +0000 | [diff] [blame] | 459 | int r; |
| 460 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 461 | /* gpio + 0 is "mmc0_cd" (input/IRQ) */ |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 462 | omap_mux_init_gpio(63, OMAP_PIN_INPUT); |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 463 | mmc[0].gpio_cd = gpio + 0; |
Adrian Hunter | 68ff042 | 2010-02-15 10:03:34 -0800 | [diff] [blame] | 464 | omap2_hsmmc_init(mmc); |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 465 | |
Mike Rapoport | 1a7ec13 | 2009-11-22 10:11:29 -0800 | [diff] [blame] | 466 | /* link regulators to MMC adapters */ |
| 467 | omap3evm_vmmc1_supply.dev = mmc[0].dev; |
| 468 | omap3evm_vsim_supply.dev = mmc[0].dev; |
| 469 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 470 | /* |
| 471 | * Most GPIOs are for USB OTG. Some are mostly sent to |
| 472 | * the P2 connector; notably LEDA for the LCD backlight. |
| 473 | */ |
| 474 | |
Vaibhav Hiremath | 703e306 | 2010-01-04 15:34:16 +0100 | [diff] [blame] | 475 | /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */ |
Vaibhav Hiremath | 42fc8ca | 2011-01-25 17:37:40 +0000 | [diff] [blame] | 476 | r = gpio_request(gpio + TWL4030_GPIO_MAX, "EN_LCD_BKL"); |
| 477 | if (!r) |
| 478 | r = gpio_direction_output(gpio + TWL4030_GPIO_MAX, |
| 479 | (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) ? 1 : 0); |
| 480 | if (r) |
| 481 | printk(KERN_ERR "failed to get/set lcd_bkl gpio\n"); |
Vaibhav Hiremath | 703e306 | 2010-01-04 15:34:16 +0100 | [diff] [blame] | 482 | |
| 483 | /* gpio + 7 == DVI Enable */ |
| 484 | gpio_request(gpio + 7, "EN_DVI"); |
| 485 | gpio_direction_output(gpio + 7, 0); |
| 486 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 487 | /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ |
| 488 | gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; |
| 489 | |
| 490 | platform_device_register(&leds_gpio); |
| 491 | |
| 492 | return 0; |
| 493 | } |
| 494 | |
| 495 | static struct twl4030_gpio_platform_data omap3evm_gpio_data = { |
| 496 | .gpio_base = OMAP_MAX_GPIO_LINES, |
| 497 | .irq_base = TWL4030_GPIO_IRQ_BASE, |
| 498 | .irq_end = TWL4030_GPIO_IRQ_END, |
| 499 | .use_leds = true, |
| 500 | .setup = omap3evm_twl_gpio_setup, |
| 501 | }; |
| 502 | |
| 503 | static struct twl4030_usb_data omap3evm_usb_data = { |
| 504 | .usb_mode = T2_USB_MODE_ULPI, |
| 505 | }; |
| 506 | |
Manjunath Kondaiah G | bead437 | 2010-10-08 10:01:13 -0700 | [diff] [blame] | 507 | static uint32_t board_keymap[] = { |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 508 | KEY(0, 0, KEY_LEFT), |
Sanjeev Premi | 0621d75 | 2010-02-17 14:09:24 -0800 | [diff] [blame] | 509 | KEY(0, 1, KEY_DOWN), |
| 510 | KEY(0, 2, KEY_ENTER), |
| 511 | KEY(0, 3, KEY_M), |
| 512 | |
| 513 | KEY(1, 0, KEY_RIGHT), |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 514 | KEY(1, 1, KEY_UP), |
Sanjeev Premi | 0621d75 | 2010-02-17 14:09:24 -0800 | [diff] [blame] | 515 | KEY(1, 2, KEY_I), |
| 516 | KEY(1, 3, KEY_N), |
| 517 | |
| 518 | KEY(2, 0, KEY_A), |
| 519 | KEY(2, 1, KEY_E), |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 520 | KEY(2, 2, KEY_J), |
Sanjeev Premi | 0621d75 | 2010-02-17 14:09:24 -0800 | [diff] [blame] | 521 | KEY(2, 3, KEY_O), |
| 522 | |
| 523 | KEY(3, 0, KEY_B), |
| 524 | KEY(3, 1, KEY_F), |
| 525 | KEY(3, 2, KEY_K), |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 526 | KEY(3, 3, KEY_P) |
| 527 | }; |
| 528 | |
Tony Lindgren | 4f54333 | 2009-09-24 16:23:16 -0700 | [diff] [blame] | 529 | static struct matrix_keymap_data board_map_data = { |
| 530 | .keymap = board_keymap, |
| 531 | .keymap_size = ARRAY_SIZE(board_keymap), |
| 532 | }; |
| 533 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 534 | static struct twl4030_keypad_data omap3evm_kp_data = { |
Tony Lindgren | 4f54333 | 2009-09-24 16:23:16 -0700 | [diff] [blame] | 535 | .keymap_data = &board_map_data, |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 536 | .rows = 4, |
| 537 | .cols = 4, |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 538 | .rep = 1, |
| 539 | }; |
| 540 | |
| 541 | static struct twl4030_madc_platform_data omap3evm_madc_data = { |
| 542 | .irq_line = 1, |
| 543 | }; |
| 544 | |
Peter Ujfalusi | e86fa0b | 2009-10-22 13:26:46 +0300 | [diff] [blame] | 545 | static struct twl4030_codec_audio_data omap3evm_audio_data = { |
| 546 | .audio_mclk = 26000000, |
| 547 | }; |
| 548 | |
| 549 | static struct twl4030_codec_data omap3evm_codec_data = { |
Peter Ujfalusi | 6df74ef | 2009-11-04 09:58:18 +0200 | [diff] [blame] | 550 | .audio_mclk = 26000000, |
Peter Ujfalusi | e86fa0b | 2009-10-22 13:26:46 +0300 | [diff] [blame] | 551 | .audio = &omap3evm_audio_data, |
| 552 | }; |
| 553 | |
Vaibhav Hiremath | 703e306 | 2010-01-04 15:34:16 +0100 | [diff] [blame] | 554 | static struct regulator_consumer_supply omap3_evm_vdda_dac_supply = { |
| 555 | .supply = "vdda_dac", |
| 556 | .dev = &omap3_evm_dss_device.dev, |
| 557 | }; |
| 558 | |
| 559 | /* VDAC for DSS driving S-Video */ |
| 560 | static struct regulator_init_data omap3_evm_vdac = { |
| 561 | .constraints = { |
| 562 | .min_uV = 1800000, |
| 563 | .max_uV = 1800000, |
| 564 | .apply_uV = true, |
| 565 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 566 | | REGULATOR_MODE_STANDBY, |
| 567 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 568 | | REGULATOR_CHANGE_STATUS, |
| 569 | }, |
| 570 | .num_consumer_supplies = 1, |
| 571 | .consumer_supplies = &omap3_evm_vdda_dac_supply, |
| 572 | }; |
| 573 | |
| 574 | /* VPLL2 for digital video outputs */ |
Vaibhav Hiremath | f3fe53c | 2010-03-19 11:21:19 +0000 | [diff] [blame] | 575 | static struct regulator_consumer_supply omap3_evm_vpll2_supply = |
| 576 | REGULATOR_SUPPLY("vdds_dsi", "omapdss"); |
Vaibhav Hiremath | 703e306 | 2010-01-04 15:34:16 +0100 | [diff] [blame] | 577 | |
| 578 | static struct regulator_init_data omap3_evm_vpll2 = { |
| 579 | .constraints = { |
Vaibhav Hiremath | 703e306 | 2010-01-04 15:34:16 +0100 | [diff] [blame] | 580 | .min_uV = 1800000, |
| 581 | .max_uV = 1800000, |
| 582 | .apply_uV = true, |
| 583 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 584 | | REGULATOR_MODE_STANDBY, |
| 585 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 586 | | REGULATOR_CHANGE_STATUS, |
| 587 | }, |
| 588 | .num_consumer_supplies = 1, |
| 589 | .consumer_supplies = &omap3_evm_vpll2_supply, |
| 590 | }; |
| 591 | |
Vaibhav Hiremath | 410491d | 2011-01-25 17:37:38 +0000 | [diff] [blame] | 592 | /* ads7846 on SPI */ |
| 593 | static struct regulator_consumer_supply omap3evm_vio_supply = |
| 594 | REGULATOR_SUPPLY("vcc", "spi1.0"); |
| 595 | |
| 596 | /* VIO for ads7846 */ |
| 597 | static struct regulator_init_data omap3evm_vio = { |
| 598 | .constraints = { |
| 599 | .min_uV = 1800000, |
| 600 | .max_uV = 1800000, |
| 601 | .apply_uV = true, |
| 602 | .valid_modes_mask = REGULATOR_MODE_NORMAL |
| 603 | | REGULATOR_MODE_STANDBY, |
| 604 | .valid_ops_mask = REGULATOR_CHANGE_MODE |
| 605 | | REGULATOR_CHANGE_STATUS, |
| 606 | }, |
| 607 | .num_consumer_supplies = 1, |
| 608 | .consumer_supplies = &omap3evm_vio_supply, |
| 609 | }; |
| 610 | |
Eyal Reizer | 741927f | 2011-01-27 09:49:49 +0000 | [diff] [blame] | 611 | #ifdef CONFIG_WL12XX_PLATFORM_DATA |
| 612 | |
| 613 | #define OMAP3EVM_WLAN_PMENA_GPIO (150) |
| 614 | #define OMAP3EVM_WLAN_IRQ_GPIO (149) |
| 615 | |
| 616 | static struct regulator_consumer_supply omap3evm_vmmc2_supply = { |
| 617 | .supply = "vmmc", |
| 618 | .dev_name = "mmci-omap-hs.1", |
| 619 | }; |
| 620 | |
| 621 | /* VMMC2 for driving the WL12xx module */ |
| 622 | static struct regulator_init_data omap3evm_vmmc2 = { |
| 623 | .constraints = { |
| 624 | .valid_ops_mask = REGULATOR_CHANGE_STATUS, |
| 625 | }, |
| 626 | .num_consumer_supplies = 1, |
| 627 | .consumer_supplies = &omap3evm_vmmc2_supply, |
| 628 | }; |
| 629 | |
| 630 | static struct fixed_voltage_config omap3evm_vwlan = { |
| 631 | .supply_name = "vwl1271", |
| 632 | .microvolts = 1800000, /* 1.80V */ |
| 633 | .gpio = OMAP3EVM_WLAN_PMENA_GPIO, |
| 634 | .startup_delay = 70000, /* 70ms */ |
| 635 | .enable_high = 1, |
| 636 | .enabled_at_boot = 0, |
| 637 | .init_data = &omap3evm_vmmc2, |
| 638 | }; |
| 639 | |
| 640 | static struct platform_device omap3evm_vwlan_device = { |
| 641 | .name = "reg-fixed-voltage", |
| 642 | .id = 1, |
| 643 | .dev = { |
| 644 | .platform_data = &omap3evm_vwlan, |
| 645 | }, |
| 646 | }; |
| 647 | |
| 648 | struct wl12xx_platform_data omap3evm_wlan_data __initdata = { |
| 649 | .irq = OMAP_GPIO_IRQ(OMAP3EVM_WLAN_IRQ_GPIO), |
| 650 | /* ref clock is 38.4 MHz */ |
| 651 | .board_ref_clock = 2, |
| 652 | }; |
| 653 | #endif |
| 654 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 655 | static struct twl4030_platform_data omap3evm_twldata = { |
| 656 | .irq_base = TWL4030_IRQ_BASE, |
| 657 | .irq_end = TWL4030_IRQ_END, |
| 658 | |
| 659 | /* platform_data for children goes here */ |
| 660 | .keypad = &omap3evm_kp_data, |
| 661 | .madc = &omap3evm_madc_data, |
| 662 | .usb = &omap3evm_usb_data, |
| 663 | .gpio = &omap3evm_gpio_data, |
Peter Ujfalusi | e86fa0b | 2009-10-22 13:26:46 +0300 | [diff] [blame] | 664 | .codec = &omap3evm_codec_data, |
Vaibhav Hiremath | 703e306 | 2010-01-04 15:34:16 +0100 | [diff] [blame] | 665 | .vdac = &omap3_evm_vdac, |
| 666 | .vpll2 = &omap3_evm_vpll2, |
Vaibhav Hiremath | 410491d | 2011-01-25 17:37:38 +0000 | [diff] [blame] | 667 | .vio = &omap3evm_vio, |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 668 | }; |
| 669 | |
| 670 | static struct i2c_board_info __initdata omap3evm_i2c_boardinfo[] = { |
| 671 | { |
| 672 | I2C_BOARD_INFO("twl4030", 0x48), |
| 673 | .flags = I2C_CLIENT_WAKE, |
| 674 | .irq = INT_34XX_SYS_NIRQ, |
| 675 | .platform_data = &omap3evm_twldata, |
| 676 | }, |
| 677 | }; |
| 678 | |
| 679 | static int __init omap3_evm_i2c_init(void) |
| 680 | { |
Mike Rapoport | 1a7ec13 | 2009-11-22 10:11:29 -0800 | [diff] [blame] | 681 | /* |
| 682 | * REVISIT: These entries can be set in omap3evm_twl_data |
| 683 | * after a merge with MFD tree |
| 684 | */ |
| 685 | omap3evm_twldata.vmmc1 = &omap3evm_vmmc1; |
| 686 | omap3evm_twldata.vsim = &omap3evm_vsim; |
| 687 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 688 | omap_register_i2c_bus(1, 2600, omap3evm_i2c_boardinfo, |
| 689 | ARRAY_SIZE(omap3evm_i2c_boardinfo)); |
| 690 | omap_register_i2c_bus(2, 400, NULL, 0); |
| 691 | omap_register_i2c_bus(3, 400, NULL, 0); |
| 692 | return 0; |
| 693 | } |
| 694 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 695 | static void ads7846_dev_init(void) |
| 696 | { |
| 697 | if (gpio_request(OMAP3_EVM_TS_GPIO, "ADS7846 pendown") < 0) |
| 698 | printk(KERN_ERR "can't get ads7846 pen down GPIO\n"); |
| 699 | |
| 700 | gpio_direction_input(OMAP3_EVM_TS_GPIO); |
Felipe Balbi | 48feb33 | 2010-05-26 14:42:24 -0700 | [diff] [blame] | 701 | gpio_set_debounce(OMAP3_EVM_TS_GPIO, 310); |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 702 | } |
| 703 | |
| 704 | static int ads7846_get_pendown_state(void) |
| 705 | { |
| 706 | return !gpio_get_value(OMAP3_EVM_TS_GPIO); |
| 707 | } |
| 708 | |
Manjunath Kondaiah G | 3881573 | 2010-10-08 09:56:37 -0700 | [diff] [blame] | 709 | static struct ads7846_platform_data ads7846_config = { |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 710 | .x_max = 0x0fff, |
| 711 | .y_max = 0x0fff, |
| 712 | .x_plate_ohms = 180, |
| 713 | .pressure_max = 255, |
| 714 | .debounce_max = 10, |
| 715 | .debounce_tol = 3, |
| 716 | .debounce_rep = 1, |
| 717 | .get_pendown_state = ads7846_get_pendown_state, |
| 718 | .keep_vref_on = 1, |
| 719 | .settle_delay_usecs = 150, |
Ranjith Lohithakshan | 7a44ad2 | 2010-05-08 12:39:21 +0530 | [diff] [blame] | 720 | .wakeup = true, |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 721 | }; |
| 722 | |
| 723 | static struct omap2_mcspi_device_config ads7846_mcspi_config = { |
| 724 | .turbo_mode = 0, |
| 725 | .single_channel = 1, /* 0: slave, 1: master */ |
| 726 | }; |
| 727 | |
Manjunath Kondaiah G | 3881573 | 2010-10-08 09:56:37 -0700 | [diff] [blame] | 728 | static struct spi_board_info omap3evm_spi_board_info[] = { |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 729 | [0] = { |
| 730 | .modalias = "ads7846", |
| 731 | .bus_num = 1, |
| 732 | .chip_select = 0, |
| 733 | .max_speed_hz = 1500000, |
| 734 | .controller_data = &ads7846_mcspi_config, |
| 735 | .irq = OMAP_GPIO_IRQ(OMAP3_EVM_TS_GPIO), |
| 736 | .platform_data = &ads7846_config, |
| 737 | }, |
| 738 | }; |
| 739 | |
Paul Walmsley | b3c6df3 | 2009-09-03 20:14:02 +0300 | [diff] [blame] | 740 | static struct omap_board_config_kernel omap3_evm_config[] __initdata = { |
Paul Walmsley | b3c6df3 | 2009-09-03 20:14:02 +0300 | [diff] [blame] | 741 | }; |
| 742 | |
Russell King - ARM Linux | 3dc3bad | 2011-02-14 15:40:20 -0800 | [diff] [blame] | 743 | static void __init omap3_evm_init_early(void) |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 744 | { |
Paul Walmsley | b3c6df3 | 2009-09-03 20:14:02 +0300 | [diff] [blame] | 745 | omap_board_config = omap3_evm_config; |
| 746 | omap_board_config_size = ARRAY_SIZE(omap3_evm_config); |
Paul Walmsley | 4805734 | 2010-12-21 15:25:10 -0700 | [diff] [blame] | 747 | omap2_init_common_infrastructure(); |
| 748 | omap2_init_common_devices(mt46h32m32lf6_sdrc_params, NULL); |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 749 | } |
| 750 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 751 | static struct platform_device *omap3_evm_devices[] __initdata = { |
Vaibhav Hiremath | 703e306 | 2010-01-04 15:34:16 +0100 | [diff] [blame] | 752 | &omap3_evm_dss_device, |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 753 | }; |
| 754 | |
Felipe Balbi | 6f69a18 | 2010-03-04 09:45:53 +0200 | [diff] [blame] | 755 | static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = { |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 756 | |
| 757 | .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN, |
| 758 | .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY, |
| 759 | .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, |
| 760 | |
| 761 | .phy_reset = true, |
Ajay Kumar Gupta | e8e51d2 | 2009-11-22 10:11:28 -0800 | [diff] [blame] | 762 | /* PHY reset GPIO will be runtime programmed based on EVM version */ |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 763 | .reset_gpio_port[0] = -EINVAL, |
Ajay Kumar Gupta | e8e51d2 | 2009-11-22 10:11:28 -0800 | [diff] [blame] | 764 | .reset_gpio_port[1] = -EINVAL, |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 765 | .reset_gpio_port[2] = -EINVAL |
| 766 | }; |
| 767 | |
Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 768 | #ifdef CONFIG_OMAP_MUX |
Vaibhav Hiremath | 904c545 | 2011-01-25 17:37:39 +0000 | [diff] [blame] | 769 | static struct omap_board_mux omap35x_board_mux[] __initdata = { |
Sanjeev Premi | aa6912d8 | 2010-02-17 14:09:23 -0800 | [diff] [blame] | 770 | OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP | |
Ranjith Lohithakshan | f3a8cde | 2010-05-03 17:07:51 +0530 | [diff] [blame] | 771 | OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW | |
Sanjeev Premi | aa6912d8 | 2010-02-17 14:09:23 -0800 | [diff] [blame] | 772 | OMAP_PIN_OFF_WAKEUPENABLE), |
Sanjeev Premi | 87520aa | 2010-02-17 14:09:24 -0800 | [diff] [blame] | 773 | OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP | |
Vaibhav Hiremath | 854c122 | 2011-01-25 17:37:41 +0000 | [diff] [blame^] | 774 | OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW | |
| 775 | OMAP_PIN_OFF_WAKEUPENABLE), |
Vaibhav Hiremath | 9bc64b8 | 2011-01-24 19:25:55 +0000 | [diff] [blame] | 776 | OMAP3_MUX(SYS_BOOT5, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP | |
| 777 | OMAP_PIN_OFF_NONE), |
| 778 | OMAP3_MUX(GPMC_WAIT2, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP | |
| 779 | OMAP_PIN_OFF_NONE), |
Eyal Reizer | 741927f | 2011-01-27 09:49:49 +0000 | [diff] [blame] | 780 | #ifdef CONFIG_WL12XX_PLATFORM_DATA |
| 781 | /* WLAN IRQ - GPIO 149 */ |
| 782 | OMAP3_MUX(UART1_RTS, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP), |
| 783 | |
| 784 | /* WLAN POWER ENABLE - GPIO 150 */ |
| 785 | OMAP3_MUX(UART1_CTS, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT), |
| 786 | |
| 787 | /* MMC2 SDIO pin muxes for WL12xx */ |
| 788 | OMAP3_MUX(SDMMC2_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP), |
| 789 | OMAP3_MUX(SDMMC2_CMD, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP), |
| 790 | OMAP3_MUX(SDMMC2_DAT0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP), |
| 791 | OMAP3_MUX(SDMMC2_DAT1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP), |
| 792 | OMAP3_MUX(SDMMC2_DAT2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP), |
| 793 | OMAP3_MUX(SDMMC2_DAT3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP), |
| 794 | #endif |
Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 795 | { .reg_offset = OMAP_MUX_TERMINATOR }, |
| 796 | }; |
Vaibhav Hiremath | 904c545 | 2011-01-25 17:37:39 +0000 | [diff] [blame] | 797 | |
| 798 | static struct omap_board_mux omap36x_board_mux[] __initdata = { |
| 799 | OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP | |
| 800 | OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW | |
| 801 | OMAP_PIN_OFF_WAKEUPENABLE), |
| 802 | OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP | |
Vaibhav Hiremath | 854c122 | 2011-01-25 17:37:41 +0000 | [diff] [blame^] | 803 | OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW | |
| 804 | OMAP_PIN_OFF_WAKEUPENABLE), |
Vaibhav Hiremath | 904c545 | 2011-01-25 17:37:39 +0000 | [diff] [blame] | 805 | /* AM/DM37x EVM: DSS data bus muxed with sys_boot */ |
| 806 | OMAP3_MUX(DSS_DATA18, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE), |
| 807 | OMAP3_MUX(DSS_DATA19, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE), |
| 808 | OMAP3_MUX(DSS_DATA22, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE), |
| 809 | OMAP3_MUX(DSS_DATA21, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE), |
| 810 | OMAP3_MUX(DSS_DATA22, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE), |
| 811 | OMAP3_MUX(DSS_DATA23, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE), |
| 812 | OMAP3_MUX(SYS_BOOT0, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE), |
| 813 | OMAP3_MUX(SYS_BOOT1, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE), |
| 814 | OMAP3_MUX(SYS_BOOT3, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE), |
| 815 | OMAP3_MUX(SYS_BOOT4, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE), |
| 816 | OMAP3_MUX(SYS_BOOT5, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE), |
| 817 | OMAP3_MUX(SYS_BOOT6, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE), |
| 818 | |
| 819 | { .reg_offset = OMAP_MUX_TERMINATOR }, |
| 820 | }; |
| 821 | #else |
| 822 | #define omap35x_board_mux NULL |
| 823 | #define omap36x_board_mux NULL |
Tony Lindgren | ca5742b | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 824 | #endif |
| 825 | |
Maulik Mankad | 884b836 | 2010-02-17 14:09:30 -0800 | [diff] [blame] | 826 | static struct omap_musb_board_data musb_board_data = { |
| 827 | .interface_type = MUSB_INTERFACE_ULPI, |
| 828 | .mode = MUSB_OTG, |
| 829 | .power = 100, |
| 830 | }; |
| 831 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 832 | static void __init omap3_evm_init(void) |
| 833 | { |
Ajay Kumar Gupta | db40802 | 2009-11-22 10:11:27 -0800 | [diff] [blame] | 834 | omap3_evm_get_revision(); |
Vaibhav Hiremath | 904c545 | 2011-01-25 17:37:39 +0000 | [diff] [blame] | 835 | |
| 836 | if (cpu_is_omap3630()) |
| 837 | omap3_mux_init(omap36x_board_mux, OMAP_PACKAGE_CBB); |
| 838 | else |
| 839 | omap3_mux_init(omap35x_board_mux, OMAP_PACKAGE_CBB); |
Ajay Kumar Gupta | db40802 | 2009-11-22 10:11:27 -0800 | [diff] [blame] | 840 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 841 | omap3_evm_i2c_init(); |
| 842 | |
| 843 | platform_add_devices(omap3_evm_devices, ARRAY_SIZE(omap3_evm_devices)); |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 844 | |
| 845 | spi_register_board_info(omap3evm_spi_board_info, |
| 846 | ARRAY_SIZE(omap3evm_spi_board_info)); |
| 847 | |
| 848 | omap_serial_init(); |
Maulik Mankad | 1a4f463 | 2010-02-17 14:09:29 -0800 | [diff] [blame] | 849 | |
Gupta, Ajay Kumar | e8e2ff4 | 2009-07-29 11:58:57 +0530 | [diff] [blame] | 850 | /* OMAP3EVM uses ISP1504 phy and so register nop transceiver */ |
| 851 | usb_nop_xceiv_register(); |
Maulik Mankad | 1a4f463 | 2010-02-17 14:09:29 -0800 | [diff] [blame] | 852 | |
Ajay Kumar Gupta | e8e51d2 | 2009-11-22 10:11:28 -0800 | [diff] [blame] | 853 | if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) { |
| 854 | /* enable EHCI VBUS using GPIO22 */ |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 855 | omap_mux_init_gpio(22, OMAP_PIN_INPUT_PULLUP); |
Ajay Kumar Gupta | e8e51d2 | 2009-11-22 10:11:28 -0800 | [diff] [blame] | 856 | gpio_request(OMAP3_EVM_EHCI_VBUS, "enable EHCI VBUS"); |
| 857 | gpio_direction_output(OMAP3_EVM_EHCI_VBUS, 0); |
| 858 | gpio_set_value(OMAP3_EVM_EHCI_VBUS, 1); |
| 859 | |
| 860 | /* Select EHCI port on main board */ |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 861 | omap_mux_init_gpio(61, OMAP_PIN_INPUT_PULLUP); |
Ajay Kumar Gupta | e8e51d2 | 2009-11-22 10:11:28 -0800 | [diff] [blame] | 862 | gpio_request(OMAP3_EVM_EHCI_SELECT, "select EHCI port"); |
| 863 | gpio_direction_output(OMAP3_EVM_EHCI_SELECT, 0); |
| 864 | gpio_set_value(OMAP3_EVM_EHCI_SELECT, 0); |
| 865 | |
| 866 | /* setup EHCI phy reset config */ |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 867 | omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP); |
Ajay Kumar Gupta | e8e51d2 | 2009-11-22 10:11:28 -0800 | [diff] [blame] | 868 | ehci_pdata.reset_gpio_port[1] = 21; |
| 869 | |
Ajay Kumar Gupta | 58815fa | 2010-03-25 13:25:27 +0200 | [diff] [blame] | 870 | /* EVM REV >= E can supply 500mA with EXTVBUS programming */ |
| 871 | musb_board_data.power = 500; |
| 872 | musb_board_data.extvbus = 1; |
Ajay Kumar Gupta | e8e51d2 | 2009-11-22 10:11:28 -0800 | [diff] [blame] | 873 | } else { |
| 874 | /* setup EHCI phy reset on MDC */ |
Tony Lindgren | 4896e39 | 2009-12-11 16:16:32 -0800 | [diff] [blame] | 875 | omap_mux_init_gpio(135, OMAP_PIN_OUTPUT); |
Ajay Kumar Gupta | e8e51d2 | 2009-11-22 10:11:28 -0800 | [diff] [blame] | 876 | ehci_pdata.reset_gpio_port[1] = 135; |
| 877 | } |
Maulik Mankad | 884b836 | 2010-02-17 14:09:30 -0800 | [diff] [blame] | 878 | usb_musb_init(&musb_board_data); |
Felipe Balbi | 58a5491 | 2009-11-22 10:11:01 -0800 | [diff] [blame] | 879 | usb_ehci_init(&ehci_pdata); |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 880 | ads7846_dev_init(); |
Sriram | 562138a | 2009-11-22 10:11:30 -0800 | [diff] [blame] | 881 | omap3evm_init_smsc911x(); |
Vaibhav Hiremath | 703e306 | 2010-01-04 15:34:16 +0100 | [diff] [blame] | 882 | omap3_evm_display_init(); |
Eyal Reizer | 741927f | 2011-01-27 09:49:49 +0000 | [diff] [blame] | 883 | |
| 884 | #ifdef CONFIG_WL12XX_PLATFORM_DATA |
| 885 | /* WL12xx WLAN Init */ |
| 886 | if (wl12xx_set_platform_data(&omap3evm_wlan_data)) |
| 887 | pr_err("error setting wl12xx data\n"); |
| 888 | platform_device_register(&omap3evm_vwlan_device); |
| 889 | #endif |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 890 | } |
| 891 | |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 892 | MACHINE_START(OMAP3EVM, "OMAP3 EVM") |
| 893 | /* Maintainer: Syed Mohammed Khasim - Texas Instruments */ |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 894 | .boot_params = 0x80000100, |
Russell King | 71ee7da | 2010-05-23 10:18:16 +0100 | [diff] [blame] | 895 | .reserve = omap_reserve, |
Russell King - ARM Linux | 3dc3bad | 2011-02-14 15:40:20 -0800 | [diff] [blame] | 896 | .map_io = omap3_map_io, |
| 897 | .init_early = omap3_evm_init_early, |
| 898 | .init_irq = omap_init_irq, |
Syed Mohammed Khasim | 53c5ec3 | 2009-05-28 14:13:28 -0700 | [diff] [blame] | 899 | .init_machine = omap3_evm_init, |
| 900 | .timer = &omap_timer, |
| 901 | MACHINE_END |