• Home
  • Raw
  • Download

Lines Matching full:mmc

16 #include <linux/mmc/mmc.h>
17 #include <linux/mmc/host.h>
18 #include <linux/mmc/card.h>
50 (cq_host->mmc->max_segs * tag * in get_trans_desc_dma()
57 (cq_host->trans_desc_len * cq_host->mmc->max_segs * tag); in get_trans_desc()
72 if (tag == DCMD_SLOT && (cq_host->mmc->caps2 & MMC_CAP2_CQE_DCMD)) { in setup_trans_desc()
99 pr_err("%s: " DRV_NAME ": " f, mmc_hostname(mmc), ## x)
103 struct mmc_host *mmc = cq_host->mmc; in cqhci_dumpregs() local
142 cq_host->ops->dumpregs(mmc); in cqhci_dumpregs()
196 cq_host->data_size = cq_host->trans_desc_len * cq_host->mmc->max_segs * in cqhci_host_alloc_tdl()
197 cq_host->mmc->cqe_qdepth; in cqhci_host_alloc_tdl()
200 mmc_hostname(cq_host->mmc), cq_host->desc_size, cq_host->data_size, in cqhci_host_alloc_tdl()
209 cq_host->desc_base = dmam_alloc_coherent(mmc_dev(cq_host->mmc), in cqhci_host_alloc_tdl()
216 cq_host->trans_desc_base = dmam_alloc_coherent(mmc_dev(cq_host->mmc), in cqhci_host_alloc_tdl()
221 dmam_free_coherent(mmc_dev(cq_host->mmc), cq_host->desc_size, in cqhci_host_alloc_tdl()
230 mmc_hostname(cq_host->mmc), cq_host->desc_base, cq_host->trans_desc_base, in cqhci_host_alloc_tdl()
242 struct mmc_host *mmc = cq_host->mmc; in __cqhci_enable() local
255 if (mmc->caps2 & MMC_CAP2_CQE_DCMD) in __cqhci_enable()
279 mmc->cqe_on = true; in __cqhci_enable()
282 cq_host->ops->enable(mmc); in __cqhci_enable()
300 cq_host->mmc->cqe_on = false; in __cqhci_disable()
305 int cqhci_deactivate(struct mmc_host *mmc) in cqhci_deactivate() argument
307 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_deactivate()
316 int cqhci_resume(struct mmc_host *mmc) in cqhci_resume() argument
323 static int cqhci_enable(struct mmc_host *mmc, struct mmc_card *card) in cqhci_enable() argument
325 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_enable()
339 mmc_hostname(mmc), err); in cqhci_enable()
361 static void cqhci_off(struct mmc_host *mmc) in cqhci_off() argument
363 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_off()
367 if (!cq_host->enabled || !mmc->cqe_on || cq_host->recovery_halt) in cqhci_off()
371 cq_host->ops->disable(mmc, false); in cqhci_off()
378 pr_err("%s: cqhci: CQE stuck on\n", mmc_hostname(mmc)); in cqhci_off()
380 pr_debug("%s: cqhci: CQE off\n", mmc_hostname(mmc)); in cqhci_off()
383 cq_host->ops->post_disable(mmc); in cqhci_off()
385 mmc->cqe_on = false; in cqhci_off()
388 static void cqhci_disable(struct mmc_host *mmc) in cqhci_disable() argument
390 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_disable()
395 cqhci_off(mmc); in cqhci_disable()
399 dmam_free_coherent(mmc_dev(mmc), cq_host->data_size, in cqhci_disable()
403 dmam_free_coherent(mmc_dev(mmc), cq_host->desc_size, in cqhci_disable()
510 static void cqhci_prep_dcmd_desc(struct mmc_host *mmc, in cqhci_prep_dcmd_desc() argument
518 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_prep_dcmd_desc()
544 cq_host->ops->update_dcmd_desc(mmc, mrq, &data); in cqhci_prep_dcmd_desc()
548 mmc_hostname(mmc), mrq->cmd->opcode, timing, resp_type); in cqhci_prep_dcmd_desc()
570 static int cqhci_request(struct mmc_host *mmc, struct mmc_request *mrq) in cqhci_request() argument
576 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_request()
580 pr_err("%s: cqhci: not enabled\n", mmc_hostname(mmc)); in cqhci_request()
588 if (!mmc->cqe_on) { in cqhci_request()
590 cq_host->ops->pre_enable(mmc); in cqhci_request()
593 mmc->cqe_on = true; in cqhci_request()
594 pr_debug("%s: cqhci: CQE on\n", mmc_hostname(mmc)); in cqhci_request()
597 mmc_hostname(mmc)); in cqhci_request()
600 cq_host->ops->enable(mmc); in cqhci_request()
610 mmc_hostname(mmc), err); in cqhci_request()
614 cqhci_prep_dcmd_desc(mmc, mrq); in cqhci_request()
633 mmc_hostname(mmc), tag); in cqhci_request()
638 cqhci_post_req(mmc, mrq); in cqhci_request()
643 static void cqhci_recovery_needed(struct mmc_host *mmc, struct mmc_request *mrq, in cqhci_recovery_needed() argument
646 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_recovery_needed()
650 pr_debug("%s: cqhci: recovery needed\n", mmc_hostname(mmc)); in cqhci_recovery_needed()
671 static void cqhci_error_irq(struct mmc_host *mmc, u32 status, int cmd_error, in cqhci_error_irq() argument
674 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_error_irq()
684 mmc_hostname(mmc), status, cmd_error, data_error, terri); in cqhci_error_irq()
692 mmc_hostname(mmc), status, cmd_error, data_error, in cqhci_error_irq()
702 cqhci_recovery_needed(mmc, slot->mrq, true); in cqhci_error_irq()
711 cqhci_recovery_needed(mmc, slot->mrq, true); in cqhci_error_irq()
725 cqhci_recovery_needed(mmc, slot->mrq, true); in cqhci_error_irq()
734 static void cqhci_finish_mrq(struct mmc_host *mmc, unsigned int tag) in cqhci_finish_mrq() argument
736 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_finish_mrq()
743 mmc_hostname(mmc), tag); in cqhci_finish_mrq()
765 mmc_cqe_request_done(mmc, mrq); in cqhci_finish_mrq()
768 irqreturn_t cqhci_irq(struct mmc_host *mmc, u32 intmask, int cmd_error, in cqhci_irq() argument
773 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_irq()
778 pr_debug("%s: cqhci: IRQ status: 0x%08x\n", mmc_hostname(mmc), status); in cqhci_irq()
781 cqhci_error_irq(mmc, status, cmd_error, data_error); in cqhci_irq()
788 mmc_hostname(mmc), comp_status); in cqhci_irq()
795 mmc_hostname(mmc), tag); in cqhci_irq()
796 cqhci_finish_mrq(mmc, tag); in cqhci_irq()
831 static int cqhci_wait_for_idle(struct mmc_host *mmc) in cqhci_wait_for_idle() argument
833 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_wait_for_idle()
841 static bool cqhci_timeout(struct mmc_host *mmc, struct mmc_request *mrq, in cqhci_timeout() argument
844 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_timeout()
854 cqhci_recovery_needed(mmc, mrq, false); in cqhci_timeout()
861 mmc_hostname(mmc), tag); in cqhci_timeout()
873 static bool cqhci_clear_all_tasks(struct mmc_host *mmc, unsigned int timeout) in cqhci_clear_all_tasks() argument
875 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_clear_all_tasks()
894 mmc_hostname(mmc)); in cqhci_clear_all_tasks()
904 static bool cqhci_halt(struct mmc_host *mmc, unsigned int timeout) in cqhci_halt() argument
906 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_halt()
927 pr_debug("%s: cqhci: Failed to halt\n", mmc_hostname(mmc)); in cqhci_halt()
940 static void cqhci_recovery_start(struct mmc_host *mmc) in cqhci_recovery_start() argument
942 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_recovery_start()
944 pr_debug("%s: cqhci: %s\n", mmc_hostname(mmc), __func__); in cqhci_recovery_start()
948 cqhci_halt(mmc, CQHCI_START_HALT_TIMEOUT); in cqhci_recovery_start()
951 cq_host->ops->disable(mmc, true); in cqhci_recovery_start()
953 mmc->cqe_on = false; in cqhci_recovery_start()
992 mmc_cqe_request_done(cq_host->mmc, mrq); in cqhci_recover_mrq()
1013 static void cqhci_recovery_finish(struct mmc_host *mmc) in cqhci_recovery_finish() argument
1015 struct cqhci_host *cq_host = mmc->cqe_private; in cqhci_recovery_finish()
1020 pr_debug("%s: cqhci: %s\n", mmc_hostname(mmc), __func__); in cqhci_recovery_finish()
1024 ok = cqhci_halt(mmc, CQHCI_FINISH_HALT_TIMEOUT); in cqhci_recovery_finish()
1026 if (!cqhci_clear_all_tasks(mmc, CQHCI_CLEAR_TIMEOUT)) in cqhci_recovery_finish()
1036 pr_debug("%s: cqhci: disable / re-enable\n", mmc_hostname(mmc)); in cqhci_recovery_finish()
1043 ok = cqhci_halt(mmc, CQHCI_FINISH_HALT_TIMEOUT); in cqhci_recovery_finish()
1044 if (!cqhci_clear_all_tasks(mmc, CQHCI_CLEAR_TIMEOUT)) in cqhci_recovery_finish()
1056 mmc->cqe_on = false; in cqhci_recovery_finish()
1066 pr_debug("%s: cqhci: recovery done\n", mmc_hostname(mmc)); in cqhci_recovery_finish()
1122 int cqhci_init(struct cqhci_host *cq_host, struct mmc_host *mmc, in cqhci_init() argument
1128 cq_host->mmc = mmc; in cqhci_init()
1129 cq_host->mmc->cqe_private = cq_host; in cqhci_init()
1134 mmc->cqe_ops = &cqhci_cqe_ops; in cqhci_init()
1136 mmc->cqe_qdepth = NUM_SLOTS; in cqhci_init()
1137 if (mmc->caps2 & MMC_CAP2_CQE_DCMD) in cqhci_init()
1138 mmc->cqe_qdepth -= 1; in cqhci_init()
1140 cq_host->slot = devm_kcalloc(mmc_dev(mmc), cq_host->num_slots, in cqhci_init()
1153 mmc_hostname(mmc), cqhci_ver_major(cq_host), in cqhci_init()
1160 mmc_hostname(mmc), cqhci_ver_major(cq_host), in cqhci_init()