aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-omap2/board-omap3evm.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-omap2/board-omap3evm.c')
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c475
1 files changed, 248 insertions, 227 deletions
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index f76d9c0a47a1..b4d43464a303 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -30,7 +30,10 @@
30#include <linux/usb/otg.h> 30#include <linux/usb/otg.h>
31#include <linux/smsc911x.h> 31#include <linux/smsc911x.h>
32 32
33#include <linux/wl12xx.h>
34#include <linux/regulator/fixed.h>
33#include <linux/regulator/machine.h> 35#include <linux/regulator/machine.h>
36#include <linux/mmc/host.h>
34 37
35#include <mach/hardware.h> 38#include <mach/hardware.h>
36#include <asm/mach-types.h> 39#include <asm/mach-types.h>
@@ -41,11 +44,13 @@
41#include <plat/usb.h> 44#include <plat/usb.h>
42#include <plat/common.h> 45#include <plat/common.h>
43#include <plat/mcspi.h> 46#include <plat/mcspi.h>
44#include <plat/display.h> 47#include <video/omapdss.h>
48#include <video/omap-panel-generic-dpi.h>
45 49
46#include "mux.h" 50#include "mux.h"
47#include "sdram-micron-mt46h32m32lf-6.h" 51#include "sdram-micron-mt46h32m32lf-6.h"
48#include "hsmmc.h" 52#include "hsmmc.h"
53#include "common-board-devices.h"
49 54
50#define OMAP3_EVM_TS_GPIO 175 55#define OMAP3_EVM_TS_GPIO 175
51#define OMAP3_EVM_EHCI_VBUS 22 56#define OMAP3_EVM_EHCI_VBUS 22
@@ -56,6 +61,13 @@
56#define OMAP3EVM_ETHR_ID_REV 0x50 61#define OMAP3EVM_ETHR_ID_REV 0x50
57#define OMAP3EVM_ETHR_GPIO_IRQ 176 62#define OMAP3EVM_ETHR_GPIO_IRQ 176
58#define OMAP3EVM_SMSC911X_CS 5 63#define OMAP3EVM_SMSC911X_CS 5
64/*
65 * Eth Reset signal
66 * 64 = Generation 1 (<=RevD)
67 * 7 = Generation 2 (>=RevE)
68 */
69#define OMAP3EVM_GEN1_ETHR_GPIO_RST 64
70#define OMAP3EVM_GEN2_ETHR_GPIO_RST 7
59 71
60static u8 omap3_evm_version; 72static u8 omap3_evm_version;
61 73
@@ -90,58 +102,35 @@ static void __init omap3_evm_get_revision(void)
90} 102}
91 103
92#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE) 104#if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
93static struct resource omap3evm_smsc911x_resources[] = { 105#include <plat/gpmc-smsc911x.h>
94 [0] = {
95 .start = OMAP3EVM_ETHR_START,
96 .end = (OMAP3EVM_ETHR_START + OMAP3EVM_ETHR_SIZE - 1),
97 .flags = IORESOURCE_MEM,
98 },
99 [1] = {
100 .start = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ),
101 .end = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ),
102 .flags = (IORESOURCE_IRQ | IRQF_TRIGGER_LOW),
103 },
104};
105
106static struct smsc911x_platform_config smsc911x_config = {
107 .phy_interface = PHY_INTERFACE_MODE_MII,
108 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
109 .irq_type = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
110 .flags = (SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS),
111};
112 106
113static struct platform_device omap3evm_smsc911x_device = { 107static struct omap_smsc911x_platform_data smsc911x_cfg = {
114 .name = "smsc911x", 108 .cs = OMAP3EVM_SMSC911X_CS,
115 .id = -1, 109 .gpio_irq = OMAP3EVM_ETHR_GPIO_IRQ,
116 .num_resources = ARRAY_SIZE(omap3evm_smsc911x_resources), 110 .gpio_reset = -EINVAL,
117 .resource = &omap3evm_smsc911x_resources[0], 111 .flags = SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS,
118 .dev = {
119 .platform_data = &smsc911x_config,
120 },
121}; 112};
122 113
123static inline void __init omap3evm_init_smsc911x(void) 114static inline void __init omap3evm_init_smsc911x(void)
124{ 115{
125 int eth_cs;
126 struct clk *l3ck; 116 struct clk *l3ck;
127 unsigned int rate; 117 unsigned int rate;
128 118
129 eth_cs = OMAP3EVM_SMSC911X_CS;
130
131 l3ck = clk_get(NULL, "l3_ck"); 119 l3ck = clk_get(NULL, "l3_ck");
132 if (IS_ERR(l3ck)) 120 if (IS_ERR(l3ck))
133 rate = 100000000; 121 rate = 100000000;
134 else 122 else
135 rate = clk_get_rate(l3ck); 123 rate = clk_get_rate(l3ck);
136 124
137 if (gpio_request(OMAP3EVM_ETHR_GPIO_IRQ, "SMSC911x irq") < 0) { 125 /* Configure ethernet controller reset gpio */
138 printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n", 126 if (cpu_is_omap3430()) {
139 OMAP3EVM_ETHR_GPIO_IRQ); 127 if (get_omap3_evm_rev() == OMAP3EVM_BOARD_GEN_1)
140 return; 128 smsc911x_cfg.gpio_reset = OMAP3EVM_GEN1_ETHR_GPIO_RST;
129 else
130 smsc911x_cfg.gpio_reset = OMAP3EVM_GEN2_ETHR_GPIO_RST;
141 } 131 }
142 132
143 gpio_direction_input(OMAP3EVM_ETHR_GPIO_IRQ); 133 gpmc_smsc911x_init(&smsc911x_cfg);
144 platform_device_register(&omap3evm_smsc911x_device);
145} 134}
146 135
147#else 136#else
@@ -160,6 +149,15 @@ static inline void __init omap3evm_init_smsc911x(void) { return; }
160#define OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO 210 149#define OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO 210
161#define OMAP3EVM_DVI_PANEL_EN_GPIO 199 150#define OMAP3EVM_DVI_PANEL_EN_GPIO 199
162 151
152static struct gpio omap3_evm_dss_gpios[] __initdata = {
153 { OMAP3EVM_LCD_PANEL_RESB, GPIOF_OUT_INIT_HIGH, "lcd_panel_resb" },
154 { OMAP3EVM_LCD_PANEL_INI, GPIOF_OUT_INIT_HIGH, "lcd_panel_ini" },
155 { OMAP3EVM_LCD_PANEL_QVGA, GPIOF_OUT_INIT_LOW, "lcd_panel_qvga" },
156 { OMAP3EVM_LCD_PANEL_LR, GPIOF_OUT_INIT_HIGH, "lcd_panel_lr" },
157 { OMAP3EVM_LCD_PANEL_UD, GPIOF_OUT_INIT_HIGH, "lcd_panel_ud" },
158 { OMAP3EVM_LCD_PANEL_ENVDD, GPIOF_OUT_INIT_LOW, "lcd_panel_envdd" },
159};
160
163static int lcd_enabled; 161static int lcd_enabled;
164static int dvi_enabled; 162static int dvi_enabled;
165 163
@@ -167,61 +165,10 @@ static void __init omap3_evm_display_init(void)
167{ 165{
168 int r; 166 int r;
169 167
170 r = gpio_request(OMAP3EVM_LCD_PANEL_RESB, "lcd_panel_resb"); 168 r = gpio_request_array(omap3_evm_dss_gpios,
171 if (r) { 169 ARRAY_SIZE(omap3_evm_dss_gpios));
172 printk(KERN_ERR "failed to get lcd_panel_resb\n"); 170 if (r)
173 return; 171 printk(KERN_ERR "failed to get lcd_panel_* gpios\n");
174 }
175 gpio_direction_output(OMAP3EVM_LCD_PANEL_RESB, 1);
176
177 r = gpio_request(OMAP3EVM_LCD_PANEL_INI, "lcd_panel_ini");
178 if (r) {
179 printk(KERN_ERR "failed to get lcd_panel_ini\n");
180 goto err_1;
181 }
182 gpio_direction_output(OMAP3EVM_LCD_PANEL_INI, 1);
183
184 r = gpio_request(OMAP3EVM_LCD_PANEL_QVGA, "lcd_panel_qvga");
185 if (r) {
186 printk(KERN_ERR "failed to get lcd_panel_qvga\n");
187 goto err_2;
188 }
189 gpio_direction_output(OMAP3EVM_LCD_PANEL_QVGA, 0);
190
191 r = gpio_request(OMAP3EVM_LCD_PANEL_LR, "lcd_panel_lr");
192 if (r) {
193 printk(KERN_ERR "failed to get lcd_panel_lr\n");
194 goto err_3;
195 }
196 gpio_direction_output(OMAP3EVM_LCD_PANEL_LR, 1);
197
198 r = gpio_request(OMAP3EVM_LCD_PANEL_UD, "lcd_panel_ud");
199 if (r) {
200 printk(KERN_ERR "failed to get lcd_panel_ud\n");
201 goto err_4;
202 }
203 gpio_direction_output(OMAP3EVM_LCD_PANEL_UD, 1);
204
205 r = gpio_request(OMAP3EVM_LCD_PANEL_ENVDD, "lcd_panel_envdd");
206 if (r) {
207 printk(KERN_ERR "failed to get lcd_panel_envdd\n");
208 goto err_5;
209 }
210 gpio_direction_output(OMAP3EVM_LCD_PANEL_ENVDD, 0);
211
212 return;
213
214err_5:
215 gpio_free(OMAP3EVM_LCD_PANEL_UD);
216err_4:
217 gpio_free(OMAP3EVM_LCD_PANEL_LR);
218err_3:
219 gpio_free(OMAP3EVM_LCD_PANEL_QVGA);
220err_2:
221 gpio_free(OMAP3EVM_LCD_PANEL_INI);
222err_1:
223 gpio_free(OMAP3EVM_LCD_PANEL_RESB);
224
225} 172}
226 173
227static int omap3_evm_enable_lcd(struct omap_dss_device *dssdev) 174static int omap3_evm_enable_lcd(struct omap_dss_device *dssdev)
@@ -233,9 +180,9 @@ static int omap3_evm_enable_lcd(struct omap_dss_device *dssdev)
233 gpio_set_value(OMAP3EVM_LCD_PANEL_ENVDD, 0); 180 gpio_set_value(OMAP3EVM_LCD_PANEL_ENVDD, 0);
234 181
235 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) 182 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2)
236 gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 0); 183 gpio_set_value_cansleep(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 0);
237 else 184 else
238 gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 1); 185 gpio_set_value_cansleep(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 1);
239 186
240 lcd_enabled = 1; 187 lcd_enabled = 1;
241 return 0; 188 return 0;
@@ -246,9 +193,9 @@ static void omap3_evm_disable_lcd(struct omap_dss_device *dssdev)
246 gpio_set_value(OMAP3EVM_LCD_PANEL_ENVDD, 1); 193 gpio_set_value(OMAP3EVM_LCD_PANEL_ENVDD, 1);
247 194
248 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) 195 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2)
249 gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 1); 196 gpio_set_value_cansleep(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 1);
250 else 197 else
251 gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 0); 198 gpio_set_value_cansleep(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 0);
252 199
253 lcd_enabled = 0; 200 lcd_enabled = 0;
254} 201}
@@ -287,7 +234,7 @@ static int omap3_evm_enable_dvi(struct omap_dss_device *dssdev)
287 return -EINVAL; 234 return -EINVAL;
288 } 235 }
289 236
290 gpio_set_value(OMAP3EVM_DVI_PANEL_EN_GPIO, 1); 237 gpio_set_value_cansleep(OMAP3EVM_DVI_PANEL_EN_GPIO, 1);
291 238
292 dvi_enabled = 1; 239 dvi_enabled = 1;
293 return 0; 240 return 0;
@@ -295,18 +242,23 @@ static int omap3_evm_enable_dvi(struct omap_dss_device *dssdev)
295 242
296static void omap3_evm_disable_dvi(struct omap_dss_device *dssdev) 243static void omap3_evm_disable_dvi(struct omap_dss_device *dssdev)
297{ 244{
298 gpio_set_value(OMAP3EVM_DVI_PANEL_EN_GPIO, 0); 245 gpio_set_value_cansleep(OMAP3EVM_DVI_PANEL_EN_GPIO, 0);
299 246
300 dvi_enabled = 0; 247 dvi_enabled = 0;
301} 248}
302 249
250static struct panel_generic_dpi_data dvi_panel = {
251 .name = "generic",
252 .platform_enable = omap3_evm_enable_dvi,
253 .platform_disable = omap3_evm_disable_dvi,
254};
255
303static struct omap_dss_device omap3_evm_dvi_device = { 256static struct omap_dss_device omap3_evm_dvi_device = {
304 .name = "dvi", 257 .name = "dvi",
305 .driver_name = "generic_panel",
306 .type = OMAP_DISPLAY_TYPE_DPI, 258 .type = OMAP_DISPLAY_TYPE_DPI,
259 .driver_name = "generic_dpi_panel",
260 .data = &dvi_panel,
307 .phy.dpi.data_lines = 24, 261 .phy.dpi.data_lines = 24,
308 .platform_enable = omap3_evm_enable_dvi,
309 .platform_disable = omap3_evm_disable_dvi,
310}; 262};
311 263
312static struct omap_dss_device *omap3_evm_dss_devices[] = { 264static struct omap_dss_device *omap3_evm_dss_devices[] = {
@@ -321,14 +273,6 @@ static struct omap_dss_board_info omap3_evm_dss_data = {
321 .default_device = &omap3_evm_lcd_device, 273 .default_device = &omap3_evm_lcd_device,
322}; 274};
323 275
324static struct platform_device omap3_evm_dss_device = {
325 .name = "omapdss",
326 .id = -1,
327 .dev = {
328 .platform_data = &omap3_evm_dss_data,
329 },
330};
331
332static struct regulator_consumer_supply omap3evm_vmmc1_supply = { 276static struct regulator_consumer_supply omap3evm_vmmc1_supply = {
333 .supply = "vmmc", 277 .supply = "vmmc",
334}; 278};
@@ -370,10 +314,20 @@ static struct regulator_init_data omap3evm_vsim = {
370static struct omap2_hsmmc_info mmc[] = { 314static struct omap2_hsmmc_info mmc[] = {
371 { 315 {
372 .mmc = 1, 316 .mmc = 1,
373 .wires = 4, 317 .caps = MMC_CAP_4_BIT_DATA,
374 .gpio_cd = -EINVAL, 318 .gpio_cd = -EINVAL,
375 .gpio_wp = 63, 319 .gpio_wp = 63,
376 }, 320 },
321#ifdef CONFIG_WL12XX_PLATFORM_DATA
322 {
323 .name = "wl1271",
324 .mmc = 2,
325 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
326 .gpio_wp = -EINVAL,
327 .gpio_cd = -EINVAL,
328 .nonremovable = true,
329 },
330#endif
377 {} /* Terminator */ 331 {} /* Terminator */
378}; 332};
379 333
@@ -404,6 +358,8 @@ static struct platform_device leds_gpio = {
404static int omap3evm_twl_gpio_setup(struct device *dev, 358static int omap3evm_twl_gpio_setup(struct device *dev,
405 unsigned gpio, unsigned ngpio) 359 unsigned gpio, unsigned ngpio)
406{ 360{
361 int r, lcd_bl_en;
362
407 /* gpio + 0 is "mmc0_cd" (input/IRQ) */ 363 /* gpio + 0 is "mmc0_cd" (input/IRQ) */
408 omap_mux_init_gpio(63, OMAP_PIN_INPUT); 364 omap_mux_init_gpio(63, OMAP_PIN_INPUT);
409 mmc[0].gpio_cd = gpio + 0; 365 mmc[0].gpio_cd = gpio + 0;
@@ -419,12 +375,14 @@ static int omap3evm_twl_gpio_setup(struct device *dev,
419 */ 375 */
420 376
421 /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */ 377 /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */
422 gpio_request(gpio + TWL4030_GPIO_MAX, "EN_LCD_BKL"); 378 lcd_bl_en = get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2 ?
423 gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0); 379 GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
380 r = gpio_request_one(gpio + TWL4030_GPIO_MAX, lcd_bl_en, "EN_LCD_BKL");
381 if (r)
382 printk(KERN_ERR "failed to get/set lcd_bkl gpio\n");
424 383
425 /* gpio + 7 == DVI Enable */ 384 /* gpio + 7 == DVI Enable */
426 gpio_request(gpio + 7, "EN_DVI"); 385 gpio_request_one(gpio + 7, GPIOF_OUT_INIT_LOW, "EN_DVI");
427 gpio_direction_output(gpio + 7, 0);
428 386
429 /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */ 387 /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
430 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1; 388 gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
@@ -446,7 +404,7 @@ static struct twl4030_usb_data omap3evm_usb_data = {
446 .usb_mode = T2_USB_MODE_ULPI, 404 .usb_mode = T2_USB_MODE_ULPI,
447}; 405};
448 406
449static int board_keymap[] = { 407static uint32_t board_keymap[] = {
450 KEY(0, 0, KEY_LEFT), 408 KEY(0, 0, KEY_LEFT),
451 KEY(0, 1, KEY_DOWN), 409 KEY(0, 1, KEY_DOWN),
452 KEY(0, 2, KEY_ENTER), 410 KEY(0, 2, KEY_ENTER),
@@ -484,19 +442,15 @@ static struct twl4030_madc_platform_data omap3evm_madc_data = {
484 .irq_line = 1, 442 .irq_line = 1,
485}; 443};
486 444
487static struct twl4030_codec_audio_data omap3evm_audio_data = { 445static struct twl4030_codec_audio_data omap3evm_audio_data;
488 .audio_mclk = 26000000,
489};
490 446
491static struct twl4030_codec_data omap3evm_codec_data = { 447static struct twl4030_codec_data omap3evm_codec_data = {
492 .audio_mclk = 26000000, 448 .audio_mclk = 26000000,
493 .audio = &omap3evm_audio_data, 449 .audio = &omap3evm_audio_data,
494}; 450};
495 451
496static struct regulator_consumer_supply omap3_evm_vdda_dac_supply = { 452static struct regulator_consumer_supply omap3_evm_vdda_dac_supply =
497 .supply = "vdda_dac", 453 REGULATOR_SUPPLY("vdda_dac", "omapdss_venc");
498 .dev = &omap3_evm_dss_device.dev,
499};
500 454
501/* VDAC for DSS driving S-Video */ 455/* VDAC for DSS driving S-Video */
502static struct regulator_init_data omap3_evm_vdac = { 456static struct regulator_init_data omap3_evm_vdac = {
@@ -514,8 +468,10 @@ static struct regulator_init_data omap3_evm_vdac = {
514}; 468};
515 469
516/* VPLL2 for digital video outputs */ 470/* VPLL2 for digital video outputs */
517static struct regulator_consumer_supply omap3_evm_vpll2_supply = 471static struct regulator_consumer_supply omap3_evm_vpll2_supplies[] = {
518 REGULATOR_SUPPLY("vdds_dsi", "omapdss"); 472 REGULATOR_SUPPLY("vdds_dsi", "omapdss"),
473 REGULATOR_SUPPLY("vdds_dsi", "omapdss_dsi1"),
474};
519 475
520static struct regulator_init_data omap3_evm_vpll2 = { 476static struct regulator_init_data omap3_evm_vpll2 = {
521 .constraints = { 477 .constraints = {
@@ -527,10 +483,70 @@ static struct regulator_init_data omap3_evm_vpll2 = {
527 .valid_ops_mask = REGULATOR_CHANGE_MODE 483 .valid_ops_mask = REGULATOR_CHANGE_MODE
528 | REGULATOR_CHANGE_STATUS, 484 | REGULATOR_CHANGE_STATUS,
529 }, 485 },
486 .num_consumer_supplies = ARRAY_SIZE(omap3_evm_vpll2_supplies),
487 .consumer_supplies = omap3_evm_vpll2_supplies,
488};
489
490/* ads7846 on SPI */
491static struct regulator_consumer_supply omap3evm_vio_supply =
492 REGULATOR_SUPPLY("vcc", "spi1.0");
493
494/* VIO for ads7846 */
495static struct regulator_init_data omap3evm_vio = {
496 .constraints = {
497 .min_uV = 1800000,
498 .max_uV = 1800000,
499 .apply_uV = true,
500 .valid_modes_mask = REGULATOR_MODE_NORMAL
501 | REGULATOR_MODE_STANDBY,
502 .valid_ops_mask = REGULATOR_CHANGE_MODE
503 | REGULATOR_CHANGE_STATUS,
504 },
530 .num_consumer_supplies = 1, 505 .num_consumer_supplies = 1,
531 .consumer_supplies = &omap3_evm_vpll2_supply, 506 .consumer_supplies = &omap3evm_vio_supply,
532}; 507};
533 508
509#ifdef CONFIG_WL12XX_PLATFORM_DATA
510
511#define OMAP3EVM_WLAN_PMENA_GPIO (150)
512#define OMAP3EVM_WLAN_IRQ_GPIO (149)
513
514static struct regulator_consumer_supply omap3evm_vmmc2_supply =
515 REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1");
516
517/* VMMC2 for driving the WL12xx module */
518static struct regulator_init_data omap3evm_vmmc2 = {
519 .constraints = {
520 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
521 },
522 .num_consumer_supplies = 1,
523 .consumer_supplies = &omap3evm_vmmc2_supply,
524};
525
526static struct fixed_voltage_config omap3evm_vwlan = {
527 .supply_name = "vwl1271",
528 .microvolts = 1800000, /* 1.80V */
529 .gpio = OMAP3EVM_WLAN_PMENA_GPIO,
530 .startup_delay = 70000, /* 70ms */
531 .enable_high = 1,
532 .enabled_at_boot = 0,
533 .init_data = &omap3evm_vmmc2,
534};
535
536static struct platform_device omap3evm_wlan_regulator = {
537 .name = "reg-fixed-voltage",
538 .id = 1,
539 .dev = {
540 .platform_data = &omap3evm_vwlan,
541 },
542};
543
544struct wl12xx_platform_data omap3evm_wlan_data __initdata = {
545 .irq = OMAP_GPIO_IRQ(OMAP3EVM_WLAN_IRQ_GPIO),
546 .board_ref_clock = WL12XX_REFCLOCK_38, /* 38.4 MHz */
547};
548#endif
549
534static struct twl4030_platform_data omap3evm_twldata = { 550static struct twl4030_platform_data omap3evm_twldata = {
535 .irq_base = TWL4030_IRQ_BASE, 551 .irq_base = TWL4030_IRQ_BASE,
536 .irq_end = TWL4030_IRQ_END, 552 .irq_end = TWL4030_IRQ_END,
@@ -543,99 +559,33 @@ static struct twl4030_platform_data omap3evm_twldata = {
543 .codec = &omap3evm_codec_data, 559 .codec = &omap3evm_codec_data,
544 .vdac = &omap3_evm_vdac, 560 .vdac = &omap3_evm_vdac,
545 .vpll2 = &omap3_evm_vpll2, 561 .vpll2 = &omap3_evm_vpll2,
546}; 562 .vio = &omap3evm_vio,
547 563 .vmmc1 = &omap3evm_vmmc1,
548static struct i2c_board_info __initdata omap3evm_i2c_boardinfo[] = { 564 .vsim = &omap3evm_vsim,
549 {
550 I2C_BOARD_INFO("twl4030", 0x48),
551 .flags = I2C_CLIENT_WAKE,
552 .irq = INT_34XX_SYS_NIRQ,
553 .platform_data = &omap3evm_twldata,
554 },
555}; 565};
556 566
557static int __init omap3_evm_i2c_init(void) 567static int __init omap3_evm_i2c_init(void)
558{ 568{
559 /* 569 omap3_pmic_init("twl4030", &omap3evm_twldata);
560 * REVISIT: These entries can be set in omap3evm_twl_data
561 * after a merge with MFD tree
562 */
563 omap3evm_twldata.vmmc1 = &omap3evm_vmmc1;
564 omap3evm_twldata.vsim = &omap3evm_vsim;
565
566 omap_register_i2c_bus(1, 2600, omap3evm_i2c_boardinfo,
567 ARRAY_SIZE(omap3evm_i2c_boardinfo));
568 omap_register_i2c_bus(2, 400, NULL, 0); 570 omap_register_i2c_bus(2, 400, NULL, 0);
569 omap_register_i2c_bus(3, 400, NULL, 0); 571 omap_register_i2c_bus(3, 400, NULL, 0);
570 return 0; 572 return 0;
571} 573}
572 574
573static void ads7846_dev_init(void)
574{
575 if (gpio_request(OMAP3_EVM_TS_GPIO, "ADS7846 pendown") < 0)
576 printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
577
578 gpio_direction_input(OMAP3_EVM_TS_GPIO);
579 gpio_set_debounce(OMAP3_EVM_TS_GPIO, 310);
580}
581
582static int ads7846_get_pendown_state(void)
583{
584 return !gpio_get_value(OMAP3_EVM_TS_GPIO);
585}
586
587struct ads7846_platform_data ads7846_config = {
588 .x_max = 0x0fff,
589 .y_max = 0x0fff,
590 .x_plate_ohms = 180,
591 .pressure_max = 255,
592 .debounce_max = 10,
593 .debounce_tol = 3,
594 .debounce_rep = 1,
595 .get_pendown_state = ads7846_get_pendown_state,
596 .keep_vref_on = 1,
597 .settle_delay_usecs = 150,
598 .wakeup = true,
599};
600
601static struct omap2_mcspi_device_config ads7846_mcspi_config = {
602 .turbo_mode = 0,
603 .single_channel = 1, /* 0: slave, 1: master */
604};
605
606struct spi_board_info omap3evm_spi_board_info[] = {
607 [0] = {
608 .modalias = "ads7846",
609 .bus_num = 1,
610 .chip_select = 0,
611 .max_speed_hz = 1500000,
612 .controller_data = &ads7846_mcspi_config,
613 .irq = OMAP_GPIO_IRQ(OMAP3_EVM_TS_GPIO),
614 .platform_data = &ads7846_config,
615 },
616};
617
618static struct omap_board_config_kernel omap3_evm_config[] __initdata = { 575static struct omap_board_config_kernel omap3_evm_config[] __initdata = {
619}; 576};
620 577
621static void __init omap3_evm_init_irq(void) 578static void __init omap3_evm_init_early(void)
622{ 579{
623 omap_board_config = omap3_evm_config; 580 omap2_init_common_infrastructure();
624 omap_board_config_size = ARRAY_SIZE(omap3_evm_config); 581 omap2_init_common_devices(mt46h32m32lf6_sdrc_params, NULL);
625 omap2_init_common_hw(mt46h32m32lf6_sdrc_params, NULL);
626 omap_init_irq();
627 omap_gpio_init();
628} 582}
629 583
630static struct platform_device *omap3_evm_devices[] __initdata = { 584static struct usbhs_omap_board_data usbhs_bdata __initdata = {
631 &omap3_evm_dss_device,
632};
633
634static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = {
635 585
636 .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN, 586 .port_mode[0] = OMAP_USBHS_PORT_MODE_UNUSED,
637 .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY, 587 .port_mode[1] = OMAP_EHCI_PORT_MODE_PHY,
638 .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN, 588 .port_mode[2] = OMAP_USBHS_PORT_MODE_UNUSED,
639 589
640 .phy_reset = true, 590 .phy_reset = true,
641 /* PHY reset GPIO will be runtime programmed based on EVM version */ 591 /* PHY reset GPIO will be runtime programmed based on EVM version */
@@ -645,16 +595,76 @@ static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = {
645}; 595};
646 596
647#ifdef CONFIG_OMAP_MUX 597#ifdef CONFIG_OMAP_MUX
648static struct omap_board_mux board_mux[] __initdata = { 598static struct omap_board_mux omap35x_board_mux[] __initdata = {
649 OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP | 599 OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP |
650 OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW | 600 OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW |
651 OMAP_PIN_OFF_WAKEUPENABLE), 601 OMAP_PIN_OFF_WAKEUPENABLE),
652 OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP | 602 OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP |
653 OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW), 603 OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW |
604 OMAP_PIN_OFF_WAKEUPENABLE),
605 OMAP3_MUX(SYS_BOOT5, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP |
606 OMAP_PIN_OFF_NONE),
607 OMAP3_MUX(GPMC_WAIT2, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP |
608 OMAP_PIN_OFF_NONE),
609#ifdef CONFIG_WL12XX_PLATFORM_DATA
610 /* WLAN IRQ - GPIO 149 */
611 OMAP3_MUX(UART1_RTS, OMAP_MUX_MODE4 | OMAP_PIN_INPUT),
612
613 /* WLAN POWER ENABLE - GPIO 150 */
614 OMAP3_MUX(UART1_CTS, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
615
616 /* MMC2 SDIO pin muxes for WL12xx */
617 OMAP3_MUX(SDMMC2_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
618 OMAP3_MUX(SDMMC2_CMD, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
619 OMAP3_MUX(SDMMC2_DAT0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
620 OMAP3_MUX(SDMMC2_DAT1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
621 OMAP3_MUX(SDMMC2_DAT2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
622 OMAP3_MUX(SDMMC2_DAT3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
623#endif
624 { .reg_offset = OMAP_MUX_TERMINATOR },
625};
626
627static struct omap_board_mux omap36x_board_mux[] __initdata = {
628 OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP |
629 OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW |
630 OMAP_PIN_OFF_WAKEUPENABLE),
631 OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP |
632 OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW |
633 OMAP_PIN_OFF_WAKEUPENABLE),
634 /* AM/DM37x EVM: DSS data bus muxed with sys_boot */
635 OMAP3_MUX(DSS_DATA18, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
636 OMAP3_MUX(DSS_DATA19, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
637 OMAP3_MUX(DSS_DATA22, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
638 OMAP3_MUX(DSS_DATA21, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
639 OMAP3_MUX(DSS_DATA22, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
640 OMAP3_MUX(DSS_DATA23, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
641 OMAP3_MUX(SYS_BOOT0, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
642 OMAP3_MUX(SYS_BOOT1, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
643 OMAP3_MUX(SYS_BOOT3, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
644 OMAP3_MUX(SYS_BOOT4, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
645 OMAP3_MUX(SYS_BOOT5, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
646 OMAP3_MUX(SYS_BOOT6, OMAP_MUX_MODE3 | OMAP_PIN_OFF_NONE),
647#ifdef CONFIG_WL12XX_PLATFORM_DATA
648 /* WLAN IRQ - GPIO 149 */
649 OMAP3_MUX(UART1_RTS, OMAP_MUX_MODE4 | OMAP_PIN_INPUT),
650
651 /* WLAN POWER ENABLE - GPIO 150 */
652 OMAP3_MUX(UART1_CTS, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
653
654 /* MMC2 SDIO pin muxes for WL12xx */
655 OMAP3_MUX(SDMMC2_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
656 OMAP3_MUX(SDMMC2_CMD, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
657 OMAP3_MUX(SDMMC2_DAT0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
658 OMAP3_MUX(SDMMC2_DAT1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
659 OMAP3_MUX(SDMMC2_DAT2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
660 OMAP3_MUX(SDMMC2_DAT3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
661#endif
662
654 { .reg_offset = OMAP_MUX_TERMINATOR }, 663 { .reg_offset = OMAP_MUX_TERMINATOR },
655}; 664};
656#else 665#else
657#define board_mux NULL 666#define omap35x_board_mux NULL
667#define omap36x_board_mux NULL
658#endif 668#endif
659 669
660static struct omap_musb_board_data musb_board_data = { 670static struct omap_musb_board_data musb_board_data = {
@@ -663,17 +673,26 @@ static struct omap_musb_board_data musb_board_data = {
663 .power = 100, 673 .power = 100,
664}; 674};
665 675
676static struct gpio omap3_evm_ehci_gpios[] __initdata = {
677 { OMAP3_EVM_EHCI_VBUS, GPIOF_OUT_INIT_HIGH, "enable EHCI VBUS" },
678 { OMAP3_EVM_EHCI_SELECT, GPIOF_OUT_INIT_LOW, "select EHCI port" },
679};
680
666static void __init omap3_evm_init(void) 681static void __init omap3_evm_init(void)
667{ 682{
668 omap3_evm_get_revision(); 683 omap3_evm_get_revision();
669 omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
670 684
671 omap3_evm_i2c_init(); 685 if (cpu_is_omap3630())
686 omap3_mux_init(omap36x_board_mux, OMAP_PACKAGE_CBB);
687 else
688 omap3_mux_init(omap35x_board_mux, OMAP_PACKAGE_CBB);
672 689
673 platform_add_devices(omap3_evm_devices, ARRAY_SIZE(omap3_evm_devices)); 690 omap_board_config = omap3_evm_config;
691 omap_board_config_size = ARRAY_SIZE(omap3_evm_config);
674 692
675 spi_register_board_info(omap3evm_spi_board_info, 693 omap3_evm_i2c_init();
676 ARRAY_SIZE(omap3evm_spi_board_info)); 694
695 omap_display_init(&omap3_evm_dss_data);
677 696
678 omap_serial_init(); 697 omap_serial_init();
679 698
@@ -682,20 +701,16 @@ static void __init omap3_evm_init(void)
682 701
683 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) { 702 if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) {
684 /* enable EHCI VBUS using GPIO22 */ 703 /* enable EHCI VBUS using GPIO22 */
685 omap_mux_init_gpio(22, OMAP_PIN_INPUT_PULLUP); 704 omap_mux_init_gpio(OMAP3_EVM_EHCI_VBUS, OMAP_PIN_INPUT_PULLUP);
686 gpio_request(OMAP3_EVM_EHCI_VBUS, "enable EHCI VBUS");
687 gpio_direction_output(OMAP3_EVM_EHCI_VBUS, 0);
688 gpio_set_value(OMAP3_EVM_EHCI_VBUS, 1);
689
690 /* Select EHCI port on main board */ 705 /* Select EHCI port on main board */
691 omap_mux_init_gpio(61, OMAP_PIN_INPUT_PULLUP); 706 omap_mux_init_gpio(OMAP3_EVM_EHCI_SELECT,
692 gpio_request(OMAP3_EVM_EHCI_SELECT, "select EHCI port"); 707 OMAP_PIN_INPUT_PULLUP);
693 gpio_direction_output(OMAP3_EVM_EHCI_SELECT, 0); 708 gpio_request_array(omap3_evm_ehci_gpios,
694 gpio_set_value(OMAP3_EVM_EHCI_SELECT, 0); 709 ARRAY_SIZE(omap3_evm_ehci_gpios));
695 710
696 /* setup EHCI phy reset config */ 711 /* setup EHCI phy reset config */
697 omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP); 712 omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP);
698 ehci_pdata.reset_gpio_port[1] = 21; 713 usbhs_bdata.reset_gpio_port[1] = 21;
699 714
700 /* EVM REV >= E can supply 500mA with EXTVBUS programming */ 715 /* EVM REV >= E can supply 500mA with EXTVBUS programming */
701 musb_board_data.power = 500; 716 musb_board_data.power = 500;
@@ -703,23 +718,29 @@ static void __init omap3_evm_init(void)
703 } else { 718 } else {
704 /* setup EHCI phy reset on MDC */ 719 /* setup EHCI phy reset on MDC */
705 omap_mux_init_gpio(135, OMAP_PIN_OUTPUT); 720 omap_mux_init_gpio(135, OMAP_PIN_OUTPUT);
706 ehci_pdata.reset_gpio_port[1] = 135; 721 usbhs_bdata.reset_gpio_port[1] = 135;
707 } 722 }
708 usb_musb_init(&musb_board_data); 723 usb_musb_init(&musb_board_data);
709 usb_ehci_init(&ehci_pdata); 724 usbhs_init(&usbhs_bdata);
710 ads7846_dev_init(); 725 omap_ads7846_init(1, OMAP3_EVM_TS_GPIO, 310, NULL);
711 omap3evm_init_smsc911x(); 726 omap3evm_init_smsc911x();
712 omap3_evm_display_init(); 727 omap3_evm_display_init();
728
729#ifdef CONFIG_WL12XX_PLATFORM_DATA
730 /* WL12xx WLAN Init */
731 if (wl12xx_set_platform_data(&omap3evm_wlan_data))
732 pr_err("error setting wl12xx data\n");
733 platform_device_register(&omap3evm_wlan_regulator);
734#endif
713} 735}
714 736
715MACHINE_START(OMAP3EVM, "OMAP3 EVM") 737MACHINE_START(OMAP3EVM, "OMAP3 EVM")
716 /* Maintainer: Syed Mohammed Khasim - Texas Instruments */ 738 /* Maintainer: Syed Mohammed Khasim - Texas Instruments */
717 .phys_io = 0x48000000,
718 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
719 .boot_params = 0x80000100, 739 .boot_params = 0x80000100,
720 .map_io = omap3_map_io,
721 .reserve = omap_reserve, 740 .reserve = omap_reserve,
722 .init_irq = omap3_evm_init_irq, 741 .map_io = omap3_map_io,
742 .init_early = omap3_evm_init_early,
743 .init_irq = omap_init_irq,
723 .init_machine = omap3_evm_init, 744 .init_machine = omap3_evm_init,
724 .timer = &omap_timer, 745 .timer = &omap_timer,
725MACHINE_END 746MACHINE_END