aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSolomon Peachy <pizza@shaftnet.org>2013-06-02 11:35:31 -0400
committerJohn W. Linville <linville@tuxdriver.com>2013-06-03 15:54:55 -0400
commit7c0b6f49dbea0b09b1de8aa5c942af9c2ad8b54c (patch)
tree23b8516e6302ded0d194b05aa10dfa50b6674839 /drivers
parent6dd64a304eff76ca7dd41bf63df55efa965fa9ec (diff)
cw1200: Rework SDIO platform support to prevent build problems.
Based on discussions with And Bergmann, this patch changes the SDIO platform code to default to supporting the Sagrad devices, allowing for it to be overridden in board setup code. This renders the cw1200_sagrad module suplerflous, so it is now removed. It also moves the documentation that was in the cw1200_sagrad source to the platform header. Signed-off-by: Solomon Peachy <pizza@shaftnet.org> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/cw1200/Kconfig17
-rw-r--r--drivers/net/wireless/cw1200/Makefile2
-rw-r--r--drivers/net/wireless/cw1200/cw1200_sagrad.c106
-rw-r--r--drivers/net/wireless/cw1200/cw1200_sdio.c26
4 files changed, 30 insertions, 121 deletions
diff --git a/drivers/net/wireless/cw1200/Kconfig b/drivers/net/wireless/cw1200/Kconfig
index 13e36119ae9f..7a585d4e9c8e 100644
--- a/drivers/net/wireless/cw1200/Kconfig
+++ b/drivers/net/wireless/cw1200/Kconfig
@@ -13,20 +13,19 @@ config CW1200_WLAN_SDIO
13 depends on CW1200 && MMC 13 depends on CW1200 && MMC
14 help 14 help
15 Enable support for the CW1200 connected via an SDIO bus. 15 Enable support for the CW1200 connected via an SDIO bus.
16 By default this driver only supports the Sagrad SG901-1091/1098 EVK
17 and similar designs that utilize a hardware reset circuit. To
18 support different CW1200 SDIO designs you will need to override
19 the default platform data by calling cw1200_sdio_set_platform_data()
20 in your board setup file.
16 21
17config CW1200_WLAN_SPI 22config CW1200_WLAN_SPI
18 tristate "Support SPI platforms" 23 tristate "Support SPI platforms"
19 depends on CW1200 && SPI 24 depends on CW1200 && SPI
20 help 25 help
21 Enables support for the CW1200 connected via a SPI bus. 26 Enables support for the CW1200 connected via a SPI bus. You will
22 27 need to add appropriate platform data glue in your board setup
23config CW1200_WLAN_SAGRAD 28 file.
24 tristate "Support Sagrad SG901-1091/1098 modules"
25 depends on CW1200_WLAN_SDIO
26 help
27 This provides the platform data glue to support the
28 Sagrad SG901-1091/1098 modules in their standard SDIO EVK.
29 It also includes example SPI platform data.
30 29
31menu "Driver debug features" 30menu "Driver debug features"
32 depends on CW1200 && DEBUG_FS 31 depends on CW1200 && DEBUG_FS
diff --git a/drivers/net/wireless/cw1200/Makefile b/drivers/net/wireless/cw1200/Makefile
index 1aa3682066e0..bc6cbf91f26e 100644
--- a/drivers/net/wireless/cw1200/Makefile
+++ b/drivers/net/wireless/cw1200/Makefile
@@ -16,9 +16,7 @@ cw1200_core-$(CONFIG_PM) += pm.o
16 16
17cw1200_wlan_sdio-y := cw1200_sdio.o 17cw1200_wlan_sdio-y := cw1200_sdio.o
18cw1200_wlan_spi-y := cw1200_spi.o 18cw1200_wlan_spi-y := cw1200_spi.o
19cw1200_wlan_sagrad-y := cw1200_sagrad.o
20 19
21obj-$(CONFIG_CW1200) += cw1200_core.o 20obj-$(CONFIG_CW1200) += cw1200_core.o
22obj-$(CONFIG_CW1200_WLAN_SDIO) += cw1200_wlan_sdio.o 21obj-$(CONFIG_CW1200_WLAN_SDIO) += cw1200_wlan_sdio.o
23obj-$(CONFIG_CW1200_WLAN_SPI) += cw1200_wlan_spi.o 22obj-$(CONFIG_CW1200_WLAN_SPI) += cw1200_wlan_spi.o
24obj-$(CONFIG_CW1200_WLAN_SAGRAD) += cw1200_wlan_sagrad.o
diff --git a/drivers/net/wireless/cw1200/cw1200_sagrad.c b/drivers/net/wireless/cw1200/cw1200_sagrad.c
deleted file mode 100644
index 3f884ac96ccc..000000000000
--- a/drivers/net/wireless/cw1200/cw1200_sagrad.c
+++ /dev/null
@@ -1,106 +0,0 @@
1/*
2 * Platform glue data for ST-Ericsson CW1200 driver
3 *
4 * Copyright (c) 2013, Sagrad, Inc
5 * Author: Solomon Peachy <speachy@sagrad.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#include <linux/module.h>
13#include <linux/platform_data/cw1200_platform.h>
14
15MODULE_AUTHOR("Solomon Peachy <speachy@sagrad.com>");
16MODULE_DESCRIPTION("ST-Ericsson CW1200 Platform glue driver");
17MODULE_LICENSE("GPL");
18
19/* Define just one of these. Feel free to customize as needed */
20#define SAGRAD_1091_1098_EVK_SDIO
21/* #define SAGRAD_1091_1098_EVK_SPI */
22
23#ifdef SAGRAD_1091_1098_EVK_SDIO
24static int cw1200_power_ctrl(const struct cw1200_platform_data_sdio *pdata,
25 bool enable)
26{
27 /* Control 3v3 and 1v8 to hardware as appropriate */
28 /* Note this is not needed if it's controlled elsewhere or always on */
29
30 /* May require delay for power to stabilize */
31 return 0;
32}
33
34static int cw1200_clk_ctrl(const struct cw1200_platform_data_sdio *pdata,
35 bool enable)
36{
37 /* Turn CLK_32K off and on as appropriate. */
38 /* Note this is not needed if it's always on */
39
40 /* May require delay for clock to stabilize */
41 return 0;
42}
43
44static struct cw1200_platform_data_sdio cw1200_platform_data = {
45 .ref_clk = 38400,
46 .have_5ghz = false,
47#if 0
48 .reset = GPIO_RF_RESET, /* Replace as appropriate */
49 .powerup = GPIO_RF_POWERUP, /* Replace as appropriate */
50 .irq = GPIO_TO_IRQ(GPIO_RF_IRQ), /* Replace as appropriate */
51#endif
52 .power_ctrl = cw1200_power_ctrl,
53 .clk_ctrl = cw1200_clk_ctrl,
54/* .macaddr = ??? */
55 .sdd_file = "sdd_sagrad_1091_1098.bin",
56};
57#endif
58
59#ifdef SAGRAD_1091_1098_EVK_SPI
60static int cw1200_power_ctrl(const struct cw1200_platform_data_spi *pdata,
61 bool enable)
62{
63 /* Control 3v3 and 1v8 to hardware as appropriate */
64 /* Note this is not needed if it's controlled elsewhere or always on */
65
66 /* May require delay for power to stabilize */
67 return 0;
68}
69static int cw1200_clk_ctrl(const struct cw1200_platform_data_spi *pdata,
70 bool enable)
71{
72 /* Turn CLK_32K off and on as appropriate. */
73 /* Note this is not needed if it's always on */
74
75 /* May require delay for clock to stabilize */
76 return 0;
77}
78
79static struct cw1200_platform_data_spi cw1200_platform_data = {
80 .ref_clk = 38400,
81 .spi_bits_per_word = 16,
82 .reset = GPIO_RF_RESET, /* Replace as appropriate */
83 .powerup = GPIO_RF_POWERUP, /* Replace as appropriate */
84 .power_ctrl = cw1200_power_ctrl,
85 .clk_ctrl = cw1200_clk_ctrl,
86/* .macaddr = ??? */
87 .sdd_file = "sdd_sagrad_1091_1098.bin",
88};
89static struct spi_board_info myboard_spi_devices[] __initdata = {
90 {
91 .modalias = "cw1200_wlan_spi",
92 .max_speed_hz = 10000000, /* 52MHz Max */
93 .bus_num = 0,
94 .irq = WIFI_IRQ,
95 .platform_data = &cw1200_platform_data,
96 .chip_select = 0,
97 },
98};
99#endif
100
101
102const void *cw1200_get_platform_data(void)
103{
104 return &cw1200_platform_data;
105}
106EXPORT_SYMBOL_GPL(cw1200_get_platform_data);
diff --git a/drivers/net/wireless/cw1200/cw1200_sdio.c b/drivers/net/wireless/cw1200/cw1200_sdio.c
index 574cf727567c..4b3148e47ee7 100644
--- a/drivers/net/wireless/cw1200/cw1200_sdio.c
+++ b/drivers/net/wireless/cw1200/cw1200_sdio.c
@@ -29,6 +29,21 @@ MODULE_LICENSE("GPL");
29 29
30#define SDIO_BLOCK_SIZE (512) 30#define SDIO_BLOCK_SIZE (512)
31 31
32/* Default platform data for Sagrad modules */
33static struct cw1200_platform_data_sdio sagrad_109x_evk_platform_data = {
34 .ref_clk = 38400,
35 .have_5ghz = false,
36 .sdd_file = "sdd_sagrad_1091_1098.bin",
37};
38
39/* Allow platform data to be overridden */
40static struct cw1200_platform_data_sdio *global_plat_data = &sagrad_109x_evk_platform_data;
41
42void __init cw1200_sdio_set_platform_data(struct cw1200_platform_data_sdio *pdata)
43{
44 global_plat_data = pdata;
45}
46
32struct hwbus_priv { 47struct hwbus_priv {
33 struct sdio_func *func; 48 struct sdio_func *func;
34 struct cw1200_common *core; 49 struct cw1200_common *core;
@@ -261,7 +276,7 @@ static struct hwbus_ops cw1200_sdio_hwbus_ops = {
261 276
262/* Probe Function to be called by SDIO stack when device is discovered */ 277/* Probe Function to be called by SDIO stack when device is discovered */
263static int cw1200_sdio_probe(struct sdio_func *func, 278static int cw1200_sdio_probe(struct sdio_func *func,
264 const struct sdio_device_id *id) 279 const struct sdio_device_id *id)
265{ 280{
266 struct hwbus_priv *self; 281 struct hwbus_priv *self;
267 int status; 282 int status;
@@ -280,7 +295,7 @@ static int cw1200_sdio_probe(struct sdio_func *func,
280 295
281 func->card->quirks |= MMC_QUIRK_LENIENT_FN0; 296 func->card->quirks |= MMC_QUIRK_LENIENT_FN0;
282 297
283 self->pdata = cw1200_get_platform_data(); 298 self->pdata = global_plat_data; /* FIXME */
284 self->func = func; 299 self->func = func;
285 sdio_set_drvdata(func, self); 300 sdio_set_drvdata(func, self);
286 sdio_claim_host(func); 301 sdio_claim_host(func);
@@ -374,7 +389,8 @@ static int __init cw1200_sdio_init(void)
374 const struct cw1200_platform_data_sdio *pdata; 389 const struct cw1200_platform_data_sdio *pdata;
375 int ret; 390 int ret;
376 391
377 pdata = cw1200_get_platform_data(); 392 /* FIXME -- this won't support multiple devices */
393 pdata = global_plat_data;
378 394
379 if (cw1200_sdio_on(pdata)) { 395 if (cw1200_sdio_on(pdata)) {
380 ret = -1; 396 ret = -1;
@@ -396,7 +412,9 @@ err:
396static void __exit cw1200_sdio_exit(void) 412static void __exit cw1200_sdio_exit(void)
397{ 413{
398 const struct cw1200_platform_data_sdio *pdata; 414 const struct cw1200_platform_data_sdio *pdata;
399 pdata = cw1200_get_platform_data(); 415
416 /* FIXME -- this won't support multiple devices */
417 pdata = global_plat_data;
400 sdio_unregister_driver(&sdio_driver); 418 sdio_unregister_driver(&sdio_driver);
401 cw1200_sdio_off(pdata); 419 cw1200_sdio_off(pdata);
402} 420}