diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index f77343b..c2f78b5 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c @@ -193,6 +193,75 @@ fail0: return; } +char expansionboard_name[16]; + +#if defined(CONFIG_WL12XX) || defined(CONFIG_WL12XX_MODULE) +#include +#include + +#define OMAP_BEAGLE_WLAN_EN_GPIO (139) +#define OMAP_BEAGLE_BT_EN_GPIO (138) +#define OMAP_BEAGLE_WLAN_IRQ_GPIO (137) +#define OMAP_BEAGLE_FM_EN_BT_WU (136) + +struct wl12xx_platform_data omap_beagle_wlan_data __initdata = { + .irq = OMAP_GPIO_IRQ(OMAP_BEAGLE_WLAN_IRQ_GPIO), + .board_ref_clock = 2, /* 38.4 MHz */ +}; + +static int gpios[] = {OMAP_BEAGLE_BT_EN_GPIO, OMAP_BEAGLE_FM_EN_BT_WU, -1}; +static struct platform_device wl12xx_device = { + .name = "kim", + .id = -1, + .dev.platform_data = &gpios, +}; + +static struct omap2_hsmmc_info mmcbbt[] = { + { + .mmc = 1, + .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, + .gpio_wp = 29, + }, + { + .name = "wl1271", + .mmc = 2, + .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_POWER_OFF_CARD, + .gpio_wp = -EINVAL, + .gpio_cd = -EINVAL, + .ocr_mask = MMC_VDD_165_195, + .nonremovable = true, + }, + {} /* Terminator */ + }; + +static struct regulator_consumer_supply beagle_wifi_fixed_supply = + REGULATOR_SUPPLY("vmmc", "omap_hsmmc.1"); + +static struct regulator_init_data beagle_vmmc2 = { + .num_consumer_supplies = 1, + .consumer_supplies = &beagle_wifi_fixed_supply, +}; + +static struct fixed_voltage_config beagle_vwlan = { + .supply_name = "vwl1271", + .microvolts = 1800000, /* 1.8V */ + .gpio = OMAP_BEAGLE_WLAN_EN_GPIO, + .startup_delay = 70000, /* 70ms */ + .enable_high = 1, + .enabled_at_boot = 1, + .init_data = &beagle_vmmc2, +}; + +static struct platform_device omap_vwlan_device = { + .name = "reg-fixed-voltage", + .id = 1, + .dev = { + .platform_data = &beagle_vwlan, + }, +}; +#endif + + static struct mtd_partition omap3beagle_nand_partitions[] = { /* All the partition sizes are listed in terms of NAND block size */ { @@ -303,6 +372,12 @@ static struct omap2_hsmmc_info mmc[] = { .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA, .gpio_wp = 29, }, + { + .mmc = 2, + .caps = MMC_CAP_4_BIT_DATA, + .transceiver = true, + .ocr_mask = 0x00100000, /* 3.3V */ + }, {} /* Terminator */ }; @@ -329,6 +404,7 @@ static int beagle_twl_gpio_setup(struct device *dev, { if (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XM || omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_XMC) { mmc[0].gpio_wp = -EINVAL; + mmcbbt[0].gpio_wp = -EINVAL; } else if ((omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_C1_3) || (omap3_beagle_get_rev() == OMAP3BEAGLE_BOARD_C4)) { omap_mux_init_gpio(23, OMAP_PIN_INPUT); @@ -338,11 +414,26 @@ static int beagle_twl_gpio_setup(struct device *dev, } /* gpio + 0 is "mmc0_cd" (input/IRQ) */ mmc[0].gpio_cd = gpio + 0; + mmcbbt[0].gpio_cd = gpio + 0; +#if defined(CONFIG_WL12XX) || defined(CONFIG_WL12XX_MODULE) + if(!strcmp(expansionboard_name, "bbtoys-wifi")) { + omap2_hsmmc_init(mmcbbt); + /* link regulators to MMC adapters */ + beagle_vmmc1_supply.dev = mmcbbt[0].dev; + beagle_vsim_supply.dev = mmcbbt[0].dev; + } else { + omap2_hsmmc_init(mmc); + /* link regulators to MMC adapters */ + beagle_vmmc1_supply.dev = mmc[0].dev; + beagle_vsim_supply.dev = mmc[0].dev; + } +#else omap2_hsmmc_init(mmc); /* link regulators to MMC adapters */ beagle_vmmc1_supply.dev = mmc[0].dev; beagle_vsim_supply.dev = mmc[0].dev; +#endif /* REVISIT: need ehci-omap hooks for external VBUS * power switch and overcurrent detect @@ -693,6 +784,16 @@ static struct omap_musb_board_data musb_board_data = { .power = 100, }; +static int __init expansionboard_setup(char *str) +{ + if (!str) + return -EINVAL; + strncpy(expansionboard_name, str, 16); + printk(KERN_INFO "Beagle expansionboard: %s\n", expansionboard_name); + return 0; +} + + static void __init omap3_beagle_init(void) { omap3_mux_init(board_mux, OMAP_PACKAGE_CBB); @@ -707,6 +808,16 @@ static void __init omap3_beagle_init(void) /* REVISIT leave DVI powered down until it's needed ... */ gpio_direction_output(170, true); + if(!strcmp(expansionboard_name, "bbtoys-wifi")) + { + if (wl12xx_set_platform_data(&omap_beagle_wlan_data)) + pr_err("error setting wl12xx data\n"); + printk(KERN_INFO "Beagle expansionboard: registering wl12xx bt platform device\n"); + platform_device_register(&wl12xx_device); + printk(KERN_INFO "Beagle expansionboard: registering wl12xx wifi platform device\n"); + platform_device_register(&omap_vwlan_device); + } + usb_musb_init(&musb_board_data); usb_ehci_init(&ehci_pdata); omap3beagle_flash_init(); @@ -721,6 +832,8 @@ static void __init omap3_beagle_init(void) #endif } +early_param("buddy", expansionboard_setup); + MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board") /* Maintainer: Syed Mohammed Khasim - http://beagleboard.org */ .boot_params = 0x80000100,