Lines Matching +full:no +full:- +full:mmc
18 #include <linux/dma-mapping.h>
24 #include <linux/mmc/mmc.h>
25 #include <linux/mmc/host.h>
26 #include <linux/mmc/card.h>
45 return cq_host->desc_base + (tag * cq_host->slot_sz); in get_desc()
52 return desc + cq_host->task_desc_len; in get_link_desc()
57 return cq_host->trans_desc_dma_base + in get_trans_desc_dma()
58 (cq_host->mmc->max_segs * tag * in get_trans_desc_dma()
59 cq_host->trans_desc_len); in get_trans_desc_dma()
64 return cq_host->trans_desc_base + in get_trans_desc()
65 (cq_host->trans_desc_len * cq_host->mmc->max_segs * tag); in get_trans_desc()
76 memset(link_temp, 0, cq_host->link_desc_len); in setup_trans_desc()
77 if (cq_host->link_desc_len > 8) in setup_trans_desc()
80 if (tag == DCMD_SLOT && (cq_host->mmc->caps2 & MMC_CAP2_CQE_DCMD)) { in setup_trans_desc()
87 if (cq_host->dma64) { in setup_trans_desc()
107 pr_err("%s: " DRV_NAME ": " f, mmc_hostname(mmc), ## x)
111 struct mmc_host *mmc = cq_host->mmc; in cqhci_dumpregs() local
149 if (cq_host->ops->dumpregs) in cqhci_dumpregs()
150 cq_host->ops->dumpregs(mmc); in cqhci_dumpregs()
158 * |----------|
159 * |task desc | |->|----------|
160 * |----------| | |trans desc|
161 * |link desc-|->| |----------|
162 * |----------| .
164 * no. of slots max-segs
165 * . |----------|
166 * |----------|
175 if (cq_host->caps & CQHCI_TASK_DESC_SZ_128) { in cqhci_host_alloc_tdl()
178 cq_host->task_desc_len = 16; in cqhci_host_alloc_tdl()
180 cq_host->task_desc_len = 8; in cqhci_host_alloc_tdl()
188 if (cq_host->dma64) { in cqhci_host_alloc_tdl()
189 if (cq_host->quirks & CQHCI_QUIRK_SHORT_TXFR_DESC_SZ) in cqhci_host_alloc_tdl()
190 cq_host->trans_desc_len = 12; in cqhci_host_alloc_tdl()
192 cq_host->trans_desc_len = 16; in cqhci_host_alloc_tdl()
193 cq_host->link_desc_len = 16; in cqhci_host_alloc_tdl()
195 cq_host->trans_desc_len = 8; in cqhci_host_alloc_tdl()
196 cq_host->link_desc_len = 8; in cqhci_host_alloc_tdl()
200 cq_host->slot_sz = cq_host->task_desc_len + cq_host->link_desc_len; in cqhci_host_alloc_tdl()
202 cq_host->desc_size = cq_host->slot_sz * cq_host->num_slots; in cqhci_host_alloc_tdl()
204 cq_host->data_size = cq_host->trans_desc_len * cq_host->mmc->max_segs * in cqhci_host_alloc_tdl()
205 cq_host->mmc->cqe_qdepth; in cqhci_host_alloc_tdl()
207 pr_debug("%s: cqhci: desc_size: %zu data_sz: %zu slot-sz: %d\n", in cqhci_host_alloc_tdl()
208 mmc_hostname(cq_host->mmc), cq_host->desc_size, cq_host->data_size, in cqhci_host_alloc_tdl()
209 cq_host->slot_sz); in cqhci_host_alloc_tdl()
212 * allocate a dma-mapped chunk of memory for the descriptors in cqhci_host_alloc_tdl()
213 * allocate a dma-mapped chunk of memory for link descriptors in cqhci_host_alloc_tdl()
214 * setup each link-desc memory offset per slot-number to in cqhci_host_alloc_tdl()
217 cq_host->desc_base = dmam_alloc_coherent(mmc_dev(cq_host->mmc), in cqhci_host_alloc_tdl()
218 cq_host->desc_size, in cqhci_host_alloc_tdl()
219 &cq_host->desc_dma_base, in cqhci_host_alloc_tdl()
221 if (!cq_host->desc_base) in cqhci_host_alloc_tdl()
222 return -ENOMEM; in cqhci_host_alloc_tdl()
224 cq_host->trans_desc_base = dmam_alloc_coherent(mmc_dev(cq_host->mmc), in cqhci_host_alloc_tdl()
225 cq_host->data_size, in cqhci_host_alloc_tdl()
226 &cq_host->trans_desc_dma_base, in cqhci_host_alloc_tdl()
228 if (!cq_host->trans_desc_base) { in cqhci_host_alloc_tdl()
229 dmam_free_coherent(mmc_dev(cq_host->mmc), cq_host->desc_size, in cqhci_host_alloc_tdl()
230 cq_host->desc_base, in cqhci_host_alloc_tdl()
231 cq_host->desc_dma_base); in cqhci_host_alloc_tdl()
232 cq_host->desc_base = NULL; in cqhci_host_alloc_tdl()
233 cq_host->desc_dma_base = 0; in cqhci_host_alloc_tdl()
234 return -ENOMEM; in cqhci_host_alloc_tdl()
237 pr_debug("%s: cqhci: desc-base: 0x%p trans-base: 0x%p\n desc_dma 0x%llx trans_dma: 0x%llx\n", in cqhci_host_alloc_tdl()
238 mmc_hostname(cq_host->mmc), cq_host->desc_base, cq_host->trans_desc_base, in cqhci_host_alloc_tdl()
239 (unsigned long long)cq_host->desc_dma_base, in cqhci_host_alloc_tdl()
240 (unsigned long long)cq_host->trans_desc_dma_base); in cqhci_host_alloc_tdl()
242 for (; i < (cq_host->num_slots); i++) in cqhci_host_alloc_tdl()
250 struct mmc_host *mmc = cq_host->mmc; in __cqhci_enable() local
263 if (mmc->caps2 & MMC_CAP2_CQE_DCMD) in __cqhci_enable()
266 if (cq_host->caps & CQHCI_TASK_DESC_SZ_128) in __cqhci_enable()
271 cqhci_writel(cq_host, lower_32_bits(cq_host->desc_dma_base), in __cqhci_enable()
273 cqhci_writel(cq_host, upper_32_bits(cq_host->desc_dma_base), in __cqhci_enable()
276 cqhci_writel(cq_host, cq_host->rca, CQHCI_SSC2); in __cqhci_enable()
284 mmc->cqe_on = true; in __cqhci_enable()
286 if (cq_host->ops->enable) in __cqhci_enable()
287 cq_host->ops->enable(mmc); in __cqhci_enable()
294 cq_host->activated = true; in __cqhci_enable()
305 cq_host->mmc->cqe_on = false; in __cqhci_disable()
307 cq_host->activated = false; in __cqhci_disable()
310 int cqhci_suspend(struct mmc_host *mmc) in cqhci_suspend() argument
312 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_suspend()
314 if (cq_host->enabled) in cqhci_suspend()
321 int cqhci_resume(struct mmc_host *mmc) in cqhci_resume() argument
323 /* Re-enable is done upon first request */ in cqhci_resume()
328 static int cqhci_enable(struct mmc_host *mmc, struct mmc_card *card) in cqhci_enable() argument
330 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_enable()
333 if (cq_host->enabled) in cqhci_enable()
336 cq_host->rca = card->rca; in cqhci_enable()
344 cq_host->enabled = true; in cqhci_enable()
360 static void cqhci_off(struct mmc_host *mmc) in cqhci_off() argument
362 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_off()
366 if (!cq_host->enabled || !mmc->cqe_on || cq_host->recovery_halt) in cqhci_off()
369 if (cq_host->ops->disable) in cqhci_off()
370 cq_host->ops->disable(mmc, false); in cqhci_off()
377 pr_err("%s: cqhci: CQE stuck on\n", mmc_hostname(mmc)); in cqhci_off()
379 pr_debug("%s: cqhci: CQE off\n", mmc_hostname(mmc)); in cqhci_off()
381 mmc->cqe_on = false; in cqhci_off()
384 static void cqhci_disable(struct mmc_host *mmc) in cqhci_disable() argument
386 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_disable()
388 if (!cq_host->enabled) in cqhci_disable()
391 cqhci_off(mmc); in cqhci_disable()
395 dmam_free_coherent(mmc_dev(mmc), cq_host->data_size, in cqhci_disable()
396 cq_host->trans_desc_base, in cqhci_disable()
397 cq_host->trans_desc_dma_base); in cqhci_disable()
399 dmam_free_coherent(mmc_dev(mmc), cq_host->desc_size, in cqhci_disable()
400 cq_host->desc_base, in cqhci_disable()
401 cq_host->desc_dma_base); in cqhci_disable()
403 cq_host->trans_desc_base = NULL; in cqhci_disable()
404 cq_host->desc_base = NULL; in cqhci_disable()
406 cq_host->enabled = false; in cqhci_disable()
412 u32 req_flags = mrq->data->flags; in cqhci_prep_task_desc()
424 CQHCI_BLK_COUNT(mrq->data->blocks) | in cqhci_prep_task_desc()
425 CQHCI_BLK_ADDR((u64)mrq->data->blk_addr); in cqhci_prep_task_desc()
428 mmc_hostname(mrq->host), mrq->tag, (unsigned long long)*data); in cqhci_prep_task_desc()
434 struct mmc_data *data = mrq->data; in cqhci_dma_map()
437 return -EINVAL; in cqhci_dma_map()
439 sg_count = dma_map_sg(mmc_dev(host), data->sg, in cqhci_dma_map()
440 data->sg_len, in cqhci_dma_map()
441 (data->flags & MMC_DATA_WRITE) ? in cqhci_dma_map()
444 pr_err("%s: sg-len: %d\n", __func__, data->sg_len); in cqhci_dma_map()
445 return -ENOMEM; in cqhci_dma_map()
476 struct mmc_data *data = mrq->data; in cqhci_prep_tran_desc()
479 bool dma64 = cq_host->dma64; in cqhci_prep_tran_desc()
484 sg_count = cqhci_dma_map(mrq->host, mrq); in cqhci_prep_tran_desc()
487 mmc_hostname(mrq->host), __func__, sg_count); in cqhci_prep_tran_desc()
493 for_each_sg(data->sg, sg, sg_count, i) { in cqhci_prep_tran_desc()
500 desc += cq_host->trans_desc_len; in cqhci_prep_tran_desc()
506 static void cqhci_prep_dcmd_desc(struct mmc_host *mmc, in cqhci_prep_dcmd_desc() argument
514 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_prep_dcmd_desc()
517 if (!(mrq->cmd->flags & MMC_RSP_PRESENT)) { in cqhci_prep_dcmd_desc()
521 if (mrq->cmd->flags & MMC_RSP_R1B) { in cqhci_prep_dcmd_desc()
530 task_desc = (__le64 __force *)get_desc(cq_host, cq_host->dcmd_slot); in cqhci_prep_dcmd_desc()
531 memset(task_desc, 0, cq_host->task_desc_len); in cqhci_prep_dcmd_desc()
537 CQHCI_CMD_INDEX(mrq->cmd->opcode) | in cqhci_prep_dcmd_desc()
542 mmc_hostname(mmc), mrq->cmd->opcode, timing, resp_type); in cqhci_prep_dcmd_desc()
544 dataddr[0] = cpu_to_le64((u64)mrq->cmd->arg); in cqhci_prep_dcmd_desc()
550 struct mmc_data *data = mrq->data; in cqhci_post_req()
553 dma_unmap_sg(mmc_dev(host), data->sg, data->sg_len, in cqhci_post_req()
554 (data->flags & MMC_DATA_READ) ? in cqhci_post_req()
561 return mrq->cmd ? DCMD_SLOT : mrq->tag; in cqhci_tag()
564 static int cqhci_request(struct mmc_host *mmc, struct mmc_request *mrq) in cqhci_request() argument
570 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_request()
573 if (!cq_host->enabled) { in cqhci_request()
574 pr_err("%s: cqhci: not enabled\n", mmc_hostname(mmc)); in cqhci_request()
575 return -EINVAL; in cqhci_request()
578 /* First request after resume has to re-enable */ in cqhci_request()
579 if (!cq_host->activated) in cqhci_request()
582 if (!mmc->cqe_on) { in cqhci_request()
584 mmc->cqe_on = true; in cqhci_request()
585 pr_debug("%s: cqhci: CQE on\n", mmc_hostname(mmc)); in cqhci_request()
588 mmc_hostname(mmc)); in cqhci_request()
590 if (cq_host->ops->enable) in cqhci_request()
591 cq_host->ops->enable(mmc); in cqhci_request()
594 if (mrq->data) { in cqhci_request()
601 mmc_hostname(mmc), err); in cqhci_request()
605 cqhci_prep_dcmd_desc(mmc, mrq); in cqhci_request()
608 spin_lock_irqsave(&cq_host->lock, flags); in cqhci_request()
610 if (cq_host->recovery_halt) { in cqhci_request()
611 err = -EBUSY; in cqhci_request()
615 cq_host->slot[tag].mrq = mrq; in cqhci_request()
616 cq_host->slot[tag].flags = 0; in cqhci_request()
618 cq_host->qcnt += 1; in cqhci_request()
624 mmc_hostname(mmc), tag); in cqhci_request()
626 spin_unlock_irqrestore(&cq_host->lock, flags); in cqhci_request()
629 cqhci_post_req(mmc, mrq); in cqhci_request()
634 static void cqhci_recovery_needed(struct mmc_host *mmc, struct mmc_request *mrq, in cqhci_recovery_needed() argument
637 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_recovery_needed()
639 if (!cq_host->recovery_halt) { in cqhci_recovery_needed()
640 cq_host->recovery_halt = true; in cqhci_recovery_needed()
641 pr_debug("%s: cqhci: recovery needed\n", mmc_hostname(mmc)); in cqhci_recovery_needed()
642 wake_up(&cq_host->wait_queue); in cqhci_recovery_needed()
643 if (notify && mrq->recovery_notifier) in cqhci_recovery_needed()
644 mrq->recovery_notifier(mrq); in cqhci_recovery_needed()
653 case -EILSEQ: in cqhci_error_flags()
655 case -ETIMEDOUT: in cqhci_error_flags()
662 static void cqhci_error_irq(struct mmc_host *mmc, u32 status, int cmd_error, in cqhci_error_irq() argument
665 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_error_irq()
670 spin_lock(&cq_host->lock); in cqhci_error_irq()
675 mmc_hostname(mmc), status, cmd_error, data_error, terri); in cqhci_error_irq()
678 if (cq_host->recovery_halt) in cqhci_error_irq()
681 if (!cq_host->qcnt) { in cqhci_error_irq()
683 mmc_hostname(mmc), status, cmd_error, data_error, in cqhci_error_irq()
690 slot = &cq_host->slot[tag]; in cqhci_error_irq()
691 if (slot->mrq) { in cqhci_error_irq()
692 slot->flags = cqhci_error_flags(cmd_error, data_error); in cqhci_error_irq()
693 cqhci_recovery_needed(mmc, slot->mrq, true); in cqhci_error_irq()
699 slot = &cq_host->slot[tag]; in cqhci_error_irq()
700 if (slot->mrq) { in cqhci_error_irq()
701 slot->flags = cqhci_error_flags(data_error, cmd_error); in cqhci_error_irq()
702 cqhci_recovery_needed(mmc, slot->mrq, true); in cqhci_error_irq()
706 if (!cq_host->recovery_halt) { in cqhci_error_irq()
712 slot = &cq_host->slot[tag]; in cqhci_error_irq()
713 if (!slot->mrq) in cqhci_error_irq()
715 slot->flags = cqhci_error_flags(data_error, cmd_error); in cqhci_error_irq()
716 cqhci_recovery_needed(mmc, slot->mrq, true); in cqhci_error_irq()
722 spin_unlock(&cq_host->lock); in cqhci_error_irq()
725 static void cqhci_finish_mrq(struct mmc_host *mmc, unsigned int tag) in cqhci_finish_mrq() argument
727 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_finish_mrq()
728 struct cqhci_slot *slot = &cq_host->slot[tag]; in cqhci_finish_mrq()
729 struct mmc_request *mrq = slot->mrq; in cqhci_finish_mrq()
734 mmc_hostname(mmc), tag); in cqhci_finish_mrq()
738 /* No completions allowed during recovery */ in cqhci_finish_mrq()
739 if (cq_host->recovery_halt) { in cqhci_finish_mrq()
740 slot->flags |= CQHCI_COMPLETED; in cqhci_finish_mrq()
744 slot->mrq = NULL; in cqhci_finish_mrq()
746 cq_host->qcnt -= 1; in cqhci_finish_mrq()
748 data = mrq->data; in cqhci_finish_mrq()
750 if (data->error) in cqhci_finish_mrq()
751 data->bytes_xfered = 0; in cqhci_finish_mrq()
753 data->bytes_xfered = data->blksz * data->blocks; in cqhci_finish_mrq()
756 mmc_cqe_request_done(mmc, mrq); in cqhci_finish_mrq()
759 irqreturn_t cqhci_irq(struct mmc_host *mmc, u32 intmask, int cmd_error, in cqhci_irq() argument
764 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_irq()
769 pr_debug("%s: cqhci: IRQ status: 0x%08x\n", mmc_hostname(mmc), status); in cqhci_irq()
772 cqhci_error_irq(mmc, status, cmd_error, data_error); in cqhci_irq()
779 mmc_hostname(mmc), comp_status); in cqhci_irq()
781 spin_lock(&cq_host->lock); in cqhci_irq()
783 for_each_set_bit(tag, &comp_status, cq_host->num_slots) { in cqhci_irq()
786 mmc_hostname(mmc), tag); in cqhci_irq()
787 cqhci_finish_mrq(mmc, tag); in cqhci_irq()
790 if (cq_host->waiting_for_idle && !cq_host->qcnt) { in cqhci_irq()
791 cq_host->waiting_for_idle = false; in cqhci_irq()
792 wake_up(&cq_host->wait_queue); in cqhci_irq()
795 spin_unlock(&cq_host->lock); in cqhci_irq()
799 wake_up(&cq_host->wait_queue); in cqhci_irq()
802 wake_up(&cq_host->wait_queue); in cqhci_irq()
813 spin_lock_irqsave(&cq_host->lock, flags); in cqhci_is_idle()
814 is_idle = !cq_host->qcnt || cq_host->recovery_halt; in cqhci_is_idle()
815 *ret = cq_host->recovery_halt ? -EBUSY : 0; in cqhci_is_idle()
816 cq_host->waiting_for_idle = !is_idle; in cqhci_is_idle()
817 spin_unlock_irqrestore(&cq_host->lock, flags); in cqhci_is_idle()
822 static int cqhci_wait_for_idle(struct mmc_host *mmc) in cqhci_wait_for_idle() argument
824 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_wait_for_idle()
827 wait_event(cq_host->wait_queue, cqhci_is_idle(cq_host, &ret)); in cqhci_wait_for_idle()
832 static bool cqhci_timeout(struct mmc_host *mmc, struct mmc_request *mrq, in cqhci_timeout() argument
835 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_timeout()
837 struct cqhci_slot *slot = &cq_host->slot[tag]; in cqhci_timeout()
841 spin_lock_irqsave(&cq_host->lock, flags); in cqhci_timeout()
842 timed_out = slot->mrq == mrq; in cqhci_timeout()
844 slot->flags |= CQHCI_EXTERNAL_TIMEOUT; in cqhci_timeout()
845 cqhci_recovery_needed(mmc, mrq, false); in cqhci_timeout()
846 *recovery_needed = cq_host->recovery_halt; in cqhci_timeout()
848 spin_unlock_irqrestore(&cq_host->lock, flags); in cqhci_timeout()
852 mmc_hostname(mmc), tag); in cqhci_timeout()
864 static bool cqhci_clear_all_tasks(struct mmc_host *mmc, unsigned int timeout) in cqhci_clear_all_tasks() argument
866 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_clear_all_tasks()
876 wait_event_timeout(cq_host->wait_queue, cqhci_tasks_cleared(cq_host), in cqhci_clear_all_tasks()
885 mmc_hostname(mmc)); in cqhci_clear_all_tasks()
895 static bool cqhci_halt(struct mmc_host *mmc, unsigned int timeout) in cqhci_halt() argument
897 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_halt()
910 wait_event_timeout(cq_host->wait_queue, cqhci_halted(cq_host), in cqhci_halt()
918 pr_debug("%s: cqhci: Failed to halt\n", mmc_hostname(mmc)); in cqhci_halt()
931 static void cqhci_recovery_start(struct mmc_host *mmc) in cqhci_recovery_start() argument
933 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_recovery_start()
935 pr_debug("%s: cqhci: %s\n", mmc_hostname(mmc), __func__); in cqhci_recovery_start()
937 WARN_ON(!cq_host->recovery_halt); in cqhci_recovery_start()
939 cqhci_halt(mmc, CQHCI_START_HALT_TIMEOUT); in cqhci_recovery_start()
941 if (cq_host->ops->disable) in cqhci_recovery_start()
942 cq_host->ops->disable(mmc, true); in cqhci_recovery_start()
944 mmc->cqe_on = false; in cqhci_recovery_start()
952 /* CRC errors might indicate re-tuning so prefer to report that */ in cqhci_error_from_flags()
954 return -EILSEQ; in cqhci_error_from_flags()
957 return -ETIMEDOUT; in cqhci_error_from_flags()
959 return -EIO; in cqhci_error_from_flags()
964 struct cqhci_slot *slot = &cq_host->slot[tag]; in cqhci_recover_mrq()
965 struct mmc_request *mrq = slot->mrq; in cqhci_recover_mrq()
971 slot->mrq = NULL; in cqhci_recover_mrq()
973 cq_host->qcnt -= 1; in cqhci_recover_mrq()
975 data = mrq->data; in cqhci_recover_mrq()
977 data->bytes_xfered = 0; in cqhci_recover_mrq()
978 data->error = cqhci_error_from_flags(slot->flags); in cqhci_recover_mrq()
980 mrq->cmd->error = cqhci_error_from_flags(slot->flags); in cqhci_recover_mrq()
983 mmc_cqe_request_done(cq_host->mmc, mrq); in cqhci_recover_mrq()
990 for (i = 0; i < cq_host->num_slots; i++) in cqhci_recover_mrqs()
995 * By now the command and data lines should be unused so there is no reason for
1004 static void cqhci_recovery_finish(struct mmc_host *mmc) in cqhci_recovery_finish() argument
1006 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_recovery_finish()
1011 pr_debug("%s: cqhci: %s\n", mmc_hostname(mmc), __func__); in cqhci_recovery_finish()
1013 WARN_ON(!cq_host->recovery_halt); in cqhci_recovery_finish()
1015 ok = cqhci_halt(mmc, CQHCI_FINISH_HALT_TIMEOUT); in cqhci_recovery_finish()
1017 if (!cqhci_clear_all_tasks(mmc, CQHCI_CLEAR_TIMEOUT)) in cqhci_recovery_finish()
1023 * be disabled/re-enabled, but not to disable before clearing tasks. in cqhci_recovery_finish()
1027 pr_debug("%s: cqhci: disable / re-enable\n", mmc_hostname(mmc)); in cqhci_recovery_finish()
1033 /* Be sure that there are no tasks */ in cqhci_recovery_finish()
1034 ok = cqhci_halt(mmc, CQHCI_FINISH_HALT_TIMEOUT); in cqhci_recovery_finish()
1035 if (!cqhci_clear_all_tasks(mmc, CQHCI_CLEAR_TIMEOUT)) in cqhci_recovery_finish()
1042 WARN_ON(cq_host->qcnt); in cqhci_recovery_finish()
1044 spin_lock_irqsave(&cq_host->lock, flags); in cqhci_recovery_finish()
1045 cq_host->qcnt = 0; in cqhci_recovery_finish()
1046 cq_host->recovery_halt = false; in cqhci_recovery_finish()
1047 mmc->cqe_on = false; in cqhci_recovery_finish()
1048 spin_unlock_irqrestore(&cq_host->lock, flags); in cqhci_recovery_finish()
1050 /* Ensure all writes are done before interrupts are re-enabled */ in cqhci_recovery_finish()
1057 pr_debug("%s: cqhci: recovery done\n", mmc_hostname(mmc)); in cqhci_recovery_finish()
1081 dev_dbg(&pdev->dev, "CMDQ not supported\n"); in cqhci_pltfm_init()
1082 return ERR_PTR(-EINVAL); in cqhci_pltfm_init()
1085 cq_host = devm_kzalloc(&pdev->dev, sizeof(*cq_host), GFP_KERNEL); in cqhci_pltfm_init()
1087 return ERR_PTR(-ENOMEM); in cqhci_pltfm_init()
1088 cq_host->mmio = devm_ioremap(&pdev->dev, in cqhci_pltfm_init()
1089 cqhci_memres->start, in cqhci_pltfm_init()
1091 if (!cq_host->mmio) { in cqhci_pltfm_init()
1092 dev_err(&pdev->dev, "failed to remap cqhci regs\n"); in cqhci_pltfm_init()
1093 return ERR_PTR(-EBUSY); in cqhci_pltfm_init()
1095 dev_dbg(&pdev->dev, "CMDQ ioremap: done\n"); in cqhci_pltfm_init()
1113 int cqhci_init(struct cqhci_host *cq_host, struct mmc_host *mmc, in cqhci_init() argument
1118 cq_host->dma64 = dma64; in cqhci_init()
1119 cq_host->mmc = mmc; in cqhci_init()
1120 cq_host->mmc->cqe_private = cq_host; in cqhci_init()
1122 cq_host->num_slots = NUM_SLOTS; in cqhci_init()
1123 cq_host->dcmd_slot = DCMD_SLOT; in cqhci_init()
1125 mmc->cqe_ops = &cqhci_cqe_ops; in cqhci_init()
1127 mmc->cqe_qdepth = NUM_SLOTS; in cqhci_init()
1128 if (mmc->caps2 & MMC_CAP2_CQE_DCMD) in cqhci_init()
1129 mmc->cqe_qdepth -= 1; in cqhci_init()
1131 cq_host->slot = devm_kcalloc(mmc_dev(mmc), cq_host->num_slots, in cqhci_init()
1132 sizeof(*cq_host->slot), GFP_KERNEL); in cqhci_init()
1133 if (!cq_host->slot) { in cqhci_init()
1134 err = -ENOMEM; in cqhci_init()
1138 spin_lock_init(&cq_host->lock); in cqhci_init()
1140 init_completion(&cq_host->halt_comp); in cqhci_init()
1141 init_waitqueue_head(&cq_host->wait_queue); in cqhci_init()
1144 mmc_hostname(mmc), cqhci_ver_major(cq_host), in cqhci_init()
1151 mmc_hostname(mmc), cqhci_ver_major(cq_host), in cqhci_init()