Lines Matching refs:host
197 static inline int is_imx31_mmc(struct mxcmci_host *host) in is_imx31_mmc() argument
199 return host->devtype == IMX31_MMC; in is_imx31_mmc()
202 static inline int is_mpc512x_mmc(struct mxcmci_host *host) in is_mpc512x_mmc() argument
204 return host->devtype == MPC512X_MMC; in is_mpc512x_mmc()
207 static inline u32 mxcmci_readl(struct mxcmci_host *host, int reg) in mxcmci_readl() argument
210 return ioread32be(host->base + reg); in mxcmci_readl()
212 return readl(host->base + reg); in mxcmci_readl()
215 static inline void mxcmci_writel(struct mxcmci_host *host, u32 val, int reg) in mxcmci_writel() argument
218 iowrite32be(val, host->base + reg); in mxcmci_writel()
220 writel(val, host->base + reg); in mxcmci_writel()
223 static inline u16 mxcmci_readw(struct mxcmci_host *host, int reg) in mxcmci_readw() argument
226 return ioread32be(host->base + reg); in mxcmci_readw()
228 return readw(host->base + reg); in mxcmci_readw()
231 static inline void mxcmci_writew(struct mxcmci_host *host, u16 val, int reg) in mxcmci_writew() argument
234 iowrite32be(val, host->base + reg); in mxcmci_writew()
236 writew(val, host->base + reg); in mxcmci_writew()
239 static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios);
241 static void mxcmci_set_power(struct mxcmci_host *host, unsigned int vdd) in mxcmci_set_power() argument
243 if (!IS_ERR(host->mmc->supply.vmmc)) { in mxcmci_set_power()
244 if (host->power_mode == MMC_POWER_UP) in mxcmci_set_power()
245 mmc_regulator_set_ocr(host->mmc, in mxcmci_set_power()
246 host->mmc->supply.vmmc, vdd); in mxcmci_set_power()
247 else if (host->power_mode == MMC_POWER_OFF) in mxcmci_set_power()
248 mmc_regulator_set_ocr(host->mmc, in mxcmci_set_power()
249 host->mmc->supply.vmmc, 0); in mxcmci_set_power()
252 if (host->pdata && host->pdata->setpower) in mxcmci_set_power()
253 host->pdata->setpower(mmc_dev(host->mmc), vdd); in mxcmci_set_power()
256 static inline int mxcmci_use_dma(struct mxcmci_host *host) in mxcmci_use_dma() argument
258 return host->do_dma; in mxcmci_use_dma()
261 static void mxcmci_softreset(struct mxcmci_host *host) in mxcmci_softreset() argument
265 dev_dbg(mmc_dev(host->mmc), "mxcmci_softreset\n"); in mxcmci_softreset()
268 mxcmci_writew(host, STR_STP_CLK_RESET, MMC_REG_STR_STP_CLK); in mxcmci_softreset()
269 mxcmci_writew(host, STR_STP_CLK_RESET | STR_STP_CLK_START_CLK, in mxcmci_softreset()
273 mxcmci_writew(host, STR_STP_CLK_START_CLK, MMC_REG_STR_STP_CLK); in mxcmci_softreset()
275 mxcmci_writew(host, 0xff, MMC_REG_RES_TO); in mxcmci_softreset()
301 static int mxcmci_setup_data(struct mxcmci_host *host, struct mmc_data *data) in mxcmci_setup_data() argument
313 host->data = data; in mxcmci_setup_data()
316 mxcmci_writew(host, nob, MMC_REG_NOB); in mxcmci_setup_data()
317 mxcmci_writew(host, blksz, MMC_REG_BLK_LEN); in mxcmci_setup_data()
318 host->datasize = datasize; in mxcmci_setup_data()
320 if (!mxcmci_use_dma(host)) in mxcmci_setup_data()
325 host->do_dma = 0; in mxcmci_setup_data()
331 host->dma_dir = DMA_FROM_DEVICE; in mxcmci_setup_data()
334 host->dma_dir = DMA_TO_DEVICE; in mxcmci_setup_data()
340 nents = dma_map_sg(host->dma->device->dev, data->sg, in mxcmci_setup_data()
341 data->sg_len, host->dma_dir); in mxcmci_setup_data()
345 host->desc = dmaengine_prep_slave_sg(host->dma, in mxcmci_setup_data()
349 if (!host->desc) { in mxcmci_setup_data()
350 dma_unmap_sg(host->dma->device->dev, data->sg, data->sg_len, in mxcmci_setup_data()
351 host->dma_dir); in mxcmci_setup_data()
352 host->do_dma = 0; in mxcmci_setup_data()
357 dmaengine_submit(host->desc); in mxcmci_setup_data()
358 dma_async_issue_pending(host->dma); in mxcmci_setup_data()
360 mod_timer(&host->watchdog, jiffies + msecs_to_jiffies(MXCMCI_TIMEOUT_MS)); in mxcmci_setup_data()
365 static void mxcmci_cmd_done(struct mxcmci_host *host, unsigned int stat);
366 static void mxcmci_data_done(struct mxcmci_host *host, unsigned int stat);
370 struct mxcmci_host *host = data; in mxcmci_dma_callback() local
373 del_timer(&host->watchdog); in mxcmci_dma_callback()
375 stat = mxcmci_readl(host, MMC_REG_STATUS); in mxcmci_dma_callback()
377 dev_dbg(mmc_dev(host->mmc), "%s: 0x%08x\n", __func__, stat); in mxcmci_dma_callback()
379 mxcmci_data_done(host, stat); in mxcmci_dma_callback()
382 static int mxcmci_start_cmd(struct mxcmci_host *host, struct mmc_command *cmd, in mxcmci_start_cmd() argument
385 u32 int_cntr = host->default_irq_mask; in mxcmci_start_cmd()
388 WARN_ON(host->cmd != NULL); in mxcmci_start_cmd()
389 host->cmd = cmd; in mxcmci_start_cmd()
405 dev_err(mmc_dev(host->mmc), "unhandled response type 0x%x\n", in mxcmci_start_cmd()
413 if (mxcmci_use_dma(host)) { in mxcmci_start_cmd()
414 if (host->dma_dir == DMA_FROM_DEVICE) { in mxcmci_start_cmd()
415 host->desc->callback = mxcmci_dma_callback; in mxcmci_start_cmd()
416 host->desc->callback_param = host; in mxcmci_start_cmd()
422 spin_lock_irqsave(&host->lock, flags); in mxcmci_start_cmd()
423 if (host->use_sdio) in mxcmci_start_cmd()
425 mxcmci_writel(host, int_cntr, MMC_REG_INT_CNTR); in mxcmci_start_cmd()
426 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_start_cmd()
428 mxcmci_writew(host, cmd->opcode, MMC_REG_CMD); in mxcmci_start_cmd()
429 mxcmci_writel(host, cmd->arg, MMC_REG_ARG); in mxcmci_start_cmd()
430 mxcmci_writew(host, cmdat, MMC_REG_CMD_DAT_CONT); in mxcmci_start_cmd()
435 static void mxcmci_finish_request(struct mxcmci_host *host, in mxcmci_finish_request() argument
438 u32 int_cntr = host->default_irq_mask; in mxcmci_finish_request()
441 spin_lock_irqsave(&host->lock, flags); in mxcmci_finish_request()
442 if (host->use_sdio) in mxcmci_finish_request()
444 mxcmci_writel(host, int_cntr, MMC_REG_INT_CNTR); in mxcmci_finish_request()
445 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_finish_request()
447 host->req = NULL; in mxcmci_finish_request()
448 host->cmd = NULL; in mxcmci_finish_request()
449 host->data = NULL; in mxcmci_finish_request()
451 mmc_request_done(host->mmc, req); in mxcmci_finish_request()
454 static int mxcmci_finish_data(struct mxcmci_host *host, unsigned int stat) in mxcmci_finish_data() argument
456 struct mmc_data *data = host->data; in mxcmci_finish_data()
459 if (mxcmci_use_dma(host)) { in mxcmci_finish_data()
460 dma_unmap_sg(host->dma->device->dev, data->sg, data->sg_len, in mxcmci_finish_data()
461 host->dma_dir); in mxcmci_finish_data()
466 dev_dbg(mmc_dev(host->mmc), "request failed. status: 0x%08x\n", in mxcmci_finish_data()
469 dev_err(mmc_dev(host->mmc), "%s: -EILSEQ\n", __func__); in mxcmci_finish_data()
474 dev_err(mmc_dev(host->mmc), in mxcmci_finish_data()
478 dev_err(mmc_dev(host->mmc), in mxcmci_finish_data()
483 dev_err(mmc_dev(host->mmc), in mxcmci_finish_data()
487 dev_err(mmc_dev(host->mmc), "%s: -EIO\n", __func__); in mxcmci_finish_data()
491 data->bytes_xfered = host->datasize; in mxcmci_finish_data()
496 host->data = NULL; in mxcmci_finish_data()
501 static void mxcmci_read_response(struct mxcmci_host *host, unsigned int stat) in mxcmci_read_response() argument
503 struct mmc_command *cmd = host->cmd; in mxcmci_read_response()
511 dev_dbg(mmc_dev(host->mmc), "CMD TIMEOUT\n"); in mxcmci_read_response()
514 dev_dbg(mmc_dev(host->mmc), "cmd crc error\n"); in mxcmci_read_response()
521 a = mxcmci_readw(host, MMC_REG_RES_FIFO); in mxcmci_read_response()
522 b = mxcmci_readw(host, MMC_REG_RES_FIFO); in mxcmci_read_response()
526 a = mxcmci_readw(host, MMC_REG_RES_FIFO); in mxcmci_read_response()
527 b = mxcmci_readw(host, MMC_REG_RES_FIFO); in mxcmci_read_response()
528 c = mxcmci_readw(host, MMC_REG_RES_FIFO); in mxcmci_read_response()
534 static int mxcmci_poll_status(struct mxcmci_host *host, u32 mask) in mxcmci_poll_status() argument
540 stat = mxcmci_readl(host, MMC_REG_STATUS); in mxcmci_poll_status()
544 mxcmci_softreset(host); in mxcmci_poll_status()
545 mxcmci_set_clk_rate(host, host->clock); in mxcmci_poll_status()
554 static int mxcmci_pull(struct mxcmci_host *host, void *_buf, int bytes) in mxcmci_pull() argument
560 stat = mxcmci_poll_status(host, in mxcmci_pull()
564 *buf++ = cpu_to_le32(mxcmci_readl(host, MMC_REG_BUFFER_ACCESS)); in mxcmci_pull()
572 stat = mxcmci_poll_status(host, in mxcmci_pull()
576 tmp = cpu_to_le32(mxcmci_readl(host, MMC_REG_BUFFER_ACCESS)); in mxcmci_pull()
583 static int mxcmci_push(struct mxcmci_host *host, void *_buf, int bytes) in mxcmci_push() argument
589 stat = mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY); in mxcmci_push()
592 mxcmci_writel(host, cpu_to_le32(*buf++), MMC_REG_BUFFER_ACCESS); in mxcmci_push()
600 stat = mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY); in mxcmci_push()
605 mxcmci_writel(host, cpu_to_le32(tmp), MMC_REG_BUFFER_ACCESS); in mxcmci_push()
608 stat = mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY); in mxcmci_push()
615 static int mxcmci_transfer_data(struct mxcmci_host *host) in mxcmci_transfer_data() argument
617 struct mmc_data *data = host->req->data; in mxcmci_transfer_data()
621 host->data = data; in mxcmci_transfer_data()
622 host->datasize = 0; in mxcmci_transfer_data()
626 stat = mxcmci_pull(host, sg_virt(sg), sg->length); in mxcmci_transfer_data()
629 host->datasize += sg->length; in mxcmci_transfer_data()
633 stat = mxcmci_push(host, sg_virt(sg), sg->length); in mxcmci_transfer_data()
636 host->datasize += sg->length; in mxcmci_transfer_data()
638 stat = mxcmci_poll_status(host, STATUS_WRITE_OP_DONE); in mxcmci_transfer_data()
647 struct mxcmci_host *host = container_of(work, struct mxcmci_host, in mxcmci_datawork() local
649 int datastat = mxcmci_transfer_data(host); in mxcmci_datawork()
651 mxcmci_writel(host, STATUS_READ_OP_DONE | STATUS_WRITE_OP_DONE, in mxcmci_datawork()
653 mxcmci_finish_data(host, datastat); in mxcmci_datawork()
655 if (host->req->stop) { in mxcmci_datawork()
656 if (mxcmci_start_cmd(host, host->req->stop, 0)) { in mxcmci_datawork()
657 mxcmci_finish_request(host, host->req); in mxcmci_datawork()
661 mxcmci_finish_request(host, host->req); in mxcmci_datawork()
665 static void mxcmci_data_done(struct mxcmci_host *host, unsigned int stat) in mxcmci_data_done() argument
671 spin_lock_irqsave(&host->lock, flags); in mxcmci_data_done()
673 if (!host->data) { in mxcmci_data_done()
674 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_data_done()
678 if (!host->req) { in mxcmci_data_done()
679 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_data_done()
683 req = host->req; in mxcmci_data_done()
685 host->req = NULL; /* we will handle finish req below */ in mxcmci_data_done()
687 data_error = mxcmci_finish_data(host, stat); in mxcmci_data_done()
689 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_data_done()
691 mxcmci_read_response(host, stat); in mxcmci_data_done()
692 host->cmd = NULL; in mxcmci_data_done()
695 if (mxcmci_start_cmd(host, req->stop, 0)) { in mxcmci_data_done()
696 mxcmci_finish_request(host, req); in mxcmci_data_done()
700 mxcmci_finish_request(host, req); in mxcmci_data_done()
704 static void mxcmci_cmd_done(struct mxcmci_host *host, unsigned int stat) in mxcmci_cmd_done() argument
706 mxcmci_read_response(host, stat); in mxcmci_cmd_done()
707 host->cmd = NULL; in mxcmci_cmd_done()
709 if (!host->data && host->req) { in mxcmci_cmd_done()
710 mxcmci_finish_request(host, host->req); in mxcmci_cmd_done()
718 if (!mxcmci_use_dma(host) && host->data) in mxcmci_cmd_done()
719 schedule_work(&host->datawork); in mxcmci_cmd_done()
725 struct mxcmci_host *host = devid; in mxcmci_irq() local
730 stat = mxcmci_readl(host, MMC_REG_STATUS); in mxcmci_irq()
731 mxcmci_writel(host, in mxcmci_irq()
736 dev_dbg(mmc_dev(host->mmc), "%s: 0x%08x\n", __func__, stat); in mxcmci_irq()
738 spin_lock_irqsave(&host->lock, flags); in mxcmci_irq()
739 sdio_irq = (stat & STATUS_SDIO_INT_ACTIVE) && host->use_sdio; in mxcmci_irq()
740 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_irq()
742 if (mxcmci_use_dma(host) && (stat & (STATUS_WRITE_OP_DONE))) in mxcmci_irq()
743 mxcmci_writel(host, STATUS_WRITE_OP_DONE, MMC_REG_STATUS); in mxcmci_irq()
746 mxcmci_writel(host, STATUS_SDIO_INT_ACTIVE, MMC_REG_STATUS); in mxcmci_irq()
747 mmc_signal_sdio_irq(host->mmc); in mxcmci_irq()
751 mxcmci_cmd_done(host, stat); in mxcmci_irq()
753 if (mxcmci_use_dma(host) && (stat & STATUS_WRITE_OP_DONE)) { in mxcmci_irq()
754 del_timer(&host->watchdog); in mxcmci_irq()
755 mxcmci_data_done(host, stat); in mxcmci_irq()
758 if (host->default_irq_mask && in mxcmci_irq()
760 mmc_detect_change(host->mmc, msecs_to_jiffies(200)); in mxcmci_irq()
767 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_request() local
768 unsigned int cmdat = host->cmdat; in mxcmci_request()
771 WARN_ON(host->req != NULL); in mxcmci_request()
773 host->req = req; in mxcmci_request()
774 host->cmdat &= ~CMD_DAT_CONT_INIT; in mxcmci_request()
776 if (host->dma) in mxcmci_request()
777 host->do_dma = 1; in mxcmci_request()
780 error = mxcmci_setup_data(host, req->data); in mxcmci_request()
793 error = mxcmci_start_cmd(host, req->cmd, cmdat); in mxcmci_request()
797 mxcmci_finish_request(host, req); in mxcmci_request()
800 static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios) in mxcmci_set_clk_rate() argument
804 unsigned int clk_in = clk_get_rate(host->clk_per); in mxcmci_set_clk_rate()
827 mxcmci_writew(host, (prescaler << 4) | divider, MMC_REG_CLK_RATE); in mxcmci_set_clk_rate()
829 dev_dbg(mmc_dev(host->mmc), "scaler: %d divider: %d in: %d out: %d\n", in mxcmci_set_clk_rate()
835 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_setup_dma() local
836 struct dma_slave_config *config = &host->dma_slave_config; in mxcmci_setup_dma()
838 config->dst_addr = host->phys_base + MMC_REG_BUFFER_ACCESS; in mxcmci_setup_dma()
839 config->src_addr = host->phys_base + MMC_REG_BUFFER_ACCESS; in mxcmci_setup_dma()
842 config->dst_maxburst = host->burstlen; in mxcmci_setup_dma()
843 config->src_maxburst = host->burstlen; in mxcmci_setup_dma()
846 return dmaengine_slave_config(host->dma, config); in mxcmci_setup_dma()
851 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_set_ios() local
863 if (mxcmci_use_dma(host) && burstlen != host->burstlen) { in mxcmci_set_ios()
864 host->burstlen = burstlen; in mxcmci_set_ios()
867 dev_err(mmc_dev(host->mmc), in mxcmci_set_ios()
869 dma_release_channel(host->dma); in mxcmci_set_ios()
870 host->do_dma = 0; in mxcmci_set_ios()
871 host->dma = NULL; in mxcmci_set_ios()
876 host->cmdat |= CMD_DAT_CONT_BUS_WIDTH_4; in mxcmci_set_ios()
878 host->cmdat &= ~CMD_DAT_CONT_BUS_WIDTH_4; in mxcmci_set_ios()
880 if (host->power_mode != ios->power_mode) { in mxcmci_set_ios()
881 host->power_mode = ios->power_mode; in mxcmci_set_ios()
882 mxcmci_set_power(host, ios->vdd); in mxcmci_set_ios()
885 host->cmdat |= CMD_DAT_CONT_INIT; in mxcmci_set_ios()
889 mxcmci_set_clk_rate(host, ios->clock); in mxcmci_set_ios()
890 mxcmci_writew(host, STR_STP_CLK_START_CLK, MMC_REG_STR_STP_CLK); in mxcmci_set_ios()
892 mxcmci_writew(host, STR_STP_CLK_STOP_CLK, MMC_REG_STR_STP_CLK); in mxcmci_set_ios()
895 host->clock = ios->clock; in mxcmci_set_ios()
910 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_get_ro() local
912 if (host->pdata && host->pdata->get_ro) in mxcmci_get_ro()
913 return !!host->pdata->get_ro(mmc_dev(mmc)); in mxcmci_get_ro()
924 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_enable_sdio_irq() local
928 spin_lock_irqsave(&host->lock, flags); in mxcmci_enable_sdio_irq()
929 host->use_sdio = enable; in mxcmci_enable_sdio_irq()
930 int_cntr = mxcmci_readl(host, MMC_REG_INT_CNTR); in mxcmci_enable_sdio_irq()
937 mxcmci_writel(host, int_cntr, MMC_REG_INT_CNTR); in mxcmci_enable_sdio_irq()
938 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_enable_sdio_irq()
941 static void mxcmci_init_card(struct mmc_host *host, struct mmc_card *card) in mxcmci_init_card() argument
943 struct mxcmci_host *mxcmci = mmc_priv(host); in mxcmci_init_card()
953 host->caps &= ~MMC_CAP_4_BIT_DATA; in mxcmci_init_card()
955 host->caps |= MMC_CAP_4_BIT_DATA; in mxcmci_init_card()
960 struct mxcmci_host *host = param; in filter() local
965 chan->private = &host->dma_data; in filter()
973 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_watchdog() local
974 struct mmc_request *req = host->req; in mxcmci_watchdog()
975 unsigned int stat = mxcmci_readl(host, MMC_REG_STATUS); in mxcmci_watchdog()
977 if (host->dma_dir == DMA_FROM_DEVICE) { in mxcmci_watchdog()
978 dmaengine_terminate_all(host->dma); in mxcmci_watchdog()
979 dev_err(mmc_dev(host->mmc), in mxcmci_watchdog()
983 dev_err(mmc_dev(host->mmc), in mxcmci_watchdog()
986 mxcmci_softreset(host); in mxcmci_watchdog()
991 if (host->data) in mxcmci_watchdog()
992 host->data->error = -ETIMEDOUT; in mxcmci_watchdog()
993 host->req = NULL; in mxcmci_watchdog()
994 host->cmd = NULL; in mxcmci_watchdog()
995 host->data = NULL; in mxcmci_watchdog()
996 mmc_request_done(host->mmc, req); in mxcmci_watchdog()
1010 struct mxcmci_host *host; in mxcmci_probe() local
1027 mmc = mmc_alloc_host(sizeof(*host), &pdev->dev); in mxcmci_probe()
1031 host = mmc_priv(mmc); in mxcmci_probe()
1033 host->base = devm_ioremap_resource(&pdev->dev, res); in mxcmci_probe()
1034 if (IS_ERR(host->base)) { in mxcmci_probe()
1035 ret = PTR_ERR(host->base); in mxcmci_probe()
1039 host->phys_base = res->start; in mxcmci_probe()
1060 host->devtype = id_entry->driver_data; in mxcmci_probe()
1062 host->devtype = pdev->id_entry->driver_data; in mxcmci_probe()
1066 if (!is_mpc512x_mmc(host)) in mxcmci_probe()
1069 host->mmc = mmc; in mxcmci_probe()
1070 host->pdata = pdata; in mxcmci_probe()
1071 spin_lock_init(&host->lock); in mxcmci_probe()
1091 host->default_irq_mask = in mxcmci_probe()
1094 host->default_irq_mask = 0; in mxcmci_probe()
1096 host->clk_ipg = devm_clk_get(&pdev->dev, "ipg"); in mxcmci_probe()
1097 if (IS_ERR(host->clk_ipg)) { in mxcmci_probe()
1098 ret = PTR_ERR(host->clk_ipg); in mxcmci_probe()
1102 host->clk_per = devm_clk_get(&pdev->dev, "per"); in mxcmci_probe()
1103 if (IS_ERR(host->clk_per)) { in mxcmci_probe()
1104 ret = PTR_ERR(host->clk_per); in mxcmci_probe()
1108 clk_prepare_enable(host->clk_per); in mxcmci_probe()
1109 clk_prepare_enable(host->clk_ipg); in mxcmci_probe()
1111 mxcmci_softreset(host); in mxcmci_probe()
1113 host->rev_no = mxcmci_readw(host, MMC_REG_REV_NO); in mxcmci_probe()
1114 if (host->rev_no != 0x400) { in mxcmci_probe()
1116 dev_err(mmc_dev(host->mmc), "wrong rev.no. 0x%08x. aborting.\n", in mxcmci_probe()
1117 host->rev_no); in mxcmci_probe()
1121 mmc->f_min = clk_get_rate(host->clk_per) >> 16; in mxcmci_probe()
1122 mmc->f_max = clk_get_rate(host->clk_per) >> 1; in mxcmci_probe()
1125 mxcmci_writew(host, 0x2db4, MMC_REG_READ_TO); in mxcmci_probe()
1127 mxcmci_writel(host, host->default_irq_mask, MMC_REG_INT_CNTR); in mxcmci_probe()
1129 if (!host->pdata) { in mxcmci_probe()
1130 host->dma = dma_request_slave_channel(&pdev->dev, "rx-tx"); in mxcmci_probe()
1134 host->dmareq = res->start; in mxcmci_probe()
1135 host->dma_data.peripheral_type = IMX_DMATYPE_SDHC; in mxcmci_probe()
1136 host->dma_data.priority = DMA_PRIO_LOW; in mxcmci_probe()
1137 host->dma_data.dma_request = host->dmareq; in mxcmci_probe()
1140 host->dma = dma_request_channel(mask, filter, host); in mxcmci_probe()
1143 if (host->dma) in mxcmci_probe()
1145 host->dma->device->dev); in mxcmci_probe()
1147 dev_info(mmc_dev(host->mmc), "dma not available. Using PIO\n"); in mxcmci_probe()
1149 INIT_WORK(&host->datawork, mxcmci_datawork); in mxcmci_probe()
1152 dev_name(&pdev->dev), host); in mxcmci_probe()
1158 if (host->pdata && host->pdata->init) { in mxcmci_probe()
1159 ret = host->pdata->init(&pdev->dev, mxcmci_detect_irq, in mxcmci_probe()
1160 host->mmc); in mxcmci_probe()
1165 init_timer(&host->watchdog); in mxcmci_probe()
1166 host->watchdog.function = &mxcmci_watchdog; in mxcmci_probe()
1167 host->watchdog.data = (unsigned long)mmc; in mxcmci_probe()
1174 if (host->dma) in mxcmci_probe()
1175 dma_release_channel(host->dma); in mxcmci_probe()
1178 clk_disable_unprepare(host->clk_per); in mxcmci_probe()
1179 clk_disable_unprepare(host->clk_ipg); in mxcmci_probe()
1190 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_remove() local
1194 if (host->pdata && host->pdata->exit) in mxcmci_remove()
1195 host->pdata->exit(&pdev->dev, mmc); in mxcmci_remove()
1197 if (host->dma) in mxcmci_remove()
1198 dma_release_channel(host->dma); in mxcmci_remove()
1200 clk_disable_unprepare(host->clk_per); in mxcmci_remove()
1201 clk_disable_unprepare(host->clk_ipg); in mxcmci_remove()
1211 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_suspend() local
1213 clk_disable_unprepare(host->clk_per); in mxcmci_suspend()
1214 clk_disable_unprepare(host->clk_ipg); in mxcmci_suspend()
1221 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_resume() local
1223 clk_prepare_enable(host->clk_per); in mxcmci_resume()
1224 clk_prepare_enable(host->clk_ipg); in mxcmci_resume()