9b08d5f682aa886fcae6061e0dbf04441c29a534
[openembedded.git] /
1 From f7d71be36165002251727019b1a03a19938bfa64 Mon Sep 17 00:00:00 2001
2 From: Koen Kooi <koen@beagleboard.org>
3 Date: Mon, 20 Dec 2010 11:57:56 +0100
4 Subject: [PATCH 13/28] omap3: beagleboard: add WIP support for beagleboardtoys WL12xx board
5
6 Based on a patch by Luciano Coelho <luciano.coelho@nokia.com>
7
8 Signed-off-by: Koen Kooi <koen@beagleboard.org>
9 ---
10  arch/arm/mach-omap2/board-omap3beagle.c |   84 ++++++++++++++++++++++++++++++-
11  1 files changed, 83 insertions(+), 1 deletions(-)
12
13 diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
14 index 64a181e..59b26da 100644
15 --- a/arch/arm/mach-omap2/board-omap3beagle.c
16 +++ b/arch/arm/mach-omap2/board-omap3beagle.c
17 @@ -146,6 +146,67 @@ fail0:
18  
19  char expansionboard_name[16];
20  
21 +#if defined(CONFIG_WL1271) || defined(CONFIG_WL1271_MODULE)
22 +#include <linux/regulator/fixed.h>
23 +#include <linux/wl12xx.h>
24 +
25 +#define OMAP_BEAGLE_WLAN_EN_GPIO    (139)
26 +#define OMAP_BEAGLE_WLAN_IRQ_GPIO   (137)
27 +
28 +struct wl12xx_platform_data omap_beagle_wlan_data __initdata = {
29 +       .irq = OMAP_GPIO_IRQ(OMAP_BEAGLE_WLAN_IRQ_GPIO),
30 +       .board_ref_clock = 2, /* 38.4 MHz */
31 +};
32 +
33 + static struct omap2_hsmmc_info mmcbbt[] = {
34 +       {
35 +               .mmc            = 1,
36 +               .caps           = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA,
37 +               .gpio_wp        = 29,
38 +       },
39 +       {
40 +               .name           = "wl1271",
41 +               .mmc            = 2,
42 +               .caps           = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD,
43 +               .gpio_wp        = -EINVAL,
44 +               .gpio_cd        = -EINVAL,
45 +               .nonremovable   = true,
46 +       },
47 +       {}      /* Terminator */
48 + };
49 +
50 +static struct regulator_consumer_supply beagle_vmmc2_supply = {
51 +       .supply         = "vmmc",
52 +       .dev_name       = "mmci-omap-hs.1",
53 +};
54 +
55 +static struct regulator_init_data beagle_vmmc2 = {
56 +       .constraints = {
57 +               .valid_ops_mask = REGULATOR_CHANGE_STATUS,
58 +       },
59 +       .num_consumer_supplies = 1,
60 +       .consumer_supplies = &beagle_vmmc2_supply,
61 +};
62 +
63 +static struct fixed_voltage_config beagle_vwlan = {
64 +       .supply_name = "vwl1271",
65 +       .microvolts = 1800000,  /* 1.8V */
66 +       .gpio = OMAP_BEAGLE_WLAN_EN_GPIO,
67 +       .startup_delay = 70000, /* 70ms */
68 +       .enable_high = 1,
69 +       .enabled_at_boot = 0,
70 +       .init_data = &beagle_vmmc2,
71 +};
72 +
73 +static struct platform_device omap_vwlan_device = {
74 +       .name           = "reg-fixed-voltage",
75 +       .id             = 1,
76 +       .dev = {
77 +               .platform_data = &beagle_vwlan,
78 +       },
79 +};
80 +#endif
81 +
82  #if defined(CONFIG_ENC28J60) || defined(CONFIG_ENC28J60_MODULE)
83  
84  #include <plat/mcspi.h>
85 @@ -384,11 +445,24 @@ static int beagle_twl_gpio_setup(struct device *dev,
86         }
87         /* gpio + 0 is "mmc0_cd" (input/IRQ) */
88         mmc[0].gpio_cd = gpio + 0;
89 +#if defined(CONFIG_WL1271) || defined(CONFIG_WL1271_MODULE)
90 +       if(!strcmp(expansionboard_name, "fixme-beagletoy")) { 
91 +               omap2_hsmmc_init(mmcbbt);
92 +               /* link regulators to MMC adapters */
93 +               beagle_vmmc1_supply.dev = mmcbbt[0].dev;
94 +               beagle_vsim_supply.dev = mmcbbt[0].dev;
95 +       } else {
96 +               omap2_hsmmc_init(mmc);
97 +               /* link regulators to MMC adapters */
98 +               beagle_vmmc1_supply.dev = mmc[0].dev;
99 +               beagle_vsim_supply.dev = mmc[0].dev;
100 +       }
101 +#else
102         omap2_hsmmc_init(mmc);
103 -
104         /* link regulators to MMC adapters */
105         beagle_vmmc1_supply.dev = mmc[0].dev;
106         beagle_vsim_supply.dev = mmc[0].dev;
107 +#endif
108  
109         /* REVISIT: need ehci-omap hooks for external VBUS
110          * power switch and overcurrent detect
111 @@ -788,6 +862,14 @@ static void __init omap3_beagle_init(void)
112                 gpio_export(162, 1);
113         }
114  
115 +       if(!strcmp(expansionboard_name, "fixme-beagletoy"))
116 +       {
117 +               if (wl12xx_set_platform_data(&omap_beagle_wlan_data))
118 +                       pr_err("error setting wl12xx data\n");
119 +               printk(KERN_INFO "Beagle expansionboard: registering wl12xx platform device\n");
120 +               platform_device_register(&omap_vwlan_device);
121 +       }
122 +
123         usb_musb_init(&musb_board_data);
124         usb_ehci_init(&ehci_pdata);
125         omap3beagle_flash_init();
126 -- 
127 1.6.6.1
128