[omap]: add 3.13 support
[openwrt.git] / target / linux / omap / patches-3.13 / 900-wl1251-split-wl251-platform-data-to-a-separate-structure.patch
1 Move the wl1251 part of the wl12xx platform data structure into a new
2 structure specifically for wl1251.  Change the platform data built-in
3 block and board files accordingly.
4
5 Cc: Tony Lindgren <tony@atomide.com>
6 Signed-off-by: Luciano Coelho <coelho@ti.com>
7 Acked-by: Tony Lindgren <tony@atomide.com>
8 Reviewed-by: Felipe Balbi <balbi@ti.com>
9
10 ---
11  arch/arm/mach-omap2/board-omap3pandora.c       |  4 +--
12  arch/arm/mach-omap2/board-rx51-peripherals.c   |  2 +-
13  drivers/net/wireless/ti/wilink_platform_data.c | 37 +++++++++++++++++++++-----
14  drivers/net/wireless/ti/wl1251/sdio.c          | 12 ++++-----
15  drivers/net/wireless/ti/wl1251/spi.c           |  2 +-
16  include/linux/wl12xx.h                         | 22 ++++++++++++++-
17  6 files changed, 62 insertions(+), 17 deletions(-)
18
19 --- a/arch/arm/mach-omap2/board-omap3pandora.c
20 +++ b/arch/arm/mach-omap2/board-omap3pandora.c
21 @@ -536,7 +536,7 @@ static struct spi_board_info omap3pandor
22  
23  static void __init pandora_wl1251_init(void)
24  {
25 -       struct wl12xx_platform_data pandora_wl1251_pdata;
26 +       struct wl1251_platform_data pandora_wl1251_pdata;
27         int ret;
28  
29         memset(&pandora_wl1251_pdata, 0, sizeof(pandora_wl1251_pdata));
30 @@ -550,7 +550,7 @@ static void __init pandora_wl1251_init(v
31                 goto fail_irq;
32  
33         pandora_wl1251_pdata.use_eeprom = true;
34 -       ret = wl12xx_set_platform_data(&pandora_wl1251_pdata);
35 +       ret = wl1251_set_platform_data(&pandora_wl1251_pdata);
36         if (ret < 0)
37                 goto fail_irq;
38  
39 --- a/arch/arm/mach-omap2/board-rx51-peripherals.c
40 +++ b/arch/arm/mach-omap2/board-rx51-peripherals.c
41 @@ -84,7 +84,7 @@ enum {
42         RX51_SPI_MIPID,         /* LCD panel */
43  };
44  
45 -static struct wl12xx_platform_data wl1251_pdata;
46 +static struct wl1251_platform_data wl1251_pdata;
47  static struct tsc2005_platform_data tsc2005_pdata;
48  
49  #if defined(CONFIG_SENSORS_LIS3_I2C) || defined(CONFIG_SENSORS_LIS3_I2C_MODULE)
50 --- a/drivers/net/wireless/ti/wilink_platform_data.c
51 +++ b/drivers/net/wireless/ti/wilink_platform_data.c
52 @@ -23,17 +23,17 @@
53  #include <linux/err.h>
54  #include <linux/wl12xx.h>
55  
56 -static struct wl12xx_platform_data *platform_data;
57 +static struct wl12xx_platform_data *wl12xx_platform_data;
58  
59  int __init wl12xx_set_platform_data(const struct wl12xx_platform_data *data)
60  {
61 -       if (platform_data)
62 +       if (wl12xx_platform_data)
63                 return -EBUSY;
64         if (!data)
65                 return -EINVAL;
66  
67 -       platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
68 -       if (!platform_data)
69 +       wl12xx_platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
70 +       if (!wl12xx_platform_data)
71                 return -ENOMEM;
72  
73         return 0;
74 @@ -41,9 +41,34 @@ int __init wl12xx_set_platform_data(cons
75  
76  struct wl12xx_platform_data *wl12xx_get_platform_data(void)
77  {
78 -       if (!platform_data)
79 +       if (!wl12xx_platform_data)
80                 return ERR_PTR(-ENODEV);
81  
82 -       return platform_data;
83 +       return wl12xx_platform_data;
84  }
85  EXPORT_SYMBOL(wl12xx_get_platform_data);
86 +
87 +static struct wl1251_platform_data *wl1251_platform_data;
88 +
89 +int __init wl1251_set_platform_data(const struct wl1251_platform_data *data)
90 +{
91 +       if (wl1251_platform_data)
92 +               return -EBUSY;
93 +       if (!data)
94 +               return -EINVAL;
95 +
96 +       wl1251_platform_data = kmemdup(data, sizeof(*data), GFP_KERNEL);
97 +       if (!wl1251_platform_data)
98 +               return -ENOMEM;
99 +
100 +       return 0;
101 +}
102 +
103 +struct wl1251_platform_data *wl1251_get_platform_data(void)
104 +{
105 +       if (!wl1251_platform_data)
106 +               return ERR_PTR(-ENODEV);
107 +
108 +       return wl1251_platform_data;
109 +}
110 +EXPORT_SYMBOL(wl1251_get_platform_data);
111 --- a/drivers/net/wireless/ti/wl1251/sdio.c
112 +++ b/drivers/net/wireless/ti/wl1251/sdio.c
113 @@ -227,7 +227,7 @@ static int wl1251_sdio_probe(struct sdio
114         struct wl1251 *wl;
115         struct ieee80211_hw *hw;
116         struct wl1251_sdio *wl_sdio;
117 -       const struct wl12xx_platform_data *wl12xx_board_data;
118 +       const struct wl1251_platform_data *wl1251_board_data;
119  
120         hw = wl1251_alloc_hw();
121         if (IS_ERR(hw))
122 @@ -254,11 +254,11 @@ static int wl1251_sdio_probe(struct sdio
123         wl->if_priv = wl_sdio;
124         wl->if_ops = &wl1251_sdio_ops;
125  
126 -       wl12xx_board_data = wl12xx_get_platform_data();
127 -       if (!IS_ERR(wl12xx_board_data)) {
128 -               wl->set_power = wl12xx_board_data->set_power;
129 -               wl->irq = wl12xx_board_data->irq;
130 -               wl->use_eeprom = wl12xx_board_data->use_eeprom;
131 +       wl1251_board_data = wl1251_get_platform_data();
132 +       if (!IS_ERR(wl1251_board_data)) {
133 +               wl->set_power = wl1251_board_data->set_power;
134 +               wl->irq = wl1251_board_data->irq;
135 +               wl->use_eeprom = wl1251_board_data->use_eeprom;
136         }
137  
138         if (wl->irq) {
139 --- a/drivers/net/wireless/ti/wl1251/spi.c
140 +++ b/drivers/net/wireless/ti/wl1251/spi.c
141 @@ -238,7 +238,7 @@ static const struct wl1251_if_operations
142  
143  static int wl1251_spi_probe(struct spi_device *spi)
144  {
145 -       struct wl12xx_platform_data *pdata;
146 +       struct wl1251_platform_data *pdata;
147         struct ieee80211_hw *hw;
148         struct wl1251 *wl;
149         int ret;
150 --- a/include/linux/wl12xx.h
151 +++ b/include/linux/wl12xx.h
152 @@ -48,11 +48,15 @@ enum {
153         WL12XX_TCXOCLOCK_33_6   = 7, /* 33.6 MHz */
154  };
155  
156 -struct wl12xx_platform_data {
157 +struct wl1251_platform_data {
158         void (*set_power)(bool enable);
159         /* SDIO only: IRQ number if WLAN_IRQ line is used, 0 for SDIO IRQs */
160         int irq;
161         bool use_eeprom;
162 +};
163 +
164 +struct wl12xx_platform_data {
165 +       int irq;
166         int board_ref_clock;
167         int board_tcxo_clock;
168         unsigned long platform_quirks;
169 @@ -68,6 +72,10 @@ int wl12xx_set_platform_data(const struc
170  
171  struct wl12xx_platform_data *wl12xx_get_platform_data(void);
172  
173 +int wl1251_set_platform_data(const struct wl1251_platform_data *data);
174 +
175 +struct wl1251_platform_data *wl1251_get_platform_data(void);
176 +
177  #else
178  
179  static inline
180 @@ -81,6 +89,18 @@ struct wl12xx_platform_data *wl12xx_get_
181  {
182         return ERR_PTR(-ENODATA);
183  }
184 +
185 +static inline
186 +int wl1251_set_platform_data(const struct wl1251_platform_data *data)
187 +{
188 +       return -ENOSYS;
189 +}
190 +
191 +static inline
192 +struct wl1251_platform_data *wl1251_get_platform_data(void)
193 +{
194 +       return ERR_PTR(-ENODATA);
195 +}
196  
197  #endif
198