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 return mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY); in mxcmci_push()
611 static int mxcmci_transfer_data(struct mxcmci_host *host) in mxcmci_transfer_data() argument
613 struct mmc_data *data = host->req->data; in mxcmci_transfer_data()
617 host->data = data; in mxcmci_transfer_data()
618 host->datasize = 0; in mxcmci_transfer_data()
622 stat = mxcmci_pull(host, sg_virt(sg), sg->length); in mxcmci_transfer_data()
625 host->datasize += sg->length; in mxcmci_transfer_data()
629 stat = mxcmci_push(host, sg_virt(sg), sg->length); in mxcmci_transfer_data()
632 host->datasize += sg->length; in mxcmci_transfer_data()
634 stat = mxcmci_poll_status(host, STATUS_WRITE_OP_DONE); in mxcmci_transfer_data()
643 struct mxcmci_host *host = container_of(work, struct mxcmci_host, in mxcmci_datawork() local
645 int datastat = mxcmci_transfer_data(host); in mxcmci_datawork()
647 mxcmci_writel(host, STATUS_READ_OP_DONE | STATUS_WRITE_OP_DONE, in mxcmci_datawork()
649 mxcmci_finish_data(host, datastat); in mxcmci_datawork()
651 if (host->req->stop) { in mxcmci_datawork()
652 if (mxcmci_start_cmd(host, host->req->stop, 0)) { in mxcmci_datawork()
653 mxcmci_finish_request(host, host->req); in mxcmci_datawork()
657 mxcmci_finish_request(host, host->req); in mxcmci_datawork()
661 static void mxcmci_data_done(struct mxcmci_host *host, unsigned int stat) in mxcmci_data_done() argument
667 spin_lock_irqsave(&host->lock, flags); in mxcmci_data_done()
669 if (!host->data) { in mxcmci_data_done()
670 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_data_done()
674 if (!host->req) { in mxcmci_data_done()
675 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_data_done()
679 req = host->req; in mxcmci_data_done()
681 host->req = NULL; /* we will handle finish req below */ in mxcmci_data_done()
683 data_error = mxcmci_finish_data(host, stat); in mxcmci_data_done()
685 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_data_done()
687 mxcmci_read_response(host, stat); in mxcmci_data_done()
688 host->cmd = NULL; in mxcmci_data_done()
691 if (mxcmci_start_cmd(host, req->stop, 0)) { in mxcmci_data_done()
692 mxcmci_finish_request(host, req); in mxcmci_data_done()
696 mxcmci_finish_request(host, req); in mxcmci_data_done()
700 static void mxcmci_cmd_done(struct mxcmci_host *host, unsigned int stat) in mxcmci_cmd_done() argument
702 mxcmci_read_response(host, stat); in mxcmci_cmd_done()
703 host->cmd = NULL; in mxcmci_cmd_done()
705 if (!host->data && host->req) { in mxcmci_cmd_done()
706 mxcmci_finish_request(host, host->req); in mxcmci_cmd_done()
714 if (!mxcmci_use_dma(host) && host->data) in mxcmci_cmd_done()
715 schedule_work(&host->datawork); in mxcmci_cmd_done()
721 struct mxcmci_host *host = devid; in mxcmci_irq() local
726 stat = mxcmci_readl(host, MMC_REG_STATUS); in mxcmci_irq()
727 mxcmci_writel(host, in mxcmci_irq()
732 dev_dbg(mmc_dev(host->mmc), "%s: 0x%08x\n", __func__, stat); in mxcmci_irq()
734 spin_lock_irqsave(&host->lock, flags); in mxcmci_irq()
735 sdio_irq = (stat & STATUS_SDIO_INT_ACTIVE) && host->use_sdio; in mxcmci_irq()
736 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_irq()
738 if (mxcmci_use_dma(host) && (stat & (STATUS_WRITE_OP_DONE))) in mxcmci_irq()
739 mxcmci_writel(host, STATUS_WRITE_OP_DONE, MMC_REG_STATUS); in mxcmci_irq()
742 mxcmci_writel(host, STATUS_SDIO_INT_ACTIVE, MMC_REG_STATUS); in mxcmci_irq()
743 mmc_signal_sdio_irq(host->mmc); in mxcmci_irq()
747 mxcmci_cmd_done(host, stat); in mxcmci_irq()
749 if (mxcmci_use_dma(host) && (stat & STATUS_WRITE_OP_DONE)) { in mxcmci_irq()
750 del_timer(&host->watchdog); in mxcmci_irq()
751 mxcmci_data_done(host, stat); in mxcmci_irq()
754 if (host->default_irq_mask && in mxcmci_irq()
756 mmc_detect_change(host->mmc, msecs_to_jiffies(200)); in mxcmci_irq()
763 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_request() local
764 unsigned int cmdat = host->cmdat; in mxcmci_request()
767 WARN_ON(host->req != NULL); in mxcmci_request()
769 host->req = req; in mxcmci_request()
770 host->cmdat &= ~CMD_DAT_CONT_INIT; in mxcmci_request()
772 if (host->dma) in mxcmci_request()
773 host->do_dma = 1; in mxcmci_request()
776 error = mxcmci_setup_data(host, req->data); in mxcmci_request()
789 error = mxcmci_start_cmd(host, req->cmd, cmdat); in mxcmci_request()
793 mxcmci_finish_request(host, req); in mxcmci_request()
796 static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios) in mxcmci_set_clk_rate() argument
800 unsigned int clk_in = clk_get_rate(host->clk_per); in mxcmci_set_clk_rate()
823 mxcmci_writew(host, (prescaler << 4) | divider, MMC_REG_CLK_RATE); in mxcmci_set_clk_rate()
825 dev_dbg(mmc_dev(host->mmc), "scaler: %d divider: %d in: %d out: %d\n", in mxcmci_set_clk_rate()
831 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_setup_dma() local
832 struct dma_slave_config *config = &host->dma_slave_config; in mxcmci_setup_dma()
834 config->dst_addr = host->phys_base + MMC_REG_BUFFER_ACCESS; in mxcmci_setup_dma()
835 config->src_addr = host->phys_base + MMC_REG_BUFFER_ACCESS; in mxcmci_setup_dma()
838 config->dst_maxburst = host->burstlen; in mxcmci_setup_dma()
839 config->src_maxburst = host->burstlen; in mxcmci_setup_dma()
842 return dmaengine_slave_config(host->dma, config); in mxcmci_setup_dma()
847 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_set_ios() local
859 if (mxcmci_use_dma(host) && burstlen != host->burstlen) { in mxcmci_set_ios()
860 host->burstlen = burstlen; in mxcmci_set_ios()
863 dev_err(mmc_dev(host->mmc), in mxcmci_set_ios()
865 dma_release_channel(host->dma); in mxcmci_set_ios()
866 host->do_dma = 0; in mxcmci_set_ios()
867 host->dma = NULL; in mxcmci_set_ios()
872 host->cmdat |= CMD_DAT_CONT_BUS_WIDTH_4; in mxcmci_set_ios()
874 host->cmdat &= ~CMD_DAT_CONT_BUS_WIDTH_4; in mxcmci_set_ios()
876 if (host->power_mode != ios->power_mode) { in mxcmci_set_ios()
877 host->power_mode = ios->power_mode; in mxcmci_set_ios()
878 mxcmci_set_power(host, ios->vdd); in mxcmci_set_ios()
881 host->cmdat |= CMD_DAT_CONT_INIT; in mxcmci_set_ios()
885 mxcmci_set_clk_rate(host, ios->clock); in mxcmci_set_ios()
886 mxcmci_writew(host, STR_STP_CLK_START_CLK, MMC_REG_STR_STP_CLK); in mxcmci_set_ios()
888 mxcmci_writew(host, STR_STP_CLK_STOP_CLK, MMC_REG_STR_STP_CLK); in mxcmci_set_ios()
891 host->clock = ios->clock; in mxcmci_set_ios()
906 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_get_ro() local
908 if (host->pdata && host->pdata->get_ro) in mxcmci_get_ro()
909 return !!host->pdata->get_ro(mmc_dev(mmc)); in mxcmci_get_ro()
920 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_enable_sdio_irq() local
924 spin_lock_irqsave(&host->lock, flags); in mxcmci_enable_sdio_irq()
925 host->use_sdio = enable; in mxcmci_enable_sdio_irq()
926 int_cntr = mxcmci_readl(host, MMC_REG_INT_CNTR); in mxcmci_enable_sdio_irq()
933 mxcmci_writel(host, int_cntr, MMC_REG_INT_CNTR); in mxcmci_enable_sdio_irq()
934 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_enable_sdio_irq()
937 static void mxcmci_init_card(struct mmc_host *host, struct mmc_card *card) in mxcmci_init_card() argument
939 struct mxcmci_host *mxcmci = mmc_priv(host); in mxcmci_init_card()
949 host->caps &= ~MMC_CAP_4_BIT_DATA; in mxcmci_init_card()
951 host->caps |= MMC_CAP_4_BIT_DATA; in mxcmci_init_card()
956 struct mxcmci_host *host = param; in filter() local
961 chan->private = &host->dma_data; in filter()
969 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_watchdog() local
970 struct mmc_request *req = host->req; in mxcmci_watchdog()
971 unsigned int stat = mxcmci_readl(host, MMC_REG_STATUS); in mxcmci_watchdog()
973 if (host->dma_dir == DMA_FROM_DEVICE) { in mxcmci_watchdog()
974 dmaengine_terminate_all(host->dma); in mxcmci_watchdog()
975 dev_err(mmc_dev(host->mmc), in mxcmci_watchdog()
979 dev_err(mmc_dev(host->mmc), in mxcmci_watchdog()
982 mxcmci_softreset(host); in mxcmci_watchdog()
987 if (host->data) in mxcmci_watchdog()
988 host->data->error = -ETIMEDOUT; in mxcmci_watchdog()
989 host->req = NULL; in mxcmci_watchdog()
990 host->cmd = NULL; in mxcmci_watchdog()
991 host->data = NULL; in mxcmci_watchdog()
992 mmc_request_done(host->mmc, req); in mxcmci_watchdog()
1006 struct mxcmci_host *host; in mxcmci_probe() local
1023 mmc = mmc_alloc_host(sizeof(*host), &pdev->dev); in mxcmci_probe()
1027 host = mmc_priv(mmc); in mxcmci_probe()
1029 host->base = devm_ioremap_resource(&pdev->dev, res); in mxcmci_probe()
1030 if (IS_ERR(host->base)) { in mxcmci_probe()
1031 ret = PTR_ERR(host->base); in mxcmci_probe()
1035 host->phys_base = res->start; in mxcmci_probe()
1056 host->devtype = id_entry->driver_data; in mxcmci_probe()
1058 host->devtype = pdev->id_entry->driver_data; in mxcmci_probe()
1062 if (!is_mpc512x_mmc(host)) in mxcmci_probe()
1065 host->mmc = mmc; in mxcmci_probe()
1066 host->pdata = pdata; in mxcmci_probe()
1067 spin_lock_init(&host->lock); in mxcmci_probe()
1087 host->default_irq_mask = in mxcmci_probe()
1090 host->default_irq_mask = 0; in mxcmci_probe()
1092 host->clk_ipg = devm_clk_get(&pdev->dev, "ipg"); in mxcmci_probe()
1093 if (IS_ERR(host->clk_ipg)) { in mxcmci_probe()
1094 ret = PTR_ERR(host->clk_ipg); in mxcmci_probe()
1098 host->clk_per = devm_clk_get(&pdev->dev, "per"); in mxcmci_probe()
1099 if (IS_ERR(host->clk_per)) { in mxcmci_probe()
1100 ret = PTR_ERR(host->clk_per); in mxcmci_probe()
1104 clk_prepare_enable(host->clk_per); in mxcmci_probe()
1105 clk_prepare_enable(host->clk_ipg); in mxcmci_probe()
1107 mxcmci_softreset(host); in mxcmci_probe()
1109 host->rev_no = mxcmci_readw(host, MMC_REG_REV_NO); in mxcmci_probe()
1110 if (host->rev_no != 0x400) { in mxcmci_probe()
1112 dev_err(mmc_dev(host->mmc), "wrong rev.no. 0x%08x. aborting.\n", in mxcmci_probe()
1113 host->rev_no); in mxcmci_probe()
1117 mmc->f_min = clk_get_rate(host->clk_per) >> 16; in mxcmci_probe()
1118 mmc->f_max = clk_get_rate(host->clk_per) >> 1; in mxcmci_probe()
1121 mxcmci_writew(host, 0x2db4, MMC_REG_READ_TO); in mxcmci_probe()
1123 mxcmci_writel(host, host->default_irq_mask, MMC_REG_INT_CNTR); in mxcmci_probe()
1125 if (!host->pdata) { in mxcmci_probe()
1126 host->dma = dma_request_slave_channel(&pdev->dev, "rx-tx"); in mxcmci_probe()
1130 host->dmareq = res->start; in mxcmci_probe()
1131 host->dma_data.peripheral_type = IMX_DMATYPE_SDHC; in mxcmci_probe()
1132 host->dma_data.priority = DMA_PRIO_LOW; in mxcmci_probe()
1133 host->dma_data.dma_request = host->dmareq; in mxcmci_probe()
1136 host->dma = dma_request_channel(mask, filter, host); in mxcmci_probe()
1139 if (host->dma) in mxcmci_probe()
1141 host->dma->device->dev); in mxcmci_probe()
1143 dev_info(mmc_dev(host->mmc), "dma not available. Using PIO\n"); in mxcmci_probe()
1145 INIT_WORK(&host->datawork, mxcmci_datawork); in mxcmci_probe()
1148 dev_name(&pdev->dev), host); in mxcmci_probe()
1154 if (host->pdata && host->pdata->init) { in mxcmci_probe()
1155 ret = host->pdata->init(&pdev->dev, mxcmci_detect_irq, in mxcmci_probe()
1156 host->mmc); in mxcmci_probe()
1161 init_timer(&host->watchdog); in mxcmci_probe()
1162 host->watchdog.function = &mxcmci_watchdog; in mxcmci_probe()
1163 host->watchdog.data = (unsigned long)mmc; in mxcmci_probe()
1170 if (host->dma) in mxcmci_probe()
1171 dma_release_channel(host->dma); in mxcmci_probe()
1174 clk_disable_unprepare(host->clk_per); in mxcmci_probe()
1175 clk_disable_unprepare(host->clk_ipg); in mxcmci_probe()
1186 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_remove() local
1190 if (host->pdata && host->pdata->exit) in mxcmci_remove()
1191 host->pdata->exit(&pdev->dev, mmc); in mxcmci_remove()
1193 if (host->dma) in mxcmci_remove()
1194 dma_release_channel(host->dma); in mxcmci_remove()
1196 clk_disable_unprepare(host->clk_per); in mxcmci_remove()
1197 clk_disable_unprepare(host->clk_ipg); in mxcmci_remove()
1207 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_suspend() local
1209 clk_disable_unprepare(host->clk_per); in mxcmci_suspend()
1210 clk_disable_unprepare(host->clk_ipg); in mxcmci_suspend()
1217 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_resume() local
1219 clk_prepare_enable(host->clk_per); in mxcmci_resume()
1220 clk_prepare_enable(host->clk_ipg); in mxcmci_resume()