Lines Matching full:host
2 * linux/drivers/mmc/host/mxcmmc.c - Freescale i.MX MMCI driver
29 #include <linux/mmc/host.h>
198 static inline int is_imx31_mmc(struct mxcmci_host *host) in is_imx31_mmc() argument
200 return host->devtype == IMX31_MMC; in is_imx31_mmc()
203 static inline int is_mpc512x_mmc(struct mxcmci_host *host) in is_mpc512x_mmc() argument
205 return host->devtype == MPC512X_MMC; in is_mpc512x_mmc()
208 static inline u32 mxcmci_readl(struct mxcmci_host *host, int reg) in mxcmci_readl() argument
211 return ioread32be(host->base + reg); in mxcmci_readl()
213 return readl(host->base + reg); in mxcmci_readl()
216 static inline void mxcmci_writel(struct mxcmci_host *host, u32 val, int reg) in mxcmci_writel() argument
219 iowrite32be(val, host->base + reg); in mxcmci_writel()
221 writel(val, host->base + reg); in mxcmci_writel()
224 static inline u16 mxcmci_readw(struct mxcmci_host *host, int reg) in mxcmci_readw() argument
227 return ioread32be(host->base + reg); in mxcmci_readw()
229 return readw(host->base + reg); in mxcmci_readw()
232 static inline void mxcmci_writew(struct mxcmci_host *host, u16 val, int reg) in mxcmci_writew() argument
235 iowrite32be(val, host->base + reg); in mxcmci_writew()
237 writew(val, host->base + reg); in mxcmci_writew()
240 static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios);
242 static void mxcmci_set_power(struct mxcmci_host *host, unsigned int vdd) in mxcmci_set_power() argument
244 if (!IS_ERR(host->mmc->supply.vmmc)) { in mxcmci_set_power()
245 if (host->power_mode == MMC_POWER_UP) in mxcmci_set_power()
246 mmc_regulator_set_ocr(host->mmc, in mxcmci_set_power()
247 host->mmc->supply.vmmc, vdd); in mxcmci_set_power()
248 else if (host->power_mode == MMC_POWER_OFF) in mxcmci_set_power()
249 mmc_regulator_set_ocr(host->mmc, in mxcmci_set_power()
250 host->mmc->supply.vmmc, 0); in mxcmci_set_power()
253 if (host->pdata && host->pdata->setpower) in mxcmci_set_power()
254 host->pdata->setpower(mmc_dev(host->mmc), vdd); in mxcmci_set_power()
257 static inline int mxcmci_use_dma(struct mxcmci_host *host) in mxcmci_use_dma() argument
259 return host->do_dma; in mxcmci_use_dma()
262 static void mxcmci_softreset(struct mxcmci_host *host) in mxcmci_softreset() argument
266 dev_dbg(mmc_dev(host->mmc), "mxcmci_softreset\n"); in mxcmci_softreset()
269 mxcmci_writew(host, STR_STP_CLK_RESET, MMC_REG_STR_STP_CLK); in mxcmci_softreset()
270 mxcmci_writew(host, STR_STP_CLK_RESET | STR_STP_CLK_START_CLK, in mxcmci_softreset()
274 mxcmci_writew(host, STR_STP_CLK_START_CLK, MMC_REG_STR_STP_CLK); in mxcmci_softreset()
276 mxcmci_writew(host, 0xff, MMC_REG_RES_TO); in mxcmci_softreset()
302 static int mxcmci_setup_data(struct mxcmci_host *host, struct mmc_data *data) in mxcmci_setup_data() argument
311 host->data = data; in mxcmci_setup_data()
314 mxcmci_writew(host, nob, MMC_REG_NOB); in mxcmci_setup_data()
315 mxcmci_writew(host, blksz, MMC_REG_BLK_LEN); in mxcmci_setup_data()
316 host->datasize = datasize; in mxcmci_setup_data()
318 if (!mxcmci_use_dma(host)) in mxcmci_setup_data()
323 host->do_dma = 0; in mxcmci_setup_data()
329 host->dma_dir = DMA_FROM_DEVICE; in mxcmci_setup_data()
332 host->dma_dir = DMA_TO_DEVICE; in mxcmci_setup_data()
338 nents = dma_map_sg(host->dma->device->dev, data->sg, in mxcmci_setup_data()
339 data->sg_len, host->dma_dir); in mxcmci_setup_data()
343 host->desc = dmaengine_prep_slave_sg(host->dma, in mxcmci_setup_data()
347 if (!host->desc) { in mxcmci_setup_data()
348 dma_unmap_sg(host->dma->device->dev, data->sg, data->sg_len, in mxcmci_setup_data()
349 host->dma_dir); in mxcmci_setup_data()
350 host->do_dma = 0; in mxcmci_setup_data()
355 dmaengine_submit(host->desc); in mxcmci_setup_data()
356 dma_async_issue_pending(host->dma); in mxcmci_setup_data()
358 mod_timer(&host->watchdog, jiffies + msecs_to_jiffies(MXCMCI_TIMEOUT_MS)); in mxcmci_setup_data()
363 static void mxcmci_cmd_done(struct mxcmci_host *host, unsigned int stat);
364 static void mxcmci_data_done(struct mxcmci_host *host, unsigned int stat);
368 struct mxcmci_host *host = data; in mxcmci_dma_callback() local
371 del_timer(&host->watchdog); in mxcmci_dma_callback()
373 stat = mxcmci_readl(host, MMC_REG_STATUS); in mxcmci_dma_callback()
375 dev_dbg(mmc_dev(host->mmc), "%s: 0x%08x\n", __func__, stat); in mxcmci_dma_callback()
377 mxcmci_data_done(host, stat); in mxcmci_dma_callback()
380 static int mxcmci_start_cmd(struct mxcmci_host *host, struct mmc_command *cmd, in mxcmci_start_cmd() argument
383 u32 int_cntr = host->default_irq_mask; in mxcmci_start_cmd()
386 WARN_ON(host->cmd != NULL); in mxcmci_start_cmd()
387 host->cmd = cmd; in mxcmci_start_cmd()
403 dev_err(mmc_dev(host->mmc), "unhandled response type 0x%x\n", in mxcmci_start_cmd()
411 if (mxcmci_use_dma(host)) { in mxcmci_start_cmd()
412 if (host->dma_dir == DMA_FROM_DEVICE) { in mxcmci_start_cmd()
413 host->desc->callback = mxcmci_dma_callback; in mxcmci_start_cmd()
414 host->desc->callback_param = host; in mxcmci_start_cmd()
420 spin_lock_irqsave(&host->lock, flags); in mxcmci_start_cmd()
421 if (host->use_sdio) in mxcmci_start_cmd()
423 mxcmci_writel(host, int_cntr, MMC_REG_INT_CNTR); in mxcmci_start_cmd()
424 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_start_cmd()
426 mxcmci_writew(host, cmd->opcode, MMC_REG_CMD); in mxcmci_start_cmd()
427 mxcmci_writel(host, cmd->arg, MMC_REG_ARG); in mxcmci_start_cmd()
428 mxcmci_writew(host, cmdat, MMC_REG_CMD_DAT_CONT); in mxcmci_start_cmd()
433 static void mxcmci_finish_request(struct mxcmci_host *host, in mxcmci_finish_request() argument
436 u32 int_cntr = host->default_irq_mask; in mxcmci_finish_request()
439 spin_lock_irqsave(&host->lock, flags); in mxcmci_finish_request()
440 if (host->use_sdio) in mxcmci_finish_request()
442 mxcmci_writel(host, int_cntr, MMC_REG_INT_CNTR); in mxcmci_finish_request()
443 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_finish_request()
445 host->req = NULL; in mxcmci_finish_request()
446 host->cmd = NULL; in mxcmci_finish_request()
447 host->data = NULL; in mxcmci_finish_request()
449 mmc_request_done(host->mmc, req); in mxcmci_finish_request()
452 static int mxcmci_finish_data(struct mxcmci_host *host, unsigned int stat) in mxcmci_finish_data() argument
454 struct mmc_data *data = host->data; in mxcmci_finish_data()
457 if (mxcmci_use_dma(host)) { in mxcmci_finish_data()
458 dma_unmap_sg(host->dma->device->dev, data->sg, data->sg_len, in mxcmci_finish_data()
459 host->dma_dir); in mxcmci_finish_data()
464 dev_dbg(mmc_dev(host->mmc), "request failed. status: 0x%08x\n", in mxcmci_finish_data()
467 dev_err(mmc_dev(host->mmc), "%s: -EILSEQ\n", __func__); in mxcmci_finish_data()
472 dev_err(mmc_dev(host->mmc), in mxcmci_finish_data()
476 dev_err(mmc_dev(host->mmc), in mxcmci_finish_data()
481 dev_err(mmc_dev(host->mmc), in mxcmci_finish_data()
485 dev_err(mmc_dev(host->mmc), "%s: -EIO\n", __func__); in mxcmci_finish_data()
489 data->bytes_xfered = host->datasize; in mxcmci_finish_data()
494 host->data = NULL; in mxcmci_finish_data()
499 static void mxcmci_read_response(struct mxcmci_host *host, unsigned int stat) in mxcmci_read_response() argument
501 struct mmc_command *cmd = host->cmd; in mxcmci_read_response()
509 dev_dbg(mmc_dev(host->mmc), "CMD TIMEOUT\n"); in mxcmci_read_response()
512 dev_dbg(mmc_dev(host->mmc), "cmd crc error\n"); in mxcmci_read_response()
519 a = mxcmci_readw(host, MMC_REG_RES_FIFO); in mxcmci_read_response()
520 b = mxcmci_readw(host, MMC_REG_RES_FIFO); in mxcmci_read_response()
524 a = mxcmci_readw(host, MMC_REG_RES_FIFO); in mxcmci_read_response()
525 b = mxcmci_readw(host, MMC_REG_RES_FIFO); in mxcmci_read_response()
526 c = mxcmci_readw(host, MMC_REG_RES_FIFO); in mxcmci_read_response()
532 static int mxcmci_poll_status(struct mxcmci_host *host, u32 mask) in mxcmci_poll_status() argument
538 stat = mxcmci_readl(host, MMC_REG_STATUS); in mxcmci_poll_status()
542 mxcmci_softreset(host); in mxcmci_poll_status()
543 mxcmci_set_clk_rate(host, host->clock); in mxcmci_poll_status()
552 static int mxcmci_pull(struct mxcmci_host *host, void *_buf, int bytes) in mxcmci_pull() argument
558 stat = mxcmci_poll_status(host, in mxcmci_pull()
562 *buf++ = cpu_to_le32(mxcmci_readl(host, MMC_REG_BUFFER_ACCESS)); in mxcmci_pull()
570 stat = mxcmci_poll_status(host, in mxcmci_pull()
574 tmp = cpu_to_le32(mxcmci_readl(host, MMC_REG_BUFFER_ACCESS)); in mxcmci_pull()
581 static int mxcmci_push(struct mxcmci_host *host, void *_buf, int bytes) in mxcmci_push() argument
587 stat = mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY); in mxcmci_push()
590 mxcmci_writel(host, cpu_to_le32(*buf++), MMC_REG_BUFFER_ACCESS); in mxcmci_push()
598 stat = mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY); in mxcmci_push()
603 mxcmci_writel(host, cpu_to_le32(tmp), MMC_REG_BUFFER_ACCESS); in mxcmci_push()
606 return mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY); in mxcmci_push()
609 static int mxcmci_transfer_data(struct mxcmci_host *host) in mxcmci_transfer_data() argument
611 struct mmc_data *data = host->req->data; in mxcmci_transfer_data()
615 host->data = data; in mxcmci_transfer_data()
616 host->datasize = 0; in mxcmci_transfer_data()
620 stat = mxcmci_pull(host, sg_virt(sg), sg->length); in mxcmci_transfer_data()
623 host->datasize += sg->length; in mxcmci_transfer_data()
627 stat = mxcmci_push(host, sg_virt(sg), sg->length); in mxcmci_transfer_data()
630 host->datasize += sg->length; in mxcmci_transfer_data()
632 stat = mxcmci_poll_status(host, STATUS_WRITE_OP_DONE); in mxcmci_transfer_data()
641 struct mxcmci_host *host = container_of(work, struct mxcmci_host, in mxcmci_datawork() local
643 int datastat = mxcmci_transfer_data(host); in mxcmci_datawork()
645 mxcmci_writel(host, STATUS_READ_OP_DONE | STATUS_WRITE_OP_DONE, in mxcmci_datawork()
647 mxcmci_finish_data(host, datastat); in mxcmci_datawork()
649 if (host->req->stop) { in mxcmci_datawork()
650 if (mxcmci_start_cmd(host, host->req->stop, 0)) { in mxcmci_datawork()
651 mxcmci_finish_request(host, host->req); in mxcmci_datawork()
655 mxcmci_finish_request(host, host->req); in mxcmci_datawork()
659 static void mxcmci_data_done(struct mxcmci_host *host, unsigned int stat) in mxcmci_data_done() argument
665 spin_lock_irqsave(&host->lock, flags); in mxcmci_data_done()
667 if (!host->data) { in mxcmci_data_done()
668 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_data_done()
672 if (!host->req) { in mxcmci_data_done()
673 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_data_done()
677 req = host->req; in mxcmci_data_done()
679 host->req = NULL; /* we will handle finish req below */ in mxcmci_data_done()
681 data_error = mxcmci_finish_data(host, stat); in mxcmci_data_done()
683 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_data_done()
688 mxcmci_read_response(host, stat); in mxcmci_data_done()
689 host->cmd = NULL; in mxcmci_data_done()
692 if (mxcmci_start_cmd(host, req->stop, 0)) { in mxcmci_data_done()
693 mxcmci_finish_request(host, req); in mxcmci_data_done()
697 mxcmci_finish_request(host, req); in mxcmci_data_done()
701 static void mxcmci_cmd_done(struct mxcmci_host *host, unsigned int stat) in mxcmci_cmd_done() argument
703 mxcmci_read_response(host, stat); in mxcmci_cmd_done()
704 host->cmd = NULL; in mxcmci_cmd_done()
706 if (!host->data && host->req) { in mxcmci_cmd_done()
707 mxcmci_finish_request(host, host->req); in mxcmci_cmd_done()
715 if (!mxcmci_use_dma(host) && host->data) in mxcmci_cmd_done()
716 schedule_work(&host->datawork); in mxcmci_cmd_done()
722 struct mxcmci_host *host = devid; in mxcmci_irq() local
727 stat = mxcmci_readl(host, MMC_REG_STATUS); in mxcmci_irq()
728 mxcmci_writel(host, in mxcmci_irq()
733 dev_dbg(mmc_dev(host->mmc), "%s: 0x%08x\n", __func__, stat); in mxcmci_irq()
735 spin_lock_irqsave(&host->lock, flags); in mxcmci_irq()
736 sdio_irq = (stat & STATUS_SDIO_INT_ACTIVE) && host->use_sdio; in mxcmci_irq()
737 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_irq()
739 if (mxcmci_use_dma(host) && (stat & (STATUS_WRITE_OP_DONE))) in mxcmci_irq()
740 mxcmci_writel(host, STATUS_WRITE_OP_DONE, MMC_REG_STATUS); in mxcmci_irq()
743 mxcmci_writel(host, STATUS_SDIO_INT_ACTIVE, MMC_REG_STATUS); in mxcmci_irq()
744 mmc_signal_sdio_irq(host->mmc); in mxcmci_irq()
748 mxcmci_cmd_done(host, stat); in mxcmci_irq()
750 if (mxcmci_use_dma(host) && (stat & STATUS_WRITE_OP_DONE)) { in mxcmci_irq()
751 del_timer(&host->watchdog); in mxcmci_irq()
752 mxcmci_data_done(host, stat); in mxcmci_irq()
755 if (host->default_irq_mask && in mxcmci_irq()
757 mmc_detect_change(host->mmc, msecs_to_jiffies(200)); in mxcmci_irq()
764 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_request() local
765 unsigned int cmdat = host->cmdat; in mxcmci_request()
768 WARN_ON(host->req != NULL); in mxcmci_request()
770 host->req = req; in mxcmci_request()
771 host->cmdat &= ~CMD_DAT_CONT_INIT; in mxcmci_request()
773 if (host->dma) in mxcmci_request()
774 host->do_dma = 1; in mxcmci_request()
777 error = mxcmci_setup_data(host, req->data); in mxcmci_request()
790 error = mxcmci_start_cmd(host, req->cmd, cmdat); in mxcmci_request()
794 mxcmci_finish_request(host, req); in mxcmci_request()
797 static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios) in mxcmci_set_clk_rate() argument
801 unsigned int clk_in = clk_get_rate(host->clk_per); in mxcmci_set_clk_rate()
824 mxcmci_writew(host, (prescaler << 4) | divider, MMC_REG_CLK_RATE); in mxcmci_set_clk_rate()
826 dev_dbg(mmc_dev(host->mmc), "scaler: %d divider: %d in: %d out: %d\n", in mxcmci_set_clk_rate()
832 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_setup_dma() local
833 struct dma_slave_config *config = &host->dma_slave_config; in mxcmci_setup_dma()
835 config->dst_addr = host->phys_base + MMC_REG_BUFFER_ACCESS; in mxcmci_setup_dma()
836 config->src_addr = host->phys_base + MMC_REG_BUFFER_ACCESS; in mxcmci_setup_dma()
839 config->dst_maxburst = host->burstlen; in mxcmci_setup_dma()
840 config->src_maxburst = host->burstlen; in mxcmci_setup_dma()
843 return dmaengine_slave_config(host->dma, config); in mxcmci_setup_dma()
848 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_set_ios() local
860 if (mxcmci_use_dma(host) && burstlen != host->burstlen) { in mxcmci_set_ios()
861 host->burstlen = burstlen; in mxcmci_set_ios()
864 dev_err(mmc_dev(host->mmc), in mxcmci_set_ios()
866 dma_release_channel(host->dma); in mxcmci_set_ios()
867 host->do_dma = 0; in mxcmci_set_ios()
868 host->dma = NULL; in mxcmci_set_ios()
873 host->cmdat |= CMD_DAT_CONT_BUS_WIDTH_4; in mxcmci_set_ios()
875 host->cmdat &= ~CMD_DAT_CONT_BUS_WIDTH_4; in mxcmci_set_ios()
877 if (host->power_mode != ios->power_mode) { in mxcmci_set_ios()
878 host->power_mode = ios->power_mode; in mxcmci_set_ios()
879 mxcmci_set_power(host, ios->vdd); in mxcmci_set_ios()
882 host->cmdat |= CMD_DAT_CONT_INIT; in mxcmci_set_ios()
886 mxcmci_set_clk_rate(host, ios->clock); in mxcmci_set_ios()
887 mxcmci_writew(host, STR_STP_CLK_START_CLK, MMC_REG_STR_STP_CLK); in mxcmci_set_ios()
889 mxcmci_writew(host, STR_STP_CLK_STOP_CLK, MMC_REG_STR_STP_CLK); in mxcmci_set_ios()
892 host->clock = ios->clock; in mxcmci_set_ios()
907 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_get_ro() local
909 if (host->pdata && host->pdata->get_ro) in mxcmci_get_ro()
910 return !!host->pdata->get_ro(mmc_dev(mmc)); in mxcmci_get_ro()
921 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_enable_sdio_irq() local
925 spin_lock_irqsave(&host->lock, flags); in mxcmci_enable_sdio_irq()
926 host->use_sdio = enable; in mxcmci_enable_sdio_irq()
927 int_cntr = mxcmci_readl(host, MMC_REG_INT_CNTR); in mxcmci_enable_sdio_irq()
934 mxcmci_writel(host, int_cntr, MMC_REG_INT_CNTR); in mxcmci_enable_sdio_irq()
935 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_enable_sdio_irq()
938 static void mxcmci_init_card(struct mmc_host *host, struct mmc_card *card) in mxcmci_init_card() argument
940 struct mxcmci_host *mxcmci = mmc_priv(host); in mxcmci_init_card()
950 host->caps &= ~MMC_CAP_4_BIT_DATA; in mxcmci_init_card()
952 host->caps |= MMC_CAP_4_BIT_DATA; in mxcmci_init_card()
957 struct mxcmci_host *host = param; in filter() local
962 chan->private = &host->dma_data; in filter()
969 struct mxcmci_host *host = from_timer(host, t, watchdog); 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
1025 mmc = mmc_alloc_host(sizeof(*host), &pdev->dev); in mxcmci_probe()
1029 host = mmc_priv(mmc); in mxcmci_probe()
1031 host->base = devm_ioremap_resource(&pdev->dev, res); in mxcmci_probe()
1032 if (IS_ERR(host->base)) { in mxcmci_probe()
1033 ret = PTR_ERR(host->base); in mxcmci_probe()
1037 host->phys_base = res->start; in mxcmci_probe()
1058 host->devtype = id_entry->driver_data; in mxcmci_probe()
1060 host->devtype = pdev->id_entry->driver_data; in mxcmci_probe()
1064 if (!is_mpc512x_mmc(host)) in mxcmci_probe()
1067 host->mmc = mmc; in mxcmci_probe()
1068 host->pdata = pdata; in mxcmci_probe()
1069 spin_lock_init(&host->lock); in mxcmci_probe()
1089 host->default_irq_mask = in mxcmci_probe()
1092 host->default_irq_mask = 0; in mxcmci_probe()
1094 host->clk_ipg = devm_clk_get(&pdev->dev, "ipg"); in mxcmci_probe()
1095 if (IS_ERR(host->clk_ipg)) { in mxcmci_probe()
1096 ret = PTR_ERR(host->clk_ipg); in mxcmci_probe()
1100 host->clk_per = devm_clk_get(&pdev->dev, "per"); in mxcmci_probe()
1101 if (IS_ERR(host->clk_per)) { in mxcmci_probe()
1102 ret = PTR_ERR(host->clk_per); in mxcmci_probe()
1106 ret = clk_prepare_enable(host->clk_per); in mxcmci_probe()
1110 ret = clk_prepare_enable(host->clk_ipg); in mxcmci_probe()
1114 mxcmci_softreset(host); in mxcmci_probe()
1116 host->rev_no = mxcmci_readw(host, MMC_REG_REV_NO); in mxcmci_probe()
1117 if (host->rev_no != 0x400) { in mxcmci_probe()
1119 dev_err(mmc_dev(host->mmc), "wrong rev.no. 0x%08x. aborting.\n", in mxcmci_probe()
1120 host->rev_no); in mxcmci_probe()
1124 mmc->f_min = clk_get_rate(host->clk_per) >> 16; in mxcmci_probe()
1125 mmc->f_max = clk_get_rate(host->clk_per) >> 1; in mxcmci_probe()
1128 mxcmci_writew(host, 0x2db4, MMC_REG_READ_TO); in mxcmci_probe()
1130 mxcmci_writel(host, host->default_irq_mask, MMC_REG_INT_CNTR); in mxcmci_probe()
1132 if (!host->pdata) { in mxcmci_probe()
1133 host->dma = dma_request_slave_channel(&pdev->dev, "rx-tx"); in mxcmci_probe()
1137 host->dmareq = res->start; in mxcmci_probe()
1138 host->dma_data.peripheral_type = IMX_DMATYPE_SDHC; in mxcmci_probe()
1139 host->dma_data.priority = DMA_PRIO_LOW; in mxcmci_probe()
1140 host->dma_data.dma_request = host->dmareq; in mxcmci_probe()
1143 host->dma = dma_request_channel(mask, filter, host); in mxcmci_probe()
1146 if (host->dma) in mxcmci_probe()
1148 host->dma->device->dev); in mxcmci_probe()
1150 dev_info(mmc_dev(host->mmc), "dma not available. Using PIO\n"); in mxcmci_probe()
1152 INIT_WORK(&host->datawork, mxcmci_datawork); in mxcmci_probe()
1155 dev_name(&pdev->dev), host); in mxcmci_probe()
1161 if (host->pdata && host->pdata->init) { in mxcmci_probe()
1162 ret = host->pdata->init(&pdev->dev, mxcmci_detect_irq, in mxcmci_probe()
1163 host->mmc); in mxcmci_probe()
1168 timer_setup(&host->watchdog, mxcmci_watchdog, 0); in mxcmci_probe()
1175 if (host->dma) in mxcmci_probe()
1176 dma_release_channel(host->dma); in mxcmci_probe()
1179 clk_disable_unprepare(host->clk_ipg); in mxcmci_probe()
1181 clk_disable_unprepare(host->clk_per); in mxcmci_probe()
1192 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_remove() local
1196 if (host->pdata && host->pdata->exit) in mxcmci_remove()
1197 host->pdata->exit(&pdev->dev, mmc); in mxcmci_remove()
1199 if (host->dma) in mxcmci_remove()
1200 dma_release_channel(host->dma); in mxcmci_remove()
1202 clk_disable_unprepare(host->clk_per); in mxcmci_remove()
1203 clk_disable_unprepare(host->clk_ipg); in mxcmci_remove()
1214 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_suspend() local
1216 clk_disable_unprepare(host->clk_per); in mxcmci_suspend()
1217 clk_disable_unprepare(host->clk_ipg); in mxcmci_suspend()
1224 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_resume() local
1227 ret = clk_prepare_enable(host->clk_per); in mxcmci_resume()
1231 ret = clk_prepare_enable(host->clk_ipg); in mxcmci_resume()
1233 clk_disable_unprepare(host->clk_per); in mxcmci_resume()