aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorIdo Yariv <ido@wizery.com>2011-08-04 03:51:23 -0400
committerSekhar Nori <nsekhar@ti.com>2011-09-17 06:23:23 -0400
commitab3f5c1fc21e07896aca4f3a1552197565b72003 (patch)
tree889e2a6eee1b8c7e3285d587ba304b4dbd498875 /arch
parent4a9de8ad2cea3c952e8b1cff8aa9289cd9d66c62 (diff)
ARM: davinci: AM18x: Add wl1271/wlan support
The wl1271 daughter card for AM18x EVMs is a combo wireless connectivity add-on card, based on the LS Research TiWi module with Texas Instruments' wl1271 solution. It is a 4-wire, 1.8V, embedded SDIO WLAN device with an external IRQ line and is power-controlled by a GPIO-based fixed regulator. Add support for the WLAN capabilities of this expansion board. Signed-off-by: Ido Yariv <ido@wizery.com> Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-davinci/Kconfig10
-rw-r--r--arch/arm/mach-davinci/board-da850-evm.c114
2 files changed, 124 insertions, 0 deletions
diff --git a/arch/arm/mach-davinci/Kconfig b/arch/arm/mach-davinci/Kconfig
index c0deacae778d..32d837d8eab9 100644
--- a/arch/arm/mach-davinci/Kconfig
+++ b/arch/arm/mach-davinci/Kconfig
@@ -192,6 +192,16 @@ config DA850_UI_RMII
192 192
193endchoice 193endchoice
194 194
195config DA850_WL12XX
196 bool "AM18x wl1271 daughter board"
197 depends on MACH_DAVINCI_DA850_EVM
198 help
199 The wl1271 daughter card for AM18x EVMs is a combo wireless
200 connectivity add-on card, based on the LS Research TiWi module with
201 Texas Instruments' wl1271 solution.
202 Say Y if you want to use a wl1271 expansion card connected to the
203 AM18x EVM.
204
195config GPIO_PCA953X 205config GPIO_PCA953X
196 default MACH_DAVINCI_DA850_EVM 206 default MACH_DAVINCI_DA850_EVM
197 207
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 008d51407cd7..cb7a1f0b299f 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -31,6 +31,8 @@
31#include <linux/input/tps6507x-ts.h> 31#include <linux/input/tps6507x-ts.h>
32#include <linux/spi/spi.h> 32#include <linux/spi/spi.h>
33#include <linux/spi/flash.h> 33#include <linux/spi/flash.h>
34#include <linux/delay.h>
35#include <linux/wl12xx.h>
34 36
35#include <asm/mach-types.h> 37#include <asm/mach-types.h>
36#include <asm/mach/arch.h> 38#include <asm/mach/arch.h>
@@ -49,6 +51,9 @@
49#define DA850_MMCSD_CD_PIN GPIO_TO_PIN(4, 0) 51#define DA850_MMCSD_CD_PIN GPIO_TO_PIN(4, 0)
50#define DA850_MMCSD_WP_PIN GPIO_TO_PIN(4, 1) 52#define DA850_MMCSD_WP_PIN GPIO_TO_PIN(4, 1)
51 53
54#define DA850_WLAN_EN GPIO_TO_PIN(6, 9)
55#define DA850_WLAN_IRQ GPIO_TO_PIN(6, 10)
56
52#define DA850_MII_MDIO_CLKEN_PIN GPIO_TO_PIN(2, 6) 57#define DA850_MII_MDIO_CLKEN_PIN GPIO_TO_PIN(2, 6)
53 58
54static struct mtd_partition da850evm_spiflash_part[] = { 59static struct mtd_partition da850evm_spiflash_part[] = {
@@ -1143,6 +1148,110 @@ static __init int da850_evm_init_cpufreq(void)
1143static __init int da850_evm_init_cpufreq(void) { return 0; } 1148static __init int da850_evm_init_cpufreq(void) { return 0; }
1144#endif 1149#endif
1145 1150
1151#ifdef CONFIG_DA850_WL12XX
1152
1153static void wl12xx_set_power(int index, bool power_on)
1154{
1155 static bool power_state;
1156
1157 pr_debug("Powering %s wl12xx", power_on ? "on" : "off");
1158
1159 if (power_on == power_state)
1160 return;
1161 power_state = power_on;
1162
1163 if (power_on) {
1164 /* Power up sequence required for wl127x devices */
1165 gpio_set_value(DA850_WLAN_EN, 1);
1166 usleep_range(15000, 15000);
1167 gpio_set_value(DA850_WLAN_EN, 0);
1168 usleep_range(1000, 1000);
1169 gpio_set_value(DA850_WLAN_EN, 1);
1170 msleep(70);
1171 } else {
1172 gpio_set_value(DA850_WLAN_EN, 0);
1173 }
1174}
1175
1176static struct davinci_mmc_config da850_wl12xx_mmc_config = {
1177 .set_power = wl12xx_set_power,
1178 .wires = 4,
1179 .max_freq = 25000000,
1180 .caps = MMC_CAP_4_BIT_DATA | MMC_CAP_NONREMOVABLE |
1181 MMC_CAP_POWER_OFF_CARD,
1182 .version = MMC_CTLR_VERSION_2,
1183};
1184
1185static const short da850_wl12xx_pins[] __initconst = {
1186 DA850_MMCSD1_DAT_0, DA850_MMCSD1_DAT_1, DA850_MMCSD1_DAT_2,
1187 DA850_MMCSD1_DAT_3, DA850_MMCSD1_CLK, DA850_MMCSD1_CMD,
1188 DA850_GPIO6_9, DA850_GPIO6_10,
1189 -1
1190};
1191
1192static struct wl12xx_platform_data da850_wl12xx_wlan_data __initdata = {
1193 .irq = -1,
1194 .board_ref_clock = WL12XX_REFCLOCK_38,
1195 .platform_quirks = WL12XX_PLATFORM_QUIRK_EDGE_IRQ,
1196};
1197
1198static __init int da850_wl12xx_init(void)
1199{
1200 int ret;
1201
1202 ret = davinci_cfg_reg_list(da850_wl12xx_pins);
1203 if (ret) {
1204 pr_err("wl12xx/mmc mux setup failed: %d\n", ret);
1205 goto exit;
1206 }
1207
1208 ret = da850_register_mmcsd1(&da850_wl12xx_mmc_config);
1209 if (ret) {
1210 pr_err("wl12xx/mmc registration failed: %d\n", ret);
1211 goto exit;
1212 }
1213
1214 ret = gpio_request_one(DA850_WLAN_EN, GPIOF_OUT_INIT_LOW, "wl12xx_en");
1215 if (ret) {
1216 pr_err("Could not request wl12xx enable gpio: %d\n", ret);
1217 goto exit;
1218 }
1219
1220 ret = gpio_request_one(DA850_WLAN_IRQ, GPIOF_IN, "wl12xx_irq");
1221 if (ret) {
1222 pr_err("Could not request wl12xx irq gpio: %d\n", ret);
1223 goto free_wlan_en;
1224 }
1225
1226 da850_wl12xx_wlan_data.irq = gpio_to_irq(DA850_WLAN_IRQ);
1227
1228 ret = wl12xx_set_platform_data(&da850_wl12xx_wlan_data);
1229 if (ret) {
1230 pr_err("Could not set wl12xx data: %d\n", ret);
1231 goto free_wlan_irq;
1232 }
1233
1234 return 0;
1235
1236free_wlan_irq:
1237 gpio_free(DA850_WLAN_IRQ);
1238
1239free_wlan_en:
1240 gpio_free(DA850_WLAN_EN);
1241
1242exit:
1243 return ret;
1244}
1245
1246#else /* CONFIG_DA850_WL12XX */
1247
1248static __init int da850_wl12xx_init(void)
1249{
1250 return 0;
1251}
1252
1253#endif /* CONFIG_DA850_WL12XX */
1254
1146#define DA850EVM_SATA_REFCLKPN_RATE (100 * 1000 * 1000) 1255#define DA850EVM_SATA_REFCLKPN_RATE (100 * 1000 * 1000)
1147 1256
1148static __init void da850_evm_init(void) 1257static __init void da850_evm_init(void)
@@ -1197,6 +1306,11 @@ static __init void da850_evm_init(void)
1197 if (ret) 1306 if (ret)
1198 pr_warning("da850_evm_init: mmcsd0 registration failed:" 1307 pr_warning("da850_evm_init: mmcsd0 registration failed:"
1199 " %d\n", ret); 1308 " %d\n", ret);
1309
1310 ret = da850_wl12xx_init();
1311 if (ret)
1312 pr_warning("da850_evm_init: wl12xx initialization"
1313 " failed: %d\n", ret);
1200 } 1314 }
1201 1315
1202 davinci_serial_init(&da850_evm_uart_config); 1316 davinci_serial_init(&da850_evm_uart_config);