diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/cw1200/cw1200_sagrad.c | 49 | ||||
-rw-r--r-- | drivers/net/wireless/cw1200/cw1200_sdio.c | 50 | ||||
-rw-r--r-- | drivers/net/wireless/cw1200/cw1200_spi.c | 33 |
3 files changed, 41 insertions, 91 deletions
diff --git a/drivers/net/wireless/cw1200/cw1200_sagrad.c b/drivers/net/wireless/cw1200/cw1200_sagrad.c index 14c2a186b493..3f884ac96ccc 100644 --- a/drivers/net/wireless/cw1200/cw1200_sagrad.c +++ b/drivers/net/wireless/cw1200/cw1200_sagrad.c | |||
@@ -21,29 +21,6 @@ MODULE_LICENSE("GPL"); | |||
21 | /* #define SAGRAD_1091_1098_EVK_SPI */ | 21 | /* #define SAGRAD_1091_1098_EVK_SPI */ |
22 | 22 | ||
23 | #ifdef SAGRAD_1091_1098_EVK_SDIO | 23 | #ifdef SAGRAD_1091_1098_EVK_SDIO |
24 | #if 0 | ||
25 | static struct resource cw1200_href_resources[] = { | ||
26 | { | ||
27 | .start = 215, /* fix me as appropriate */ | ||
28 | .end = 215, /* ditto */ | ||
29 | .flags = IORESOURCE_IO, | ||
30 | .name = "cw1200_wlan_reset", | ||
31 | }, | ||
32 | { | ||
33 | .start = 216, /* fix me as appropriate */ | ||
34 | .end = 216, /* ditto */ | ||
35 | .flags = IORESOURCE_IO, | ||
36 | .name = "cw1200_wlan_powerup", | ||
37 | }, | ||
38 | { | ||
39 | .start = NOMADIK_GPIO_TO_IRQ(216), /* fix me as appropriate */ | ||
40 | .end = NOMADIK_GPIO_TO_IRQ(216), /* ditto */ | ||
41 | .flags = IORESOURCE_IRQ, | ||
42 | .name = "cw1200_wlan_irq", | ||
43 | }, | ||
44 | }; | ||
45 | #endif | ||
46 | |||
47 | static int cw1200_power_ctrl(const struct cw1200_platform_data_sdio *pdata, | 24 | static int cw1200_power_ctrl(const struct cw1200_platform_data_sdio *pdata, |
48 | bool enable) | 25 | bool enable) |
49 | { | 26 | { |
@@ -68,9 +45,9 @@ static struct cw1200_platform_data_sdio cw1200_platform_data = { | |||
68 | .ref_clk = 38400, | 45 | .ref_clk = 38400, |
69 | .have_5ghz = false, | 46 | .have_5ghz = false, |
70 | #if 0 | 47 | #if 0 |
71 | .reset = &cw1200_href_resources[0], | 48 | .reset = GPIO_RF_RESET, /* Replace as appropriate */ |
72 | .powerup = &cw1200_href_resources[1], | 49 | .powerup = GPIO_RF_POWERUP, /* Replace as appropriate */ |
73 | .irq = &cw1200_href_resources[2], | 50 | .irq = GPIO_TO_IRQ(GPIO_RF_IRQ), /* Replace as appropriate */ |
74 | #endif | 51 | #endif |
75 | .power_ctrl = cw1200_power_ctrl, | 52 | .power_ctrl = cw1200_power_ctrl, |
76 | .clk_ctrl = cw1200_clk_ctrl, | 53 | .clk_ctrl = cw1200_clk_ctrl, |
@@ -80,22 +57,6 @@ static struct cw1200_platform_data_sdio cw1200_platform_data = { | |||
80 | #endif | 57 | #endif |
81 | 58 | ||
82 | #ifdef SAGRAD_1091_1098_EVK_SPI | 59 | #ifdef SAGRAD_1091_1098_EVK_SPI |
83 | /* Note that this is an example of integrating into your board support file */ | ||
84 | static struct resource cw1200_href_resources[] = { | ||
85 | { | ||
86 | .start = GPIO_RF_RESET, | ||
87 | .end = GPIO_RF_RESET, | ||
88 | .flags = IORESOURCE_IO, | ||
89 | .name = "cw1200_wlan_reset", | ||
90 | }, | ||
91 | { | ||
92 | .start = GPIO_RF_POWERUP, | ||
93 | .end = GPIO_RF_POWERUP, | ||
94 | .flags = IORESOURCE_IO, | ||
95 | .name = "cw1200_wlan_powerup", | ||
96 | }, | ||
97 | }; | ||
98 | |||
99 | static int cw1200_power_ctrl(const struct cw1200_platform_data_spi *pdata, | 60 | static int cw1200_power_ctrl(const struct cw1200_platform_data_spi *pdata, |
100 | bool enable) | 61 | bool enable) |
101 | { | 62 | { |
@@ -118,8 +79,8 @@ static int cw1200_clk_ctrl(const struct cw1200_platform_data_spi *pdata, | |||
118 | static struct cw1200_platform_data_spi cw1200_platform_data = { | 79 | static struct cw1200_platform_data_spi cw1200_platform_data = { |
119 | .ref_clk = 38400, | 80 | .ref_clk = 38400, |
120 | .spi_bits_per_word = 16, | 81 | .spi_bits_per_word = 16, |
121 | .reset = &cw1200_href_resources[0], | 82 | .reset = GPIO_RF_RESET, /* Replace as appropriate */ |
122 | .powerup = &cw1200_href_resources[1], | 83 | .powerup = GPIO_RF_POWERUP, /* Replace as appropriate */ |
123 | .power_ctrl = cw1200_power_ctrl, | 84 | .power_ctrl = cw1200_power_ctrl, |
124 | .clk_ctrl = cw1200_clk_ctrl, | 85 | .clk_ctrl = cw1200_clk_ctrl, |
125 | /* .macaddr = ??? */ | 86 | /* .macaddr = ??? */ |
diff --git a/drivers/net/wireless/cw1200/cw1200_sdio.c b/drivers/net/wireless/cw1200/cw1200_sdio.c index 0a882ca89bbb..574cf727567c 100644 --- a/drivers/net/wireless/cw1200/cw1200_sdio.c +++ b/drivers/net/wireless/cw1200/cw1200_sdio.c | |||
@@ -105,7 +105,6 @@ static irqreturn_t cw1200_gpio_irq(int irq, void *dev_id) | |||
105 | static int cw1200_request_irq(struct hwbus_priv *self) | 105 | static int cw1200_request_irq(struct hwbus_priv *self) |
106 | { | 106 | { |
107 | int ret; | 107 | int ret; |
108 | const struct resource *irq = self->pdata->irq; | ||
109 | u8 cccr; | 108 | u8 cccr; |
110 | 109 | ||
111 | cccr = sdio_f0_readb(self->func, SDIO_CCCR_IENx, &ret); | 110 | cccr = sdio_f0_readb(self->func, SDIO_CCCR_IENx, &ret); |
@@ -122,15 +121,15 @@ static int cw1200_request_irq(struct hwbus_priv *self) | |||
122 | if (WARN_ON(ret)) | 121 | if (WARN_ON(ret)) |
123 | goto err; | 122 | goto err; |
124 | 123 | ||
125 | ret = enable_irq_wake(irq->start); | 124 | ret = enable_irq_wake(self->pdata->irq); |
126 | if (WARN_ON(ret)) | 125 | if (WARN_ON(ret)) |
127 | goto err; | 126 | goto err; |
128 | 127 | ||
129 | /* Request the IRQ */ | 128 | /* Request the IRQ */ |
130 | ret = request_threaded_irq(irq->start, cw1200_gpio_hardirq, | 129 | ret = request_threaded_irq(self->pdata->irq, cw1200_gpio_hardirq, |
131 | cw1200_gpio_irq, | 130 | cw1200_gpio_irq, |
132 | IRQF_TRIGGER_HIGH | IRQF_ONESHOT, | 131 | IRQF_TRIGGER_HIGH | IRQF_ONESHOT, |
133 | irq->name, self); | 132 | "cw1200_wlan_irq", self); |
134 | if (WARN_ON(ret)) | 133 | if (WARN_ON(ret)) |
135 | goto err; | 134 | goto err; |
136 | 135 | ||
@@ -162,8 +161,8 @@ static int cw1200_sdio_irq_unsubscribe(struct hwbus_priv *self) | |||
162 | pr_debug("SW IRQ unsubscribe\n"); | 161 | pr_debug("SW IRQ unsubscribe\n"); |
163 | 162 | ||
164 | if (self->pdata->irq) { | 163 | if (self->pdata->irq) { |
165 | disable_irq_wake(self->pdata->irq->start); | 164 | disable_irq_wake(self->pdata->irq); |
166 | free_irq(self->pdata->irq->start, self); | 165 | free_irq(self->pdata->irq, self); |
167 | } else { | 166 | } else { |
168 | sdio_claim_host(self->func); | 167 | sdio_claim_host(self->func); |
169 | ret = sdio_release_irq(self->func); | 168 | ret = sdio_release_irq(self->func); |
@@ -174,12 +173,10 @@ static int cw1200_sdio_irq_unsubscribe(struct hwbus_priv *self) | |||
174 | 173 | ||
175 | static int cw1200_sdio_off(const struct cw1200_platform_data_sdio *pdata) | 174 | static int cw1200_sdio_off(const struct cw1200_platform_data_sdio *pdata) |
176 | { | 175 | { |
177 | const struct resource *reset = pdata->reset; | 176 | if (pdata->reset) { |
178 | 177 | gpio_set_value(pdata->reset, 0); | |
179 | if (reset) { | ||
180 | gpio_set_value(reset->start, 0); | ||
181 | msleep(30); /* Min is 2 * CLK32K cycles */ | 178 | msleep(30); /* Min is 2 * CLK32K cycles */ |
182 | gpio_free(reset->start); | 179 | gpio_free(pdata->reset); |
183 | } | 180 | } |
184 | 181 | ||
185 | if (pdata->power_ctrl) | 182 | if (pdata->power_ctrl) |
@@ -192,20 +189,17 @@ static int cw1200_sdio_off(const struct cw1200_platform_data_sdio *pdata) | |||
192 | 189 | ||
193 | static int cw1200_sdio_on(const struct cw1200_platform_data_sdio *pdata) | 190 | static int cw1200_sdio_on(const struct cw1200_platform_data_sdio *pdata) |
194 | { | 191 | { |
195 | const struct resource *reset = pdata->reset; | ||
196 | const struct resource *powerup = pdata->powerup; | ||
197 | |||
198 | /* Ensure I/Os are pulled low */ | 192 | /* Ensure I/Os are pulled low */ |
199 | if (reset) { | 193 | if (pdata->reset) { |
200 | gpio_request(reset->start, reset->name); | 194 | gpio_request(pdata->reset, "cw1200_wlan_reset"); |
201 | gpio_direction_output(reset->start, 0); | 195 | gpio_direction_output(pdata->reset, 0); |
202 | } | 196 | } |
203 | if (powerup) { | 197 | if (pdata->powerup) { |
204 | gpio_request(powerup->start, powerup->name); | 198 | gpio_request(pdata->powerup, "cw1200_wlan_powerup"); |
205 | gpio_direction_output(powerup->start, 0); | 199 | gpio_direction_output(pdata->powerup, 0); |
206 | } | 200 | } |
207 | if (reset || powerup) | 201 | if (pdata->reset || pdata->powerup) |
208 | msleep(50); /* Settle time */ | 202 | msleep(10); /* Settle time? */ |
209 | 203 | ||
210 | /* Enable 3v3 and 1v8 to hardware */ | 204 | /* Enable 3v3 and 1v8 to hardware */ |
211 | if (pdata->power_ctrl) { | 205 | if (pdata->power_ctrl) { |
@@ -225,13 +219,13 @@ static int cw1200_sdio_on(const struct cw1200_platform_data_sdio *pdata) | |||
225 | } | 219 | } |
226 | 220 | ||
227 | /* Enable POWERUP signal */ | 221 | /* Enable POWERUP signal */ |
228 | if (powerup) { | 222 | if (pdata->powerup) { |
229 | gpio_set_value(powerup->start, 1); | 223 | gpio_set_value(pdata->powerup, 1); |
230 | msleep(250); /* or more..? */ | 224 | msleep(250); /* or more..? */ |
231 | } | 225 | } |
232 | /* Enable RSTn signal */ | 226 | /* Enable RSTn signal */ |
233 | if (reset) { | 227 | if (pdata->reset) { |
234 | gpio_set_value(reset->start, 1); | 228 | gpio_set_value(pdata->reset, 1); |
235 | msleep(50); /* Or more..? */ | 229 | msleep(50); /* Or more..? */ |
236 | } | 230 | } |
237 | return 0; | 231 | return 0; |
@@ -252,7 +246,7 @@ static int cw1200_sdio_pm(struct hwbus_priv *self, bool suspend) | |||
252 | int ret = 0; | 246 | int ret = 0; |
253 | 247 | ||
254 | if (self->pdata->irq) | 248 | if (self->pdata->irq) |
255 | ret = irq_set_irq_wake(self->pdata->irq->start, suspend); | 249 | ret = irq_set_irq_wake(self->pdata->irq, suspend); |
256 | return ret; | 250 | return ret; |
257 | } | 251 | } |
258 | 252 | ||
@@ -274,7 +268,7 @@ static int cw1200_sdio_probe(struct sdio_func *func, | |||
274 | 268 | ||
275 | pr_info("cw1200_wlan_sdio: Probe called\n"); | 269 | pr_info("cw1200_wlan_sdio: Probe called\n"); |
276 | 270 | ||
277 | /* We are only able to handle the wlan function */ | 271 | /* We are only able to handle the wlan function */ |
278 | if (func->num != 0x01) | 272 | if (func->num != 0x01) |
279 | return -ENODEV; | 273 | return -ENODEV; |
280 | 274 | ||
diff --git a/drivers/net/wireless/cw1200/cw1200_spi.c b/drivers/net/wireless/cw1200/cw1200_spi.c index da5d24cc67db..d8dc7c6bb96d 100644 --- a/drivers/net/wireless/cw1200/cw1200_spi.c +++ b/drivers/net/wireless/cw1200/cw1200_spi.c | |||
@@ -268,12 +268,10 @@ static int cw1200_spi_irq_unsubscribe(struct hwbus_priv *self) | |||
268 | 268 | ||
269 | static int cw1200_spi_off(const struct cw1200_platform_data_spi *pdata) | 269 | static int cw1200_spi_off(const struct cw1200_platform_data_spi *pdata) |
270 | { | 270 | { |
271 | const struct resource *reset = pdata->reset; | 271 | if (pdata->reset) { |
272 | 272 | gpio_set_value(pdata->reset, 0); | |
273 | if (reset) { | ||
274 | gpio_set_value(reset->start, 0); | ||
275 | msleep(30); /* Min is 2 * CLK32K cycles */ | 273 | msleep(30); /* Min is 2 * CLK32K cycles */ |
276 | gpio_free(reset->start); | 274 | gpio_free(pdata->reset); |
277 | } | 275 | } |
278 | 276 | ||
279 | if (pdata->power_ctrl) | 277 | if (pdata->power_ctrl) |
@@ -286,19 +284,16 @@ static int cw1200_spi_off(const struct cw1200_platform_data_spi *pdata) | |||
286 | 284 | ||
287 | static int cw1200_spi_on(const struct cw1200_platform_data_spi *pdata) | 285 | static int cw1200_spi_on(const struct cw1200_platform_data_spi *pdata) |
288 | { | 286 | { |
289 | const struct resource *reset = pdata->reset; | ||
290 | const struct resource *powerup = pdata->powerup; | ||
291 | |||
292 | /* Ensure I/Os are pulled low */ | 287 | /* Ensure I/Os are pulled low */ |
293 | if (reset) { | 288 | if (pdata->reset) { |
294 | gpio_request(reset->start, reset->name); | 289 | gpio_request(pdata->reset, "cw1200_wlan_reset"); |
295 | gpio_direction_output(reset->start, 0); | 290 | gpio_direction_output(pdata->reset, 0); |
296 | } | 291 | } |
297 | if (powerup) { | 292 | if (pdata->powerup) { |
298 | gpio_request(powerup->start, powerup->name); | 293 | gpio_request(pdata->powerup, "cw1200_wlan_powerup"); |
299 | gpio_direction_output(powerup->start, 0); | 294 | gpio_direction_output(pdata->powerup, 0); |
300 | } | 295 | } |
301 | if (reset || powerup) | 296 | if (pdata->reset || pdata->powerup) |
302 | msleep(10); /* Settle time? */ | 297 | msleep(10); /* Settle time? */ |
303 | 298 | ||
304 | /* Enable 3v3 and 1v8 to hardware */ | 299 | /* Enable 3v3 and 1v8 to hardware */ |
@@ -319,13 +314,13 @@ static int cw1200_spi_on(const struct cw1200_platform_data_spi *pdata) | |||
319 | } | 314 | } |
320 | 315 | ||
321 | /* Enable POWERUP signal */ | 316 | /* Enable POWERUP signal */ |
322 | if (powerup) { | 317 | if (pdata->powerup) { |
323 | gpio_set_value(powerup->start, 1); | 318 | gpio_set_value(pdata->powerup, 1); |
324 | msleep(250); /* or more..? */ | 319 | msleep(250); /* or more..? */ |
325 | } | 320 | } |
326 | /* Enable RSTn signal */ | 321 | /* Enable RSTn signal */ |
327 | if (reset) { | 322 | if (pdata->reset) { |
328 | gpio_set_value(reset->start, 1); | 323 | gpio_set_value(pdata->reset, 1); |
329 | msleep(50); /* Or more..? */ | 324 | msleep(50); /* Or more..? */ |
330 | } | 325 | } |
331 | return 0; | 326 | return 0; |