summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLuciano Coelho <coelho@ti.com>2014-02-14 18:05:52 -0500
committerJohn W. Linville <linville@tuxdriver.com>2014-02-28 14:08:26 -0500
commit946651cba26779864bcdbd7e12502f5a36c2de37 (patch)
tree55c97ba2440833a39c89faff4c1177ecd0c03189
parentef1b4141d0430583743a6045901e4d1a73557a33 (diff)
wl1251: split wl251 platform data to a separate structure
Move the wl1251 part of the wl12xx platform data structure into a new structure specifically for wl1251. Change the platform data built-in block and board files accordingly. Signed-off-by: Luciano Coelho <coelho@ti.com> Acked-by: Tony Lindgren <tony@atomide.com> Reviewed-by: Felipe Balbi <balbi@ti.com> Reviewed-by: Sebastian Reichel <sre@debian.org> Reviewed-by: Pavel Machek <pavel@ucw.cz> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--arch/arm/mach-omap2/board-omap3pandora.c4
-rw-r--r--arch/arm/mach-omap2/board-rx51-peripherals.c2
-rw-r--r--drivers/net/wireless/ti/wilink_platform_data.c37
-rw-r--r--drivers/net/wireless/ti/wl1251/sdio.c12
-rw-r--r--drivers/net/wireless/ti/wl1251/spi.c2
-rw-r--r--include/linux/wl12xx.h22
6 files changed, 62 insertions, 17 deletions
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index de1bc6bbe585..24f3c1be69a5 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -536,7 +536,7 @@ static struct spi_board_info omap3pandora_spi_board_info[] __initdata = {
536 536
537static void __init pandora_wl1251_init(void) 537static void __init pandora_wl1251_init(void)
538{ 538{
539 struct wl12xx_platform_data pandora_wl1251_pdata; 539 struct wl1251_platform_data pandora_wl1251_pdata;
540 int ret; 540 int ret;
541 541
542 memset(&pandora_wl1251_pdata, 0, sizeof(pandora_wl1251_pdata)); 542 memset(&pandora_wl1251_pdata, 0, sizeof(pandora_wl1251_pdata));
@@ -550,7 +550,7 @@ static void __init pandora_wl1251_init(void)
550 goto fail_irq; 550 goto fail_irq;
551 551
552 pandora_wl1251_pdata.use_eeprom = true; 552 pandora_wl1251_pdata.use_eeprom = true;
553 ret = wl12xx_set_platform_data(&pandora_wl1251_pdata); 553 ret = wl1251_set_platform_data(&pandora_wl1251_pdata);
554 if (ret < 0) 554 if (ret < 0)
555 goto fail_irq; 555 goto fail_irq;
556 556
diff --git a/arch/arm/mach-omap2/board-rx51-peripherals.c b/arch/arm/mach-omap2/board-rx51-peripherals.c
index 8760bbe3baab..e05e740a4426 100644
--- a/arch/arm/mach-omap2/board-rx51-peripherals.c
+++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
@@ -84,7 +84,7 @@ enum {
84 RX51_SPI_MIPID, /* LCD panel */ 84 RX51_SPI_MIPID, /* LCD panel */
85}; 85};
86 86
87static struct wl12xx_platform_data wl1251_pdata; 87static struct wl1251_platform_data wl1251_pdata;
88static struct tsc2005_platform_data tsc2005_pdata; 88static struct tsc2005_platform_data tsc2005_pdata;
89 89
90#if defined(CONFIG_SENSORS_LIS3_I2C) || defined(CONFIG_SENSORS_LIS3_I2C_MODULE) 90#if defined(CONFIG_SENSORS_LIS3_I2C) || defined(CONFIG_SENSORS_LIS3_I2C_MODULE)
diff --git a/drivers/net/wireless/ti/wilink_platform_data.c b/drivers/net/wireless/ti/wilink_platform_data.c
index 998e95895f9d..a92bd3e89796 100644
--- a/drivers/net/wireless/ti/wilink_platform_data.c
+++ b/drivers/net/wireless/ti/wilink_platform_data.c
@@ -23,17 +23,17 @@
23#include <linux/err.h> 23#include <linux/err.h>
24#include <linux/wl12xx.h> 24#include <linux/wl12xx.h>
25 25
26static struct wl12xx_platform_data *platform_data; 26static struct wl12xx_platform_data *wl12xx_platform_data;
27 27
28int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data) 28int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
29{ 29{
30 if (platform_data) 30 if (wl12xx_platform_data)
31 return -EBUSY; 31 return -EBUSY;
32 if (!data) 32 if (!data)
33 return -EINVAL; 33 return -EINVAL;
34 34
35 platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL); 35 wl12xx_platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
36 if (!platform_data) 36 if (!wl12xx_platform_data)
37 return -ENOMEM; 37 return -ENOMEM;
38 38
39 return 0; 39 return 0;
@@ -41,9 +41,34 @@ int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
41 41
42struct wl12xx_platform_data *wl12xx_get_platform_data(void) 42struct wl12xx_platform_data *wl12xx_get_platform_data(void)
43{ 43{
44 if (!platform_data) 44 if (!wl12xx_platform_data)
45 return ERR_PTR(-ENODEV); 45 return ERR_PTR(-ENODEV);
46 46
47 return platform_data; 47 return wl12xx_platform_data;
48} 48}
49EXPORT_SYMBOL(wl12xx_get_platform_data); 49EXPORT_SYMBOL(wl12xx_get_platform_data);
50
51static struct wl1251_platform_data *wl1251_platform_data;
52
53int __init wl1251_set_platform_data(const struct wl1251_platform_data *data)
54{
55 if (wl1251_platform_data)
56 return -EBUSY;
57 if (!data)
58 return -EINVAL;
59
60 wl1251_platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
61 if (!wl1251_platform_data)
62 return -ENOMEM;
63
64 return 0;
65}
66
67struct wl1251_platform_data *wl1251_get_platform_data(void)
68{
69 if (!wl1251_platform_data)
70 return ERR_PTR(-ENODEV);
71
72 return wl1251_platform_data;
73}
74EXPORT_SYMBOL(wl1251_get_platform_data);
diff --git a/drivers/net/wireless/ti/wl1251/sdio.c b/drivers/net/wireless/ti/wl1251/sdio.c
index e2b3d9c541e8..b75a37a58313 100644
--- a/drivers/net/wireless/ti/wl1251/sdio.c
+++ b/drivers/net/wireless/ti/wl1251/sdio.c
@@ -227,7 +227,7 @@ static int wl1251_sdio_probe(struct sdio_func *func,
227 struct wl1251 *wl; 227 struct wl1251 *wl;
228 struct ieee80211_hw *hw; 228 struct ieee80211_hw *hw;
229 struct wl1251_sdio *wl_sdio; 229 struct wl1251_sdio *wl_sdio;
230 const struct wl12xx_platform_data *wl12xx_board_data; 230 const struct wl1251_platform_data *wl1251_board_data;
231 231
232 hw = wl1251_alloc_hw(); 232 hw = wl1251_alloc_hw();
233 if (IS_ERR(hw)) 233 if (IS_ERR(hw))
@@ -254,11 +254,11 @@ static int wl1251_sdio_probe(struct sdio_func *func,
254 wl->if_priv = wl_sdio; 254 wl->if_priv = wl_sdio;
255 wl->if_ops = &wl1251_sdio_ops; 255 wl->if_ops = &wl1251_sdio_ops;
256 256
257 wl12xx_board_data = wl12xx_get_platform_data(); 257 wl1251_board_data = wl1251_get_platform_data();
258 if (!IS_ERR(wl12xx_board_data)) { 258 if (!IS_ERR(wl1251_board_data)) {
259 wl->set_power = wl12xx_board_data->set_power; 259 wl->set_power = wl1251_board_data->set_power;
260 wl->irq = wl12xx_board_data->irq; 260 wl->irq = wl1251_board_data->irq;
261 wl->use_eeprom = wl12xx_board_data->use_eeprom; 261 wl->use_eeprom = wl1251_board_data->use_eeprom;
262 } 262 }
263 263
264 if (wl->irq) { 264 if (wl->irq) {
diff --git a/drivers/net/wireless/ti/wl1251/spi.c b/drivers/net/wireless/ti/wl1251/spi.c
index 1342f81e683d..62403a147592 100644
--- a/drivers/net/wireless/ti/wl1251/spi.c
+++ b/drivers/net/wireless/ti/wl1251/spi.c
@@ -238,7 +238,7 @@ static const struct wl1251_if_operations wl1251_spi_ops = {
238 238
239static int wl1251_spi_probe(struct spi_device *spi) 239static int wl1251_spi_probe(struct spi_device *spi)
240{ 240{
241 struct wl12xx_platform_data *pdata; 241 struct wl1251_platform_data *pdata;
242 struct ieee80211_hw *hw; 242 struct ieee80211_hw *hw;
243 struct wl1251 *wl; 243 struct wl1251 *wl;
244 int ret; 244 int ret;
diff --git a/include/linux/wl12xx.h b/include/linux/wl12xx.h
index a54fe82e704b..b516b4fa22de 100644
--- a/include/linux/wl12xx.h
+++ b/include/linux/wl12xx.h
@@ -48,11 +48,15 @@ enum {
48 WL12XX_TCXOCLOCK_33_6 = 7, /* 33.6 MHz */ 48 WL12XX_TCXOCLOCK_33_6 = 7, /* 33.6 MHz */
49}; 49};
50 50
51struct wl12xx_platform_data { 51struct wl1251_platform_data {
52 void (*set_power)(bool enable); 52 void (*set_power)(bool enable);
53 /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */ 53 /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
54 int irq; 54 int irq;
55 bool use_eeprom; 55 bool use_eeprom;
56};
57
58struct wl12xx_platform_data {
59 int irq;
56 int board_ref_clock; 60 int board_ref_clock;
57 int board_tcxo_clock; 61 int board_tcxo_clock;
58 unsigned long platform_quirks; 62 unsigned long platform_quirks;
@@ -68,6 +72,10 @@ int wl12xx_set_platform_data(const struct wl12xx_platform_data *data);
68 72
69struct wl12xx_platform_data *wl12xx_get_platform_data(void); 73struct wl12xx_platform_data *wl12xx_get_platform_data(void);
70 74
75int wl1251_set_platform_data(const struct wl1251_platform_data *data);
76
77struct wl1251_platform_data *wl1251_get_platform_data(void);
78
71#else 79#else
72 80
73static inline 81static inline
@@ -82,6 +90,18 @@ struct wl12xx_platform_data *wl12xx_get_platform_data(void)
82 return ERR_PTR(-ENODATA); 90 return ERR_PTR(-ENODATA);
83} 91}
84 92
93static inline
94int wl1251_set_platform_data(const struct wl1251_platform_data *data)
95{
96 return -ENOSYS;
97}
98
99static inline
100struct wl1251_platform_data *wl1251_get_platform_data(void)
101{
102 return ERR_PTR(-ENODATA);
103}
104
85#endif 105#endif
86 106
87#endif 107#endif