Lines Matching refs:ar_sdio

190 static struct bus_request *ath6kl_sdio_alloc_busreq(struct ath6kl_sdio *ar_sdio)  in ath6kl_sdio_alloc_busreq()  argument
194 spin_lock_bh(&ar_sdio->lock); in ath6kl_sdio_alloc_busreq()
196 if (list_empty(&ar_sdio->bus_req_freeq)) { in ath6kl_sdio_alloc_busreq()
197 spin_unlock_bh(&ar_sdio->lock); in ath6kl_sdio_alloc_busreq()
201 bus_req = list_first_entry(&ar_sdio->bus_req_freeq, in ath6kl_sdio_alloc_busreq()
205 spin_unlock_bh(&ar_sdio->lock); in ath6kl_sdio_alloc_busreq()
212 static void ath6kl_sdio_free_bus_req(struct ath6kl_sdio *ar_sdio, in ath6kl_sdio_free_bus_req() argument
218 spin_lock_bh(&ar_sdio->lock); in ath6kl_sdio_free_bus_req()
219 list_add_tail(&bus_req->list, &ar_sdio->bus_req_freeq); in ath6kl_sdio_free_bus_req()
220 spin_unlock_bh(&ar_sdio->lock); in ath6kl_sdio_free_bus_req()
260 static int ath6kl_sdio_scat_rw(struct ath6kl_sdio *ar_sdio, in ath6kl_sdio_scat_rw() argument
277 status = ath6kl_sdio_io(ar_sdio->func, scat_req->req, in ath6kl_sdio_scat_rw()
304 ath6kl_sdio_set_cmd53_arg(&cmd.arg, rw, ar_sdio->func->num, in ath6kl_sdio_scat_rw()
314 sdio_claim_host(ar_sdio->func); in ath6kl_sdio_scat_rw()
316 mmc_set_data_timeout(&data, ar_sdio->func->card); in ath6kl_sdio_scat_rw()
325 mmc_wait_for_req(ar_sdio->func->card->host, &mmc_req); in ath6kl_sdio_scat_rw()
327 sdio_release_host(ar_sdio->func); in ath6kl_sdio_scat_rw()
339 scat_req->complete(ar_sdio->ar->htc_target, scat_req); in ath6kl_sdio_scat_rw()
344 static int ath6kl_sdio_alloc_prep_scat_req(struct ath6kl_sdio *ar_sdio, in ath6kl_sdio_alloc_prep_scat_req() argument
388 bus_req = ath6kl_sdio_alloc_busreq(ar_sdio); in ath6kl_sdio_alloc_prep_scat_req()
403 hif_scatter_req_add(ar_sdio->ar, s_req); in ath6kl_sdio_alloc_prep_scat_req()
412 struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); in ath6kl_sdio_read_write_sync() local
421 if (!ar_sdio->dma_buffer) in ath6kl_sdio_read_write_sync()
423 mutex_lock(&ar_sdio->dma_buffer_mutex); in ath6kl_sdio_read_write_sync()
424 tbuf = ar_sdio->dma_buffer; in ath6kl_sdio_read_write_sync()
434 ret = ath6kl_sdio_io(ar_sdio->func, request, addr, tbuf, len); in ath6kl_sdio_read_write_sync()
439 mutex_unlock(&ar_sdio->dma_buffer_mutex); in ath6kl_sdio_read_write_sync()
444 static void __ath6kl_sdio_write_async(struct ath6kl_sdio *ar_sdio, in __ath6kl_sdio_write_async() argument
448 ath6kl_sdio_scat_rw(ar_sdio, req); in __ath6kl_sdio_write_async()
453 status = ath6kl_sdio_read_write_sync(ar_sdio->ar, req->address, in __ath6kl_sdio_write_async()
457 ath6kl_sdio_free_bus_req(ar_sdio, req); in __ath6kl_sdio_write_async()
464 struct ath6kl_sdio *ar_sdio; in ath6kl_sdio_write_async_work() local
467 ar_sdio = container_of(work, struct ath6kl_sdio, wr_async_work); in ath6kl_sdio_write_async_work()
469 spin_lock_bh(&ar_sdio->wr_async_lock); in ath6kl_sdio_write_async_work()
470 list_for_each_entry_safe(req, tmp_req, &ar_sdio->wr_asyncq, list) { in ath6kl_sdio_write_async_work()
472 spin_unlock_bh(&ar_sdio->wr_async_lock); in ath6kl_sdio_write_async_work()
473 __ath6kl_sdio_write_async(ar_sdio, req); in ath6kl_sdio_write_async_work()
474 spin_lock_bh(&ar_sdio->wr_async_lock); in ath6kl_sdio_write_async_work()
476 spin_unlock_bh(&ar_sdio->wr_async_lock); in ath6kl_sdio_write_async_work()
482 struct ath6kl_sdio *ar_sdio; in ath6kl_sdio_irq_handler() local
486 ar_sdio = sdio_get_drvdata(func); in ath6kl_sdio_irq_handler()
487 atomic_set(&ar_sdio->irq_handling, 1); in ath6kl_sdio_irq_handler()
492 sdio_release_host(ar_sdio->func); in ath6kl_sdio_irq_handler()
494 status = ath6kl_hif_intr_bh_handler(ar_sdio->ar); in ath6kl_sdio_irq_handler()
495 sdio_claim_host(ar_sdio->func); in ath6kl_sdio_irq_handler()
497 atomic_set(&ar_sdio->irq_handling, 0); in ath6kl_sdio_irq_handler()
498 wake_up(&ar_sdio->irq_wq); in ath6kl_sdio_irq_handler()
505 struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); in ath6kl_sdio_power_on() local
506 struct sdio_func *func = ar_sdio->func; in ath6kl_sdio_power_on()
509 if (!ar_sdio->is_disabled) in ath6kl_sdio_power_on()
537 ar_sdio->is_disabled = false; in ath6kl_sdio_power_on()
545 struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); in ath6kl_sdio_power_off() local
548 if (ar_sdio->is_disabled) in ath6kl_sdio_power_off()
554 sdio_claim_host(ar_sdio->func); in ath6kl_sdio_power_off()
555 ret = sdio_disable_func(ar_sdio->func); in ath6kl_sdio_power_off()
556 sdio_release_host(ar_sdio->func); in ath6kl_sdio_power_off()
561 ar_sdio->is_disabled = true; in ath6kl_sdio_power_off()
570 struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); in ath6kl_sdio_write_async() local
573 bus_req = ath6kl_sdio_alloc_busreq(ar_sdio); in ath6kl_sdio_write_async()
584 spin_lock_bh(&ar_sdio->wr_async_lock); in ath6kl_sdio_write_async()
585 list_add_tail(&bus_req->list, &ar_sdio->wr_asyncq); in ath6kl_sdio_write_async()
586 spin_unlock_bh(&ar_sdio->wr_async_lock); in ath6kl_sdio_write_async()
587 queue_work(ar->ath6kl_wq, &ar_sdio->wr_async_work); in ath6kl_sdio_write_async()
594 struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); in ath6kl_sdio_irq_enable() local
597 sdio_claim_host(ar_sdio->func); in ath6kl_sdio_irq_enable()
600 ret = sdio_claim_irq(ar_sdio->func, ath6kl_sdio_irq_handler); in ath6kl_sdio_irq_enable()
604 sdio_release_host(ar_sdio->func); in ath6kl_sdio_irq_enable()
609 struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); in ath6kl_sdio_is_on_irq() local
611 return !atomic_read(&ar_sdio->irq_handling); in ath6kl_sdio_is_on_irq()
616 struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); in ath6kl_sdio_irq_disable() local
619 sdio_claim_host(ar_sdio->func); in ath6kl_sdio_irq_disable()
621 if (atomic_read(&ar_sdio->irq_handling)) { in ath6kl_sdio_irq_disable()
622 sdio_release_host(ar_sdio->func); in ath6kl_sdio_irq_disable()
624 ret = wait_event_interruptible(ar_sdio->irq_wq, in ath6kl_sdio_irq_disable()
629 sdio_claim_host(ar_sdio->func); in ath6kl_sdio_irq_disable()
632 ret = sdio_release_irq(ar_sdio->func); in ath6kl_sdio_irq_disable()
636 sdio_release_host(ar_sdio->func); in ath6kl_sdio_irq_disable()
641 struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); in ath6kl_sdio_scatter_req_get() local
644 spin_lock_bh(&ar_sdio->scat_lock); in ath6kl_sdio_scatter_req_get()
646 if (!list_empty(&ar_sdio->scat_req)) { in ath6kl_sdio_scatter_req_get()
647 node = list_first_entry(&ar_sdio->scat_req, in ath6kl_sdio_scatter_req_get()
651 node->scat_q_depth = get_queue_depth(&ar_sdio->scat_req); in ath6kl_sdio_scatter_req_get()
654 spin_unlock_bh(&ar_sdio->scat_lock); in ath6kl_sdio_scatter_req_get()
662 struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); in ath6kl_sdio_scatter_req_add() local
664 spin_lock_bh(&ar_sdio->scat_lock); in ath6kl_sdio_scatter_req_add()
666 list_add_tail(&s_req->list, &ar_sdio->scat_req); in ath6kl_sdio_scatter_req_add()
668 spin_unlock_bh(&ar_sdio->scat_lock); in ath6kl_sdio_scatter_req_add()
675 struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); in ath6kl_sdio_async_rw_scatter() local
687 status = ath6kl_sdio_scat_rw(ar_sdio, scat_req->busrequest); in ath6kl_sdio_async_rw_scatter()
689 spin_lock_bh(&ar_sdio->wr_async_lock); in ath6kl_sdio_async_rw_scatter()
690 list_add_tail(&scat_req->busrequest->list, &ar_sdio->wr_asyncq); in ath6kl_sdio_async_rw_scatter()
691 spin_unlock_bh(&ar_sdio->wr_async_lock); in ath6kl_sdio_async_rw_scatter()
692 queue_work(ar->ath6kl_wq, &ar_sdio->wr_async_work); in ath6kl_sdio_async_rw_scatter()
701 struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); in ath6kl_sdio_cleanup_scatter() local
705 spin_lock_bh(&ar_sdio->scat_lock); in ath6kl_sdio_cleanup_scatter()
706 list_for_each_entry_safe(s_req, tmp_req, &ar_sdio->scat_req, list) { in ath6kl_sdio_cleanup_scatter()
708 spin_unlock_bh(&ar_sdio->scat_lock); in ath6kl_sdio_cleanup_scatter()
717 ath6kl_sdio_free_bus_req(ar_sdio, s_req->busrequest); in ath6kl_sdio_cleanup_scatter()
723 spin_lock_bh(&ar_sdio->scat_lock); in ath6kl_sdio_cleanup_scatter()
725 spin_unlock_bh(&ar_sdio->scat_lock); in ath6kl_sdio_cleanup_scatter()
727 ar_sdio->scatter_enabled = false; in ath6kl_sdio_cleanup_scatter()
733 struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); in ath6kl_sdio_enable_scatter() local
738 if (ar_sdio->scatter_enabled) in ath6kl_sdio_enable_scatter()
741 ar_sdio->scatter_enabled = true; in ath6kl_sdio_enable_scatter()
744 if (ar_sdio->func->card->host->max_segs < MAX_SCATTER_ENTRIES_PER_REQ) { in ath6kl_sdio_enable_scatter()
746 ar_sdio->func->card->host->max_segs, in ath6kl_sdio_enable_scatter()
752 ret = ath6kl_sdio_alloc_prep_scat_req(ar_sdio, in ath6kl_sdio_enable_scatter()
772 ret = ath6kl_sdio_alloc_prep_scat_req(ar_sdio, in ath6kl_sdio_enable_scatter()
796 struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); in ath6kl_sdio_config() local
797 struct sdio_func *func = ar_sdio->func; in ath6kl_sdio_config()
802 if (ar_sdio->id->device >= SDIO_DEVICE_ID_ATHEROS_AR6003_00) { in ath6kl_sdio_config()
834 struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); in ath6kl_set_sdio_pm_caps() local
835 struct sdio_func *func = ar_sdio->func; in ath6kl_set_sdio_pm_caps()
863 struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); in ath6kl_sdio_suspend() local
864 struct sdio_func *func = ar_sdio->func; in ath6kl_sdio_suspend()
1224 struct ath6kl_sdio *ar_sdio = ath6kl_sdio_priv(ar); in ath6kl_sdio_stop() local
1230 cancel_work_sync(&ar_sdio->wr_async_work); in ath6kl_sdio_stop()
1232 spin_lock_bh(&ar_sdio->wr_async_lock); in ath6kl_sdio_stop()
1234 list_for_each_entry_safe(req, tmp_req, &ar_sdio->wr_asyncq, list) { in ath6kl_sdio_stop()
1240 req->scat_req->complete(ar_sdio->ar->htc_target, in ath6kl_sdio_stop()
1244 ath6kl_sdio_free_bus_req(ar_sdio, req); in ath6kl_sdio_stop()
1249 spin_unlock_bh(&ar_sdio->wr_async_lock); in ath6kl_sdio_stop()
1251 WARN_ON(get_queue_depth(&ar_sdio->scat_req) != 4); in ath6kl_sdio_stop()
1310 struct ath6kl_sdio *ar_sdio; in ath6kl_sdio_probe() local
1319 ar_sdio = kzalloc(sizeof(struct ath6kl_sdio), GFP_KERNEL); in ath6kl_sdio_probe()
1320 if (!ar_sdio) in ath6kl_sdio_probe()
1323 ar_sdio->dma_buffer = kzalloc(HIF_DMA_BUFFER_SIZE, GFP_KERNEL); in ath6kl_sdio_probe()
1324 if (!ar_sdio->dma_buffer) { in ath6kl_sdio_probe()
1329 ar_sdio->func = func; in ath6kl_sdio_probe()
1330 sdio_set_drvdata(func, ar_sdio); in ath6kl_sdio_probe()
1332 ar_sdio->id = id; in ath6kl_sdio_probe()
1333 ar_sdio->is_disabled = true; in ath6kl_sdio_probe()
1335 spin_lock_init(&ar_sdio->lock); in ath6kl_sdio_probe()
1336 spin_lock_init(&ar_sdio->scat_lock); in ath6kl_sdio_probe()
1337 spin_lock_init(&ar_sdio->wr_async_lock); in ath6kl_sdio_probe()
1338 mutex_init(&ar_sdio->dma_buffer_mutex); in ath6kl_sdio_probe()
1340 INIT_LIST_HEAD(&ar_sdio->scat_req); in ath6kl_sdio_probe()
1341 INIT_LIST_HEAD(&ar_sdio->bus_req_freeq); in ath6kl_sdio_probe()
1342 INIT_LIST_HEAD(&ar_sdio->wr_asyncq); in ath6kl_sdio_probe()
1344 INIT_WORK(&ar_sdio->wr_async_work, ath6kl_sdio_write_async_work); in ath6kl_sdio_probe()
1346 init_waitqueue_head(&ar_sdio->irq_wq); in ath6kl_sdio_probe()
1349 ath6kl_sdio_free_bus_req(ar_sdio, &ar_sdio->bus_req[count]); in ath6kl_sdio_probe()
1351 ar = ath6kl_core_create(&ar_sdio->func->dev); in ath6kl_sdio_probe()
1358 ar_sdio->ar = ar; in ath6kl_sdio_probe()
1360 ar->hif_priv = ar_sdio; in ath6kl_sdio_probe()
1381 ath6kl_core_destroy(ar_sdio->ar); in ath6kl_sdio_probe()
1383 kfree(ar_sdio->dma_buffer); in ath6kl_sdio_probe()
1385 kfree(ar_sdio); in ath6kl_sdio_probe()
1392 struct ath6kl_sdio *ar_sdio; in ath6kl_sdio_remove() local
1398 ar_sdio = sdio_get_drvdata(func); in ath6kl_sdio_remove()
1400 ath6kl_stop_txrx(ar_sdio->ar); in ath6kl_sdio_remove()
1401 cancel_work_sync(&ar_sdio->wr_async_work); in ath6kl_sdio_remove()
1403 ath6kl_core_cleanup(ar_sdio->ar); in ath6kl_sdio_remove()
1404 ath6kl_core_destroy(ar_sdio->ar); in ath6kl_sdio_remove()
1406 kfree(ar_sdio->dma_buffer); in ath6kl_sdio_remove()
1407 kfree(ar_sdio); in ath6kl_sdio_remove()