Lines Matching +full:probe +full:- +full:reset
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Mac80211 SDIO driver for ST-Ericsson CW1200 device
5 * Copyright (c) 2010, ST-Ericsson
22 #include <linux/platform_data/net-cw1200.h>
26 MODULE_DESCRIPTION("mac80211 ST-Ericsson CW1200 SDIO driver");
64 return sdio_memcpy_fromio(self->func, dst, addr, count); in cw1200_sdio_memcpy_fromio()
71 return sdio_memcpy_toio(self->func, addr, (void *)src, count); in cw1200_sdio_memcpy_toio()
76 sdio_claim_host(self->func); in cw1200_sdio_lock()
81 sdio_release_host(self->func); in cw1200_sdio_unlock()
89 if (self->core) in cw1200_sdio_irq_handler()
90 cw1200_irq_handler(self->core); in cw1200_sdio_irq_handler()
102 if (self->core) { in cw1200_gpio_irq()
104 cw1200_irq_handler(self->core); in cw1200_gpio_irq()
117 cccr = sdio_f0_readb(self->func, SDIO_CCCR_IENx, &ret); in cw1200_request_irq()
125 cccr |= BIT(self->func->num); in cw1200_request_irq()
127 sdio_f0_writeb(self->func, cccr, SDIO_CCCR_IENx, &ret); in cw1200_request_irq()
131 ret = enable_irq_wake(self->pdata->irq); in cw1200_request_irq()
136 ret = request_threaded_irq(self->pdata->irq, cw1200_gpio_hardirq, in cw1200_request_irq()
154 sdio_claim_host(self->func); in cw1200_sdio_irq_subscribe()
155 if (self->pdata->irq) in cw1200_sdio_irq_subscribe()
158 ret = sdio_claim_irq(self->func, cw1200_sdio_irq_handler); in cw1200_sdio_irq_subscribe()
160 sdio_release_host(self->func); in cw1200_sdio_irq_subscribe()
170 if (self->pdata->irq) { in cw1200_sdio_irq_unsubscribe()
171 disable_irq_wake(self->pdata->irq); in cw1200_sdio_irq_unsubscribe()
172 free_irq(self->pdata->irq, self); in cw1200_sdio_irq_unsubscribe()
174 sdio_claim_host(self->func); in cw1200_sdio_irq_unsubscribe()
175 ret = sdio_release_irq(self->func); in cw1200_sdio_irq_unsubscribe()
176 sdio_release_host(self->func); in cw1200_sdio_irq_unsubscribe()
183 if (pdata->reset) { in cw1200_sdio_off()
184 gpio_set_value(pdata->reset, 0); in cw1200_sdio_off()
186 gpio_free(pdata->reset); in cw1200_sdio_off()
189 if (pdata->power_ctrl) in cw1200_sdio_off()
190 pdata->power_ctrl(pdata, false); in cw1200_sdio_off()
191 if (pdata->clk_ctrl) in cw1200_sdio_off()
192 pdata->clk_ctrl(pdata, false); in cw1200_sdio_off()
200 if (pdata->reset) { in cw1200_sdio_on()
201 gpio_request(pdata->reset, "cw1200_wlan_reset"); in cw1200_sdio_on()
202 gpio_direction_output(pdata->reset, 0); in cw1200_sdio_on()
204 if (pdata->powerup) { in cw1200_sdio_on()
205 gpio_request(pdata->powerup, "cw1200_wlan_powerup"); in cw1200_sdio_on()
206 gpio_direction_output(pdata->powerup, 0); in cw1200_sdio_on()
208 if (pdata->reset || pdata->powerup) in cw1200_sdio_on()
212 if (pdata->power_ctrl) { in cw1200_sdio_on()
213 if (pdata->power_ctrl(pdata, true)) { in cw1200_sdio_on()
215 return -1; in cw1200_sdio_on()
220 if (pdata->clk_ctrl) { in cw1200_sdio_on()
221 if (pdata->clk_ctrl(pdata, true)) { in cw1200_sdio_on()
223 return -1; in cw1200_sdio_on()
229 if (pdata->powerup) { in cw1200_sdio_on()
230 gpio_set_value(pdata->powerup, 1); in cw1200_sdio_on()
234 if (pdata->reset) { in cw1200_sdio_on()
235 gpio_set_value(pdata->reset, 1); in cw1200_sdio_on()
243 if (self->pdata->no_nptb) in cw1200_sdio_align_size()
246 size = sdio_align_size(self->func, size); in cw1200_sdio_align_size()
255 if (self->pdata->irq) in cw1200_sdio_pm()
256 ret = irq_set_irq_wake(self->pdata->irq, suspend); in cw1200_sdio_pm()
269 /* Probe Function to be called by SDIO stack when device is discovered */
276 pr_info("cw1200_wlan_sdio: Probe called\n"); in cw1200_sdio_probe()
279 if (func->num != 0x01) in cw1200_sdio_probe()
280 return -ENODEV; in cw1200_sdio_probe()
285 return -ENOMEM; in cw1200_sdio_probe()
288 func->card->quirks |= MMC_QUIRK_LENIENT_FN0; in cw1200_sdio_probe()
290 self->pdata = global_plat_data; /* FIXME */ in cw1200_sdio_probe()
291 self->func = func; in cw1200_sdio_probe()
300 self, &func->dev, &self->core, in cw1200_sdio_probe()
301 self->pdata->ref_clk, in cw1200_sdio_probe()
302 self->pdata->macaddr, in cw1200_sdio_probe()
303 self->pdata->sdd_file, in cw1200_sdio_probe()
304 self->pdata->have_5ghz); in cw1200_sdio_probe()
326 if (self->core) { in cw1200_sdio_disconnect()
327 cw1200_core_release(self->core); in cw1200_sdio_disconnect()
328 self->core = NULL; in cw1200_sdio_disconnect()
345 if (!cw1200_can_suspend(self->core)) in cw1200_sdio_suspend()
346 return -EAGAIN; in cw1200_sdio_suspend()
370 .probe = cw1200_sdio_probe,
379 /* Init Module function -> Called by insmod */
385 /* FIXME -- this won't support multiple devices */ in cw1200_sdio_init()
389 ret = -1; in cw1200_sdio_init()
409 /* FIXME -- this won't support multiple devices */ in cw1200_sdio_exit()