]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - sitara-epos/sitara-epos-kernel.git/blob - arch/arm/mach-omap2/board-omap3evm.c
omap3evm: add support for the WL12xx WLAN module to the AM/DM3xx Evaluation Module
[sitara-epos/sitara-epos-kernel.git] / arch / arm / mach-omap2 / board-omap3evm.c
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  */
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>
23 #include <linux/input/matrix_keypad.h>
24 #include <linux/leds.h>
25 #include <linux/interrupt.h>
27 #include <linux/spi/spi.h>
28 #include <linux/spi/ads7846.h>
29 #include <linux/i2c/twl.h>
30 #include <linux/usb/otg.h>
31 #include <linux/smsc911x.h>
33 #include <linux/wl12xx.h>
34 #include <linux/regulator/fixed.h>
35 #include <linux/regulator/machine.h>
36 #include <linux/mmc/host.h>
38 #include <mach/hardware.h>
39 #include <asm/mach-types.h>
40 #include <asm/mach/arch.h>
41 #include <asm/mach/map.h>
43 #include <plat/board.h>
44 #include <plat/usb.h>
45 #include <plat/common.h>
46 #include <plat/mcspi.h>
47 #include <plat/display.h>
48 #include <plat/panel-generic-dpi.h>
50 #include "mux.h"
51 #include "sdram-micron-mt46h32m32lf-6.h"
52 #include "hsmmc.h"
54 #define OMAP3_EVM_TS_GPIO       175
55 #define OMAP3_EVM_EHCI_VBUS     22
56 #define OMAP3_EVM_EHCI_SELECT   61
58 #define OMAP3EVM_ETHR_START     0x2c000000
59 #define OMAP3EVM_ETHR_SIZE      1024
60 #define OMAP3EVM_ETHR_ID_REV    0x50
61 #define OMAP3EVM_ETHR_GPIO_IRQ  176
62 #define OMAP3EVM_SMSC911X_CS    5
64 static u8 omap3_evm_version;
66 u8 get_omap3_evm_rev(void)
67 {
68         return omap3_evm_version;
69 }
70 EXPORT_SYMBOL(get_omap3_evm_rev);
72 static void __init omap3_evm_get_revision(void)
73 {
74         void __iomem *ioaddr;
75         unsigned int smsc_id;
77         /* Ethernet PHY ID is stored at ID_REV register */
78         ioaddr = ioremap_nocache(OMAP3EVM_ETHR_START, SZ_1K);
79         if (!ioaddr)
80                 return;
81         smsc_id = readl(ioaddr + OMAP3EVM_ETHR_ID_REV) & 0xFFFF0000;
82         iounmap(ioaddr);
84         switch (smsc_id) {
85         /*SMSC9115 chipset*/
86         case 0x01150000:
87                 omap3_evm_version = OMAP3EVM_BOARD_GEN_1;
88                 break;
89         /*SMSC 9220 chipset*/
90         case 0x92200000:
91         default:
92                 omap3_evm_version = OMAP3EVM_BOARD_GEN_2;
93         }
94 }
96 #if defined(CONFIG_SMSC911X) || defined(CONFIG_SMSC911X_MODULE)
97 static struct resource omap3evm_smsc911x_resources[] = {
98         [0] =   {
99                 .start  = OMAP3EVM_ETHR_START,
100                 .end    = (OMAP3EVM_ETHR_START + OMAP3EVM_ETHR_SIZE - 1),
101                 .flags  = IORESOURCE_MEM,
102         },
103         [1] =   {
104                 .start  = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ),
105                 .end    = OMAP_GPIO_IRQ(OMAP3EVM_ETHR_GPIO_IRQ),
106                 .flags  = (IORESOURCE_IRQ | IRQF_TRIGGER_LOW),
107         },
108 };
110 static struct smsc911x_platform_config smsc911x_config = {
111         .phy_interface  = PHY_INTERFACE_MODE_MII,
112         .irq_polarity   = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
113         .irq_type       = SMSC911X_IRQ_TYPE_OPEN_DRAIN,
114         .flags          = (SMSC911X_USE_32BIT | SMSC911X_SAVE_MAC_ADDRESS),
115 };
117 static struct platform_device omap3evm_smsc911x_device = {
118         .name           = "smsc911x",
119         .id             = -1,
120         .num_resources  = ARRAY_SIZE(omap3evm_smsc911x_resources),
121         .resource       = &omap3evm_smsc911x_resources[0],
122         .dev            = {
123                 .platform_data = &smsc911x_config,
124         },
125 };
127 static inline void __init omap3evm_init_smsc911x(void)
129         int eth_cs;
130         struct clk *l3ck;
131         unsigned int rate;
133         eth_cs = OMAP3EVM_SMSC911X_CS;
135         l3ck = clk_get(NULL, "l3_ck");
136         if (IS_ERR(l3ck))
137                 rate = 100000000;
138         else
139                 rate = clk_get_rate(l3ck);
141         if (gpio_request(OMAP3EVM_ETHR_GPIO_IRQ, "SMSC911x irq") < 0) {
142                 printk(KERN_ERR "Failed to request GPIO%d for smsc911x IRQ\n",
143                         OMAP3EVM_ETHR_GPIO_IRQ);
144                 return;
145         }
147         gpio_direction_input(OMAP3EVM_ETHR_GPIO_IRQ);
148         platform_device_register(&omap3evm_smsc911x_device);
151 #else
152 static inline void __init omap3evm_init_smsc911x(void) { return; }
153 #endif
155 /*
156  * OMAP3EVM LCD Panel control signals
157  */
158 #define OMAP3EVM_LCD_PANEL_LR           2
159 #define OMAP3EVM_LCD_PANEL_UD           3
160 #define OMAP3EVM_LCD_PANEL_INI          152
161 #define OMAP3EVM_LCD_PANEL_ENVDD        153
162 #define OMAP3EVM_LCD_PANEL_QVGA         154
163 #define OMAP3EVM_LCD_PANEL_RESB         155
164 #define OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO 210
165 #define OMAP3EVM_DVI_PANEL_EN_GPIO      199
167 static int lcd_enabled;
168 static int dvi_enabled;
170 static void __init omap3_evm_display_init(void)
172         int r;
174         r = gpio_request(OMAP3EVM_LCD_PANEL_RESB, "lcd_panel_resb");
175         if (r) {
176                 printk(KERN_ERR "failed to get lcd_panel_resb\n");
177                 return;
178         }
179         gpio_direction_output(OMAP3EVM_LCD_PANEL_RESB, 1);
181         r = gpio_request(OMAP3EVM_LCD_PANEL_INI, "lcd_panel_ini");
182         if (r) {
183                 printk(KERN_ERR "failed to get lcd_panel_ini\n");
184                 goto err_1;
185         }
186         gpio_direction_output(OMAP3EVM_LCD_PANEL_INI, 1);
188         r = gpio_request(OMAP3EVM_LCD_PANEL_QVGA, "lcd_panel_qvga");
189         if (r) {
190                 printk(KERN_ERR "failed to get lcd_panel_qvga\n");
191                 goto err_2;
192         }
193         gpio_direction_output(OMAP3EVM_LCD_PANEL_QVGA, 0);
195         r = gpio_request(OMAP3EVM_LCD_PANEL_LR, "lcd_panel_lr");
196         if (r) {
197                 printk(KERN_ERR "failed to get lcd_panel_lr\n");
198                 goto err_3;
199         }
200         gpio_direction_output(OMAP3EVM_LCD_PANEL_LR, 1);
202         r = gpio_request(OMAP3EVM_LCD_PANEL_UD, "lcd_panel_ud");
203         if (r) {
204                 printk(KERN_ERR "failed to get lcd_panel_ud\n");
205                 goto err_4;
206         }
207         gpio_direction_output(OMAP3EVM_LCD_PANEL_UD, 1);
209         r = gpio_request(OMAP3EVM_LCD_PANEL_ENVDD, "lcd_panel_envdd");
210         if (r) {
211                 printk(KERN_ERR "failed to get lcd_panel_envdd\n");
212                 goto err_5;
213         }
214         gpio_direction_output(OMAP3EVM_LCD_PANEL_ENVDD, 0);
216         return;
218 err_5:
219         gpio_free(OMAP3EVM_LCD_PANEL_UD);
220 err_4:
221         gpio_free(OMAP3EVM_LCD_PANEL_LR);
222 err_3:
223         gpio_free(OMAP3EVM_LCD_PANEL_QVGA);
224 err_2:
225         gpio_free(OMAP3EVM_LCD_PANEL_INI);
226 err_1:
227         gpio_free(OMAP3EVM_LCD_PANEL_RESB);
231 static int omap3_evm_enable_lcd(struct omap_dss_device *dssdev)
233         if (dvi_enabled) {
234                 printk(KERN_ERR "cannot enable LCD, DVI is enabled\n");
235                 return -EINVAL;
236         }
237         gpio_set_value(OMAP3EVM_LCD_PANEL_ENVDD, 0);
239         if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2)
240                 gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 0);
241         else
242                 gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 1);
244         lcd_enabled = 1;
245         return 0;
248 static void omap3_evm_disable_lcd(struct omap_dss_device *dssdev)
250         gpio_set_value(OMAP3EVM_LCD_PANEL_ENVDD, 1);
252         if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2)
253                 gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 1);
254         else
255                 gpio_set_value(OMAP3EVM_LCD_PANEL_BKLIGHT_GPIO, 0);
257         lcd_enabled = 0;
260 static struct omap_dss_device omap3_evm_lcd_device = {
261         .name                   = "lcd",
262         .driver_name            = "sharp_ls_panel",
263         .type                   = OMAP_DISPLAY_TYPE_DPI,
264         .phy.dpi.data_lines     = 18,
265         .platform_enable        = omap3_evm_enable_lcd,
266         .platform_disable       = omap3_evm_disable_lcd,
267 };
269 static int omap3_evm_enable_tv(struct omap_dss_device *dssdev)
271         return 0;
274 static void omap3_evm_disable_tv(struct omap_dss_device *dssdev)
278 static struct omap_dss_device omap3_evm_tv_device = {
279         .name                   = "tv",
280         .driver_name            = "venc",
281         .type                   = OMAP_DISPLAY_TYPE_VENC,
282         .phy.venc.type          = OMAP_DSS_VENC_TYPE_SVIDEO,
283         .platform_enable        = omap3_evm_enable_tv,
284         .platform_disable       = omap3_evm_disable_tv,
285 };
287 static int omap3_evm_enable_dvi(struct omap_dss_device *dssdev)
289         if (lcd_enabled) {
290                 printk(KERN_ERR "cannot enable DVI, LCD is enabled\n");
291                 return -EINVAL;
292         }
294         gpio_set_value(OMAP3EVM_DVI_PANEL_EN_GPIO, 1);
296         dvi_enabled = 1;
297         return 0;
300 static void omap3_evm_disable_dvi(struct omap_dss_device *dssdev)
302         gpio_set_value(OMAP3EVM_DVI_PANEL_EN_GPIO, 0);
304         dvi_enabled = 0;
307 static struct panel_generic_dpi_data dvi_panel = {
308         .name                   = "generic",
309         .platform_enable        = omap3_evm_enable_dvi,
310         .platform_disable       = omap3_evm_disable_dvi,
311 };
313 static struct omap_dss_device omap3_evm_dvi_device = {
314         .name                   = "dvi",
315         .type                   = OMAP_DISPLAY_TYPE_DPI,
316         .driver_name            = "generic_dpi_panel",
317         .data                   = &dvi_panel,
318         .phy.dpi.data_lines     = 24,
319 };
321 static struct omap_dss_device *omap3_evm_dss_devices[] = {
322         &omap3_evm_lcd_device,
323         &omap3_evm_tv_device,
324         &omap3_evm_dvi_device,
325 };
327 static struct omap_dss_board_info omap3_evm_dss_data = {
328         .num_devices    = ARRAY_SIZE(omap3_evm_dss_devices),
329         .devices        = omap3_evm_dss_devices,
330         .default_device = &omap3_evm_lcd_device,
331 };
333 static struct platform_device omap3_evm_dss_device = {
334         .name           = "omapdss",
335         .id             = -1,
336         .dev            = {
337                 .platform_data = &omap3_evm_dss_data,
338         },
339 };
341 static struct regulator_consumer_supply omap3evm_vmmc1_supply = {
342         .supply                 = "vmmc",
343 };
345 static struct regulator_consumer_supply omap3evm_vsim_supply = {
346         .supply                 = "vmmc_aux",
347 };
349 /* VMMC1 for MMC1 pins CMD, CLK, DAT0..DAT3 (20 mA, plus card == max 220 mA) */
350 static struct regulator_init_data omap3evm_vmmc1 = {
351         .constraints = {
352                 .min_uV                 = 1850000,
353                 .max_uV                 = 3150000,
354                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
355                                         | REGULATOR_MODE_STANDBY,
356                 .valid_ops_mask         = REGULATOR_CHANGE_VOLTAGE
357                                         | REGULATOR_CHANGE_MODE
358                                         | REGULATOR_CHANGE_STATUS,
359         },
360         .num_consumer_supplies  = 1,
361         .consumer_supplies      = &omap3evm_vmmc1_supply,
362 };
364 /* VSIM for MMC1 pins DAT4..DAT7 (2 mA, plus card == max 50 mA) */
365 static struct regulator_init_data omap3evm_vsim = {
366         .constraints = {
367                 .min_uV                 = 1800000,
368                 .max_uV                 = 3000000,
369                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
370                                         | REGULATOR_MODE_STANDBY,
371                 .valid_ops_mask         = REGULATOR_CHANGE_VOLTAGE
372                                         | REGULATOR_CHANGE_MODE
373                                         | REGULATOR_CHANGE_STATUS,
374         },
375         .num_consumer_supplies  = 1,
376         .consumer_supplies      = &omap3evm_vsim_supply,
377 };
379 static struct omap2_hsmmc_info mmc[] = {
380         {
381                 .mmc            = 1,
382                 .caps           = MMC_CAP_4_BIT_DATA,
383                 .gpio_cd        = -EINVAL,
384                 .gpio_wp        = 63,
385         },
386 #ifdef CONFIG_WL12XX_PLATFORM_DATA
387         {
388                 .name           = "wl1271",
389                 .mmc            = 2,
390                 .caps           = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
391                 .gpio_wp        = -EINVAL,
392                 .gpio_cd        = -EINVAL,
393                 .nonremovable   = true,
394         },
395 #endif
396         {}      /* Terminator */
397 };
399 static struct gpio_led gpio_leds[] = {
400         {
401                 .name                   = "omap3evm::ledb",
402                 /* normally not visible (board underside) */
403                 .default_trigger        = "default-on",
404                 .gpio                   = -EINVAL,      /* gets replaced */
405                 .active_low             = true,
406         },
407 };
409 static struct gpio_led_platform_data gpio_led_info = {
410         .leds           = gpio_leds,
411         .num_leds       = ARRAY_SIZE(gpio_leds),
412 };
414 static struct platform_device leds_gpio = {
415         .name   = "leds-gpio",
416         .id     = -1,
417         .dev    = {
418                 .platform_data  = &gpio_led_info,
419         },
420 };
423 static int omap3evm_twl_gpio_setup(struct device *dev,
424                 unsigned gpio, unsigned ngpio)
426         /* gpio + 0 is "mmc0_cd" (input/IRQ) */
427         omap_mux_init_gpio(63, OMAP_PIN_INPUT);
428         mmc[0].gpio_cd = gpio + 0;
429         omap2_hsmmc_init(mmc);
431         /* link regulators to MMC adapters */
432         omap3evm_vmmc1_supply.dev = mmc[0].dev;
433         omap3evm_vsim_supply.dev = mmc[0].dev;
435         /*
436          * Most GPIOs are for USB OTG.  Some are mostly sent to
437          * the P2 connector; notably LEDA for the LCD backlight.
438          */
440         /* TWL4030_GPIO_MAX + 0 == ledA, LCD Backlight control */
441         gpio_request(gpio + TWL4030_GPIO_MAX, "EN_LCD_BKL");
442         gpio_direction_output(gpio + TWL4030_GPIO_MAX, 0);
444         /* gpio + 7 == DVI Enable */
445         gpio_request(gpio + 7, "EN_DVI");
446         gpio_direction_output(gpio + 7, 0);
448         /* TWL4030_GPIO_MAX + 1 == ledB (out, active low LED) */
449         gpio_leds[2].gpio = gpio + TWL4030_GPIO_MAX + 1;
451         platform_device_register(&leds_gpio);
453         return 0;
456 static struct twl4030_gpio_platform_data omap3evm_gpio_data = {
457         .gpio_base      = OMAP_MAX_GPIO_LINES,
458         .irq_base       = TWL4030_GPIO_IRQ_BASE,
459         .irq_end        = TWL4030_GPIO_IRQ_END,
460         .use_leds       = true,
461         .setup          = omap3evm_twl_gpio_setup,
462 };
464 static struct twl4030_usb_data omap3evm_usb_data = {
465         .usb_mode       = T2_USB_MODE_ULPI,
466 };
468 static uint32_t board_keymap[] = {
469         KEY(0, 0, KEY_LEFT),
470         KEY(0, 1, KEY_DOWN),
471         KEY(0, 2, KEY_ENTER),
472         KEY(0, 3, KEY_M),
474         KEY(1, 0, KEY_RIGHT),
475         KEY(1, 1, KEY_UP),
476         KEY(1, 2, KEY_I),
477         KEY(1, 3, KEY_N),
479         KEY(2, 0, KEY_A),
480         KEY(2, 1, KEY_E),
481         KEY(2, 2, KEY_J),
482         KEY(2, 3, KEY_O),
484         KEY(3, 0, KEY_B),
485         KEY(3, 1, KEY_F),
486         KEY(3, 2, KEY_K),
487         KEY(3, 3, KEY_P)
488 };
490 static struct matrix_keymap_data board_map_data = {
491         .keymap                 = board_keymap,
492         .keymap_size            = ARRAY_SIZE(board_keymap),
493 };
495 static struct twl4030_keypad_data omap3evm_kp_data = {
496         .keymap_data    = &board_map_data,
497         .rows           = 4,
498         .cols           = 4,
499         .rep            = 1,
500 };
502 static struct twl4030_madc_platform_data omap3evm_madc_data = {
503         .irq_line       = 1,
504 };
506 static struct twl4030_codec_audio_data omap3evm_audio_data = {
507         .audio_mclk = 26000000,
508 };
510 static struct twl4030_codec_data omap3evm_codec_data = {
511         .audio_mclk = 26000000,
512         .audio = &omap3evm_audio_data,
513 };
515 static struct regulator_consumer_supply omap3_evm_vdda_dac_supply = {
516         .supply         = "vdda_dac",
517         .dev            = &omap3_evm_dss_device.dev,
518 };
520 /* VDAC for DSS driving S-Video */
521 static struct regulator_init_data omap3_evm_vdac = {
522         .constraints = {
523                 .min_uV                 = 1800000,
524                 .max_uV                 = 1800000,
525                 .apply_uV               = true,
526                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
527                                         | REGULATOR_MODE_STANDBY,
528                 .valid_ops_mask         = REGULATOR_CHANGE_MODE
529                                         | REGULATOR_CHANGE_STATUS,
530         },
531         .num_consumer_supplies  = 1,
532         .consumer_supplies      = &omap3_evm_vdda_dac_supply,
533 };
535 /* VPLL2 for digital video outputs */
536 static struct regulator_consumer_supply omap3_evm_vpll2_supply =
537         REGULATOR_SUPPLY("vdds_dsi", "omapdss");
539 static struct regulator_init_data omap3_evm_vpll2 = {
540         .constraints = {
541                 .min_uV                 = 1800000,
542                 .max_uV                 = 1800000,
543                 .apply_uV               = true,
544                 .valid_modes_mask       = REGULATOR_MODE_NORMAL
545                                         | REGULATOR_MODE_STANDBY,
546                 .valid_ops_mask         = REGULATOR_CHANGE_MODE
547                                         | REGULATOR_CHANGE_STATUS,
548         },
549         .num_consumer_supplies  = 1,
550         .consumer_supplies      = &omap3_evm_vpll2_supply,
551 };
553 #ifdef CONFIG_WL12XX_PLATFORM_DATA
555 #define OMAP3EVM_WLAN_PMENA_GPIO        (150)
556 #define OMAP3EVM_WLAN_IRQ_GPIO          (149)
558 static struct regulator_consumer_supply omap3evm_vmmc2_supply = {
559         .supply                 = "vmmc",
560         .dev_name               = "mmci-omap-hs.1",
561 };
563 /* VMMC2 for driving the WL12xx module */
564 static struct regulator_init_data omap3evm_vmmc2 = {
565         .constraints = {
566                 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
567         },
568         .num_consumer_supplies  = 1,
569         .consumer_supplies = &omap3evm_vmmc2_supply,
570 };
572 static struct fixed_voltage_config omap3evm_vwlan = {
573         .supply_name            = "vwl1271",
574         .microvolts             = 1800000, /* 1.80V */
575         .gpio                   = OMAP3EVM_WLAN_PMENA_GPIO,
576         .startup_delay          = 70000, /* 70ms */
577         .enable_high            = 1,
578         .enabled_at_boot        = 0,
579         .init_data              = &omap3evm_vmmc2,
580 };
582 static struct platform_device omap3evm_vwlan_device = {
583         .name           = "reg-fixed-voltage",
584         .id             = 1,
585         .dev = {
586                 .platform_data  = &omap3evm_vwlan,
587         },
588 };
590 struct wl12xx_platform_data omap3evm_wlan_data __initdata = {
591         .irq = OMAP_GPIO_IRQ(OMAP3EVM_WLAN_IRQ_GPIO),
592         /* ref clock is 38.4 MHz */
593         .board_ref_clock = 2,
594 };
595 #endif
597 static struct twl4030_platform_data omap3evm_twldata = {
598         .irq_base       = TWL4030_IRQ_BASE,
599         .irq_end        = TWL4030_IRQ_END,
601         /* platform_data for children goes here */
602         .keypad         = &omap3evm_kp_data,
603         .madc           = &omap3evm_madc_data,
604         .usb            = &omap3evm_usb_data,
605         .gpio           = &omap3evm_gpio_data,
606         .codec          = &omap3evm_codec_data,
607         .vdac           = &omap3_evm_vdac,
608         .vpll2          = &omap3_evm_vpll2,
609 };
611 static struct i2c_board_info __initdata omap3evm_i2c_boardinfo[] = {
612         {
613                 I2C_BOARD_INFO("twl4030", 0x48),
614                 .flags = I2C_CLIENT_WAKE,
615                 .irq = INT_34XX_SYS_NIRQ,
616                 .platform_data = &omap3evm_twldata,
617         },
618 };
620 static int __init omap3_evm_i2c_init(void)
622         /*
623          * REVISIT: These entries can be set in omap3evm_twl_data
624          * after a merge with MFD tree
625          */
626         omap3evm_twldata.vmmc1 = &omap3evm_vmmc1;
627         omap3evm_twldata.vsim = &omap3evm_vsim;
629         omap_register_i2c_bus(1, 2600, omap3evm_i2c_boardinfo,
630                         ARRAY_SIZE(omap3evm_i2c_boardinfo));
631         omap_register_i2c_bus(2, 400, NULL, 0);
632         omap_register_i2c_bus(3, 400, NULL, 0);
633         return 0;
636 static void ads7846_dev_init(void)
638         if (gpio_request(OMAP3_EVM_TS_GPIO, "ADS7846 pendown") < 0)
639                 printk(KERN_ERR "can't get ads7846 pen down GPIO\n");
641         gpio_direction_input(OMAP3_EVM_TS_GPIO);
642         gpio_set_debounce(OMAP3_EVM_TS_GPIO, 310);
645 static int ads7846_get_pendown_state(void)
647         return !gpio_get_value(OMAP3_EVM_TS_GPIO);
650 static struct ads7846_platform_data ads7846_config = {
651         .x_max                  = 0x0fff,
652         .y_max                  = 0x0fff,
653         .x_plate_ohms           = 180,
654         .pressure_max           = 255,
655         .debounce_max           = 10,
656         .debounce_tol           = 3,
657         .debounce_rep           = 1,
658         .get_pendown_state      = ads7846_get_pendown_state,
659         .keep_vref_on           = 1,
660         .settle_delay_usecs     = 150,
661         .wakeup                         = true,
662 };
664 static struct omap2_mcspi_device_config ads7846_mcspi_config = {
665         .turbo_mode     = 0,
666         .single_channel = 1,    /* 0: slave, 1: master */
667 };
669 static struct spi_board_info omap3evm_spi_board_info[] = {
670         [0] = {
671                 .modalias               = "ads7846",
672                 .bus_num                = 1,
673                 .chip_select            = 0,
674                 .max_speed_hz           = 1500000,
675                 .controller_data        = &ads7846_mcspi_config,
676                 .irq                    = OMAP_GPIO_IRQ(OMAP3_EVM_TS_GPIO),
677                 .platform_data          = &ads7846_config,
678         },
679 };
681 static struct omap_board_config_kernel omap3_evm_config[] __initdata = {
682 };
684 static void __init omap3_evm_init_early(void)
686         omap_board_config = omap3_evm_config;
687         omap_board_config_size = ARRAY_SIZE(omap3_evm_config);
688         omap2_init_common_infrastructure();
689         omap2_init_common_devices(mt46h32m32lf6_sdrc_params, NULL);
692 static struct platform_device *omap3_evm_devices[] __initdata = {
693         &omap3_evm_dss_device,
694 };
696 static struct ehci_hcd_omap_platform_data ehci_pdata __initdata = {
698         .port_mode[0] = EHCI_HCD_OMAP_MODE_UNKNOWN,
699         .port_mode[1] = EHCI_HCD_OMAP_MODE_PHY,
700         .port_mode[2] = EHCI_HCD_OMAP_MODE_UNKNOWN,
702         .phy_reset  = true,
703         /* PHY reset GPIO will be runtime programmed based on EVM version */
704         .reset_gpio_port[0]  = -EINVAL,
705         .reset_gpio_port[1]  = -EINVAL,
706         .reset_gpio_port[2]  = -EINVAL
707 };
709 #ifdef CONFIG_OMAP_MUX
710 static struct omap_board_mux board_mux[] __initdata = {
711         OMAP3_MUX(SYS_NIRQ, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP |
712                                 OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW |
713                                 OMAP_PIN_OFF_WAKEUPENABLE),
714         OMAP3_MUX(MCSPI1_CS1, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP |
715                                 OMAP_PIN_OFF_INPUT_PULLUP | OMAP_PIN_OFF_OUTPUT_LOW),
716 #ifdef CONFIG_WL12XX_PLATFORM_DATA
717         /* WLAN IRQ - GPIO 149 */
718         OMAP3_MUX(UART1_RTS, OMAP_MUX_MODE4 | OMAP_PIN_INPUT_PULLUP),
720         /* WLAN POWER ENABLE - GPIO 150 */
721         OMAP3_MUX(UART1_CTS, OMAP_MUX_MODE4 | OMAP_PIN_OUTPUT),
723         /* MMC2 SDIO pin muxes for WL12xx */
724         OMAP3_MUX(SDMMC2_CLK, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
725         OMAP3_MUX(SDMMC2_CMD, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
726         OMAP3_MUX(SDMMC2_DAT0, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
727         OMAP3_MUX(SDMMC2_DAT1, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
728         OMAP3_MUX(SDMMC2_DAT2, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
729         OMAP3_MUX(SDMMC2_DAT3, OMAP_MUX_MODE0 | OMAP_PIN_INPUT_PULLUP),
730 #endif
731         { .reg_offset = OMAP_MUX_TERMINATOR },
732 };
733 #endif
735 static struct omap_musb_board_data musb_board_data = {
736         .interface_type         = MUSB_INTERFACE_ULPI,
737         .mode                   = MUSB_OTG,
738         .power                  = 100,
739 };
741 static void __init omap3_evm_init(void)
743         omap3_evm_get_revision();
744         omap3_mux_init(board_mux, OMAP_PACKAGE_CBB);
746         omap3_evm_i2c_init();
748         platform_add_devices(omap3_evm_devices, ARRAY_SIZE(omap3_evm_devices));
750         spi_register_board_info(omap3evm_spi_board_info,
751                                 ARRAY_SIZE(omap3evm_spi_board_info));
753         omap_serial_init();
755         /* OMAP3EVM uses ISP1504 phy and so register nop transceiver */
756         usb_nop_xceiv_register();
758         if (get_omap3_evm_rev() >= OMAP3EVM_BOARD_GEN_2) {
759                 /* enable EHCI VBUS using GPIO22 */
760                 omap_mux_init_gpio(22, OMAP_PIN_INPUT_PULLUP);
761                 gpio_request(OMAP3_EVM_EHCI_VBUS, "enable EHCI VBUS");
762                 gpio_direction_output(OMAP3_EVM_EHCI_VBUS, 0);
763                 gpio_set_value(OMAP3_EVM_EHCI_VBUS, 1);
765                 /* Select EHCI port on main board */
766                 omap_mux_init_gpio(61, OMAP_PIN_INPUT_PULLUP);
767                 gpio_request(OMAP3_EVM_EHCI_SELECT, "select EHCI port");
768                 gpio_direction_output(OMAP3_EVM_EHCI_SELECT, 0);
769                 gpio_set_value(OMAP3_EVM_EHCI_SELECT, 0);
771                 /* setup EHCI phy reset config */
772                 omap_mux_init_gpio(21, OMAP_PIN_INPUT_PULLUP);
773                 ehci_pdata.reset_gpio_port[1] = 21;
775                 /* EVM REV >= E can supply 500mA with EXTVBUS programming */
776                 musb_board_data.power = 500;
777                 musb_board_data.extvbus = 1;
778         } else {
779                 /* setup EHCI phy reset on MDC */
780                 omap_mux_init_gpio(135, OMAP_PIN_OUTPUT);
781                 ehci_pdata.reset_gpio_port[1] = 135;
782         }
783         usb_musb_init(&musb_board_data);
784         usb_ehci_init(&ehci_pdata);
785         ads7846_dev_init();
786         omap3evm_init_smsc911x();
787         omap3_evm_display_init();
789 #ifdef CONFIG_WL12XX_PLATFORM_DATA
790         /* WL12xx WLAN Init */
791         if (wl12xx_set_platform_data(&omap3evm_wlan_data))
792                 pr_err("error setting wl12xx data\n");
793         platform_device_register(&omap3evm_vwlan_device);
794 #endif
797 MACHINE_START(OMAP3EVM, "OMAP3 EVM")
798         /* Maintainer: Syed Mohammed Khasim - Texas Instruments */
799         .boot_params    = 0x80000100,
800         .reserve        = omap_reserve,
801         .map_io         = omap3_map_io,
802         .init_early     = omap3_evm_init_early,
803         .init_irq       = omap_init_irq,
804         .init_machine   = omap3_evm_init,
805         .timer          = &omap_timer,
806 MACHINE_END