Lines Matching full:host

3  *  linux/drivers/mmc/host/mxcmmc.c - Freescale i.MX MMCI driver
25 #include <linux/mmc/host.h>
176 static inline int is_imx31_mmc(struct mxcmci_host *host) in is_imx31_mmc() argument
178 return host->devtype == IMX31_MMC; in is_imx31_mmc()
181 static inline int is_mpc512x_mmc(struct mxcmci_host *host) in is_mpc512x_mmc() argument
183 return host->devtype == MPC512X_MMC; in is_mpc512x_mmc()
186 static inline u32 mxcmci_readl(struct mxcmci_host *host, int reg) in mxcmci_readl() argument
189 return ioread32be(host->base + reg); in mxcmci_readl()
191 return readl(host->base + reg); in mxcmci_readl()
194 static inline void mxcmci_writel(struct mxcmci_host *host, u32 val, int reg) in mxcmci_writel() argument
197 iowrite32be(val, host->base + reg); in mxcmci_writel()
199 writel(val, host->base + reg); in mxcmci_writel()
202 static inline u16 mxcmci_readw(struct mxcmci_host *host, int reg) in mxcmci_readw() argument
205 return ioread32be(host->base + reg); in mxcmci_readw()
207 return readw(host->base + reg); in mxcmci_readw()
210 static inline void mxcmci_writew(struct mxcmci_host *host, u16 val, int reg) in mxcmci_writew() argument
213 iowrite32be(val, host->base + reg); in mxcmci_writew()
215 writew(val, host->base + reg); in mxcmci_writew()
218 static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios);
220 static void mxcmci_set_power(struct mxcmci_host *host, unsigned int vdd) in mxcmci_set_power() argument
222 if (!IS_ERR(host->mmc->supply.vmmc)) { in mxcmci_set_power()
223 if (host->power_mode == MMC_POWER_UP) in mxcmci_set_power()
224 mmc_regulator_set_ocr(host->mmc, in mxcmci_set_power()
225 host->mmc->supply.vmmc, vdd); in mxcmci_set_power()
226 else if (host->power_mode == MMC_POWER_OFF) in mxcmci_set_power()
227 mmc_regulator_set_ocr(host->mmc, in mxcmci_set_power()
228 host->mmc->supply.vmmc, 0); in mxcmci_set_power()
231 if (host->pdata && host->pdata->setpower) in mxcmci_set_power()
232 host->pdata->setpower(mmc_dev(host->mmc), vdd); in mxcmci_set_power()
235 static inline int mxcmci_use_dma(struct mxcmci_host *host) in mxcmci_use_dma() argument
237 return host->do_dma; in mxcmci_use_dma()
240 static void mxcmci_softreset(struct mxcmci_host *host) in mxcmci_softreset() argument
244 dev_dbg(mmc_dev(host->mmc), "mxcmci_softreset\n"); in mxcmci_softreset()
247 mxcmci_writew(host, STR_STP_CLK_RESET, MMC_REG_STR_STP_CLK); in mxcmci_softreset()
248 mxcmci_writew(host, STR_STP_CLK_RESET | STR_STP_CLK_START_CLK, in mxcmci_softreset()
252 mxcmci_writew(host, STR_STP_CLK_START_CLK, MMC_REG_STR_STP_CLK); in mxcmci_softreset()
254 mxcmci_writew(host, 0xff, MMC_REG_RES_TO); in mxcmci_softreset()
280 static int mxcmci_setup_data(struct mxcmci_host *host, struct mmc_data *data) in mxcmci_setup_data() argument
289 host->data = data; in mxcmci_setup_data()
292 mxcmci_writew(host, nob, MMC_REG_NOB); in mxcmci_setup_data()
293 mxcmci_writew(host, blksz, MMC_REG_BLK_LEN); in mxcmci_setup_data()
294 host->datasize = datasize; in mxcmci_setup_data()
296 if (!mxcmci_use_dma(host)) in mxcmci_setup_data()
301 host->do_dma = 0; in mxcmci_setup_data()
307 host->dma_dir = DMA_FROM_DEVICE; in mxcmci_setup_data()
310 host->dma_dir = DMA_TO_DEVICE; in mxcmci_setup_data()
316 nents = dma_map_sg(host->dma->device->dev, data->sg, in mxcmci_setup_data()
317 data->sg_len, host->dma_dir); in mxcmci_setup_data()
321 host->desc = dmaengine_prep_slave_sg(host->dma, in mxcmci_setup_data()
325 if (!host->desc) { in mxcmci_setup_data()
326 dma_unmap_sg(host->dma->device->dev, data->sg, data->sg_len, in mxcmci_setup_data()
327 host->dma_dir); in mxcmci_setup_data()
328 host->do_dma = 0; in mxcmci_setup_data()
333 dmaengine_submit(host->desc); in mxcmci_setup_data()
334 dma_async_issue_pending(host->dma); in mxcmci_setup_data()
336 mod_timer(&host->watchdog, jiffies + msecs_to_jiffies(MXCMCI_TIMEOUT_MS)); in mxcmci_setup_data()
341 static void mxcmci_cmd_done(struct mxcmci_host *host, unsigned int stat);
342 static void mxcmci_data_done(struct mxcmci_host *host, unsigned int stat);
346 struct mxcmci_host *host = data; in mxcmci_dma_callback() local
349 del_timer(&host->watchdog); in mxcmci_dma_callback()
351 stat = mxcmci_readl(host, MMC_REG_STATUS); in mxcmci_dma_callback()
353 dev_dbg(mmc_dev(host->mmc), "%s: 0x%08x\n", __func__, stat); in mxcmci_dma_callback()
355 mxcmci_data_done(host, stat); in mxcmci_dma_callback()
358 static int mxcmci_start_cmd(struct mxcmci_host *host, struct mmc_command *cmd, in mxcmci_start_cmd() argument
361 u32 int_cntr = host->default_irq_mask; in mxcmci_start_cmd()
364 WARN_ON(host->cmd != NULL); in mxcmci_start_cmd()
365 host->cmd = cmd; in mxcmci_start_cmd()
381 dev_err(mmc_dev(host->mmc), "unhandled response type 0x%x\n", in mxcmci_start_cmd()
389 if (mxcmci_use_dma(host)) { in mxcmci_start_cmd()
390 if (host->dma_dir == DMA_FROM_DEVICE) { in mxcmci_start_cmd()
391 host->desc->callback = mxcmci_dma_callback; in mxcmci_start_cmd()
392 host->desc->callback_param = host; in mxcmci_start_cmd()
398 spin_lock_irqsave(&host->lock, flags); in mxcmci_start_cmd()
399 if (host->use_sdio) in mxcmci_start_cmd()
401 mxcmci_writel(host, int_cntr, MMC_REG_INT_CNTR); in mxcmci_start_cmd()
402 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_start_cmd()
404 mxcmci_writew(host, cmd->opcode, MMC_REG_CMD); in mxcmci_start_cmd()
405 mxcmci_writel(host, cmd->arg, MMC_REG_ARG); in mxcmci_start_cmd()
406 mxcmci_writew(host, cmdat, MMC_REG_CMD_DAT_CONT); in mxcmci_start_cmd()
411 static void mxcmci_finish_request(struct mxcmci_host *host, in mxcmci_finish_request() argument
414 u32 int_cntr = host->default_irq_mask; in mxcmci_finish_request()
417 spin_lock_irqsave(&host->lock, flags); in mxcmci_finish_request()
418 if (host->use_sdio) in mxcmci_finish_request()
420 mxcmci_writel(host, int_cntr, MMC_REG_INT_CNTR); in mxcmci_finish_request()
421 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_finish_request()
423 host->req = NULL; in mxcmci_finish_request()
424 host->cmd = NULL; in mxcmci_finish_request()
425 host->data = NULL; in mxcmci_finish_request()
427 mmc_request_done(host->mmc, req); in mxcmci_finish_request()
430 static int mxcmci_finish_data(struct mxcmci_host *host, unsigned int stat) in mxcmci_finish_data() argument
432 struct mmc_data *data = host->data; in mxcmci_finish_data()
435 if (mxcmci_use_dma(host)) { in mxcmci_finish_data()
436 dma_unmap_sg(host->dma->device->dev, data->sg, data->sg_len, in mxcmci_finish_data()
437 host->dma_dir); in mxcmci_finish_data()
442 dev_dbg(mmc_dev(host->mmc), "request failed. status: 0x%08x\n", in mxcmci_finish_data()
445 dev_err(mmc_dev(host->mmc), "%s: -EILSEQ\n", __func__); in mxcmci_finish_data()
450 dev_err(mmc_dev(host->mmc), in mxcmci_finish_data()
454 dev_err(mmc_dev(host->mmc), in mxcmci_finish_data()
459 dev_err(mmc_dev(host->mmc), in mxcmci_finish_data()
463 dev_err(mmc_dev(host->mmc), "%s: -EIO\n", __func__); in mxcmci_finish_data()
467 data->bytes_xfered = host->datasize; in mxcmci_finish_data()
472 host->data = NULL; in mxcmci_finish_data()
477 static void mxcmci_read_response(struct mxcmci_host *host, unsigned int stat) in mxcmci_read_response() argument
479 struct mmc_command *cmd = host->cmd; in mxcmci_read_response()
487 dev_dbg(mmc_dev(host->mmc), "CMD TIMEOUT\n"); in mxcmci_read_response()
490 dev_dbg(mmc_dev(host->mmc), "cmd crc error\n"); in mxcmci_read_response()
497 a = mxcmci_readw(host, MMC_REG_RES_FIFO); in mxcmci_read_response()
498 b = mxcmci_readw(host, MMC_REG_RES_FIFO); in mxcmci_read_response()
502 a = mxcmci_readw(host, MMC_REG_RES_FIFO); in mxcmci_read_response()
503 b = mxcmci_readw(host, MMC_REG_RES_FIFO); in mxcmci_read_response()
504 c = mxcmci_readw(host, MMC_REG_RES_FIFO); in mxcmci_read_response()
510 static int mxcmci_poll_status(struct mxcmci_host *host, u32 mask) in mxcmci_poll_status() argument
516 stat = mxcmci_readl(host, MMC_REG_STATUS); in mxcmci_poll_status()
520 mxcmci_softreset(host); in mxcmci_poll_status()
521 mxcmci_set_clk_rate(host, host->clock); in mxcmci_poll_status()
530 static int mxcmci_pull(struct mxcmci_host *host, void *_buf, int bytes) in mxcmci_pull() argument
536 stat = mxcmci_poll_status(host, in mxcmci_pull()
540 *buf++ = cpu_to_le32(mxcmci_readl(host, MMC_REG_BUFFER_ACCESS)); in mxcmci_pull()
548 stat = mxcmci_poll_status(host, in mxcmci_pull()
552 tmp = cpu_to_le32(mxcmci_readl(host, MMC_REG_BUFFER_ACCESS)); in mxcmci_pull()
559 static int mxcmci_push(struct mxcmci_host *host, void *_buf, int bytes) in mxcmci_push() argument
565 stat = mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY); in mxcmci_push()
568 mxcmci_writel(host, cpu_to_le32(*buf++), MMC_REG_BUFFER_ACCESS); in mxcmci_push()
576 stat = mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY); in mxcmci_push()
581 mxcmci_writel(host, cpu_to_le32(tmp), MMC_REG_BUFFER_ACCESS); in mxcmci_push()
584 return mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY); in mxcmci_push()
587 static int mxcmci_transfer_data(struct mxcmci_host *host) in mxcmci_transfer_data() argument
589 struct mmc_data *data = host->req->data; in mxcmci_transfer_data()
593 host->data = data; in mxcmci_transfer_data()
594 host->datasize = 0; in mxcmci_transfer_data()
598 stat = mxcmci_pull(host, sg_virt(sg), sg->length); in mxcmci_transfer_data()
601 host->datasize += sg->length; in mxcmci_transfer_data()
605 stat = mxcmci_push(host, sg_virt(sg), sg->length); in mxcmci_transfer_data()
608 host->datasize += sg->length; in mxcmci_transfer_data()
610 stat = mxcmci_poll_status(host, STATUS_WRITE_OP_DONE); in mxcmci_transfer_data()
619 struct mxcmci_host *host = container_of(work, struct mxcmci_host, in mxcmci_datawork() local
621 int datastat = mxcmci_transfer_data(host); in mxcmci_datawork()
623 mxcmci_writel(host, STATUS_READ_OP_DONE | STATUS_WRITE_OP_DONE, in mxcmci_datawork()
625 mxcmci_finish_data(host, datastat); in mxcmci_datawork()
627 if (host->req->stop) { in mxcmci_datawork()
628 if (mxcmci_start_cmd(host, host->req->stop, 0)) { in mxcmci_datawork()
629 mxcmci_finish_request(host, host->req); in mxcmci_datawork()
633 mxcmci_finish_request(host, host->req); in mxcmci_datawork()
637 static void mxcmci_data_done(struct mxcmci_host *host, unsigned int stat) in mxcmci_data_done() argument
643 spin_lock_irqsave(&host->lock, flags); in mxcmci_data_done()
645 if (!host->data) { in mxcmci_data_done()
646 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_data_done()
650 if (!host->req) { in mxcmci_data_done()
651 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_data_done()
655 req = host->req; in mxcmci_data_done()
657 host->req = NULL; /* we will handle finish req below */ in mxcmci_data_done()
659 data_error = mxcmci_finish_data(host, stat); in mxcmci_data_done()
661 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_data_done()
666 mxcmci_read_response(host, stat); in mxcmci_data_done()
667 host->cmd = NULL; in mxcmci_data_done()
670 if (mxcmci_start_cmd(host, req->stop, 0)) { in mxcmci_data_done()
671 mxcmci_finish_request(host, req); in mxcmci_data_done()
675 mxcmci_finish_request(host, req); in mxcmci_data_done()
679 static void mxcmci_cmd_done(struct mxcmci_host *host, unsigned int stat) in mxcmci_cmd_done() argument
681 mxcmci_read_response(host, stat); in mxcmci_cmd_done()
682 host->cmd = NULL; in mxcmci_cmd_done()
684 if (!host->data && host->req) { in mxcmci_cmd_done()
685 mxcmci_finish_request(host, host->req); in mxcmci_cmd_done()
693 if (!mxcmci_use_dma(host) && host->data) in mxcmci_cmd_done()
694 schedule_work(&host->datawork); in mxcmci_cmd_done()
700 struct mxcmci_host *host = devid; in mxcmci_irq() local
704 stat = mxcmci_readl(host, MMC_REG_STATUS); in mxcmci_irq()
705 mxcmci_writel(host, in mxcmci_irq()
710 dev_dbg(mmc_dev(host->mmc), "%s: 0x%08x\n", __func__, stat); in mxcmci_irq()
712 spin_lock(&host->lock); in mxcmci_irq()
713 sdio_irq = (stat & STATUS_SDIO_INT_ACTIVE) && host->use_sdio; in mxcmci_irq()
714 spin_unlock(&host->lock); in mxcmci_irq()
716 if (mxcmci_use_dma(host) && (stat & (STATUS_WRITE_OP_DONE))) in mxcmci_irq()
717 mxcmci_writel(host, STATUS_WRITE_OP_DONE, MMC_REG_STATUS); in mxcmci_irq()
720 mxcmci_writel(host, STATUS_SDIO_INT_ACTIVE, MMC_REG_STATUS); in mxcmci_irq()
721 mmc_signal_sdio_irq(host->mmc); in mxcmci_irq()
725 mxcmci_cmd_done(host, stat); in mxcmci_irq()
727 if (mxcmci_use_dma(host) && (stat & STATUS_WRITE_OP_DONE)) { in mxcmci_irq()
728 del_timer(&host->watchdog); in mxcmci_irq()
729 mxcmci_data_done(host, stat); in mxcmci_irq()
732 if (host->default_irq_mask && in mxcmci_irq()
734 mmc_detect_change(host->mmc, msecs_to_jiffies(200)); in mxcmci_irq()
741 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_request() local
742 unsigned int cmdat = host->cmdat; in mxcmci_request()
745 WARN_ON(host->req != NULL); in mxcmci_request()
747 host->req = req; in mxcmci_request()
748 host->cmdat &= ~CMD_DAT_CONT_INIT; in mxcmci_request()
750 if (host->dma) in mxcmci_request()
751 host->do_dma = 1; in mxcmci_request()
754 error = mxcmci_setup_data(host, req->data); in mxcmci_request()
767 error = mxcmci_start_cmd(host, req->cmd, cmdat); in mxcmci_request()
771 mxcmci_finish_request(host, req); in mxcmci_request()
774 static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios) in mxcmci_set_clk_rate() argument
778 unsigned int clk_in = clk_get_rate(host->clk_per); in mxcmci_set_clk_rate()
801 mxcmci_writew(host, (prescaler << 4) | divider, MMC_REG_CLK_RATE); in mxcmci_set_clk_rate()
803 dev_dbg(mmc_dev(host->mmc), "scaler: %d divider: %d in: %d out: %d\n", in mxcmci_set_clk_rate()
809 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_setup_dma() local
810 struct dma_slave_config *config = &host->dma_slave_config; in mxcmci_setup_dma()
812 config->dst_addr = host->phys_base + MMC_REG_BUFFER_ACCESS; in mxcmci_setup_dma()
813 config->src_addr = host->phys_base + MMC_REG_BUFFER_ACCESS; in mxcmci_setup_dma()
816 config->dst_maxburst = host->burstlen; in mxcmci_setup_dma()
817 config->src_maxburst = host->burstlen; in mxcmci_setup_dma()
820 return dmaengine_slave_config(host->dma, config); in mxcmci_setup_dma()
825 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_set_ios() local
837 if (mxcmci_use_dma(host) && burstlen != host->burstlen) { in mxcmci_set_ios()
838 host->burstlen = burstlen; in mxcmci_set_ios()
841 dev_err(mmc_dev(host->mmc), in mxcmci_set_ios()
843 dma_release_channel(host->dma); in mxcmci_set_ios()
844 host->do_dma = 0; in mxcmci_set_ios()
845 host->dma = NULL; in mxcmci_set_ios()
850 host->cmdat |= CMD_DAT_CONT_BUS_WIDTH_4; in mxcmci_set_ios()
852 host->cmdat &= ~CMD_DAT_CONT_BUS_WIDTH_4; in mxcmci_set_ios()
854 if (host->power_mode != ios->power_mode) { in mxcmci_set_ios()
855 host->power_mode = ios->power_mode; in mxcmci_set_ios()
856 mxcmci_set_power(host, ios->vdd); in mxcmci_set_ios()
859 host->cmdat |= CMD_DAT_CONT_INIT; in mxcmci_set_ios()
863 mxcmci_set_clk_rate(host, ios->clock); in mxcmci_set_ios()
864 mxcmci_writew(host, STR_STP_CLK_START_CLK, MMC_REG_STR_STP_CLK); in mxcmci_set_ios()
866 mxcmci_writew(host, STR_STP_CLK_STOP_CLK, MMC_REG_STR_STP_CLK); in mxcmci_set_ios()
869 host->clock = ios->clock; in mxcmci_set_ios()
884 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_get_ro() local
886 if (host->pdata && host->pdata->get_ro) in mxcmci_get_ro()
887 return !!host->pdata->get_ro(mmc_dev(mmc)); in mxcmci_get_ro()
898 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_enable_sdio_irq() local
902 spin_lock_irqsave(&host->lock, flags); in mxcmci_enable_sdio_irq()
903 host->use_sdio = enable; in mxcmci_enable_sdio_irq()
904 int_cntr = mxcmci_readl(host, MMC_REG_INT_CNTR); in mxcmci_enable_sdio_irq()
911 mxcmci_writel(host, int_cntr, MMC_REG_INT_CNTR); in mxcmci_enable_sdio_irq()
912 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_enable_sdio_irq()
915 static void mxcmci_init_card(struct mmc_host *host, struct mmc_card *card) in mxcmci_init_card() argument
917 struct mxcmci_host *mxcmci = mmc_priv(host); in mxcmci_init_card()
927 host->caps &= ~MMC_CAP_4_BIT_DATA; in mxcmci_init_card()
929 host->caps |= MMC_CAP_4_BIT_DATA; in mxcmci_init_card()
934 struct mxcmci_host *host = param; in filter() local
939 chan->private = &host->dma_data; in filter()
946 struct mxcmci_host *host = from_timer(host, t, watchdog); in mxcmci_watchdog() local
947 struct mmc_request *req = host->req; in mxcmci_watchdog()
948 unsigned int stat = mxcmci_readl(host, MMC_REG_STATUS); in mxcmci_watchdog()
950 if (host->dma_dir == DMA_FROM_DEVICE) { in mxcmci_watchdog()
951 dmaengine_terminate_all(host->dma); in mxcmci_watchdog()
952 dev_err(mmc_dev(host->mmc), in mxcmci_watchdog()
956 dev_err(mmc_dev(host->mmc), in mxcmci_watchdog()
959 mxcmci_softreset(host); in mxcmci_watchdog()
964 if (host->data) in mxcmci_watchdog()
965 host->data->error = -ETIMEDOUT; in mxcmci_watchdog()
966 host->req = NULL; in mxcmci_watchdog()
967 host->cmd = NULL; in mxcmci_watchdog()
968 host->data = NULL; in mxcmci_watchdog()
969 mmc_request_done(host->mmc, req); in mxcmci_watchdog()
983 struct mxcmci_host *host; in mxcmci_probe() local
997 mmc = mmc_alloc_host(sizeof(*host), &pdev->dev); in mxcmci_probe()
1001 host = mmc_priv(mmc); in mxcmci_probe()
1003 host->base = devm_ioremap_resource(&pdev->dev, res); in mxcmci_probe()
1004 if (IS_ERR(host->base)) { in mxcmci_probe()
1005 ret = PTR_ERR(host->base); in mxcmci_probe()
1009 host->phys_base = res->start; in mxcmci_probe()
1028 host->devtype = (uintptr_t)of_device_get_match_data(&pdev->dev); in mxcmci_probe()
1031 if (!is_mpc512x_mmc(host)) in mxcmci_probe()
1034 host->mmc = mmc; in mxcmci_probe()
1035 host->pdata = pdata; in mxcmci_probe()
1036 spin_lock_init(&host->lock); in mxcmci_probe()
1056 host->default_irq_mask = in mxcmci_probe()
1059 host->default_irq_mask = 0; in mxcmci_probe()
1061 host->clk_ipg = devm_clk_get(&pdev->dev, "ipg"); in mxcmci_probe()
1062 if (IS_ERR(host->clk_ipg)) { in mxcmci_probe()
1063 ret = PTR_ERR(host->clk_ipg); in mxcmci_probe()
1067 host->clk_per = devm_clk_get(&pdev->dev, "per"); in mxcmci_probe()
1068 if (IS_ERR(host->clk_per)) { in mxcmci_probe()
1069 ret = PTR_ERR(host->clk_per); in mxcmci_probe()
1073 ret = clk_prepare_enable(host->clk_per); in mxcmci_probe()
1077 ret = clk_prepare_enable(host->clk_ipg); in mxcmci_probe()
1081 mxcmci_softreset(host); in mxcmci_probe()
1083 host->rev_no = mxcmci_readw(host, MMC_REG_REV_NO); in mxcmci_probe()
1084 if (host->rev_no != 0x400) { in mxcmci_probe()
1086 dev_err(mmc_dev(host->mmc), "wrong rev.no. 0x%08x. aborting.\n", in mxcmci_probe()
1087 host->rev_no); in mxcmci_probe()
1091 mmc->f_min = clk_get_rate(host->clk_per) >> 16; in mxcmci_probe()
1092 mmc->f_max = clk_get_rate(host->clk_per) >> 1; in mxcmci_probe()
1095 mxcmci_writew(host, 0x2db4, MMC_REG_READ_TO); in mxcmci_probe()
1097 mxcmci_writel(host, host->default_irq_mask, MMC_REG_INT_CNTR); in mxcmci_probe()
1099 if (!host->pdata) { in mxcmci_probe()
1100 host->dma = dma_request_chan(&pdev->dev, "rx-tx"); in mxcmci_probe()
1101 if (IS_ERR(host->dma)) { in mxcmci_probe()
1102 if (PTR_ERR(host->dma) == -EPROBE_DEFER) { in mxcmci_probe()
1108 host->dma = NULL; in mxcmci_probe()
1113 host->dmareq = res->start; in mxcmci_probe()
1114 host->dma_data.peripheral_type = IMX_DMATYPE_SDHC; in mxcmci_probe()
1115 host->dma_data.priority = DMA_PRIO_LOW; in mxcmci_probe()
1116 host->dma_data.dma_request = host->dmareq; in mxcmci_probe()
1119 host->dma = dma_request_channel(mask, filter, host); in mxcmci_probe()
1122 if (host->dma) in mxcmci_probe()
1124 host->dma->device->dev); in mxcmci_probe()
1126 dev_info(mmc_dev(host->mmc), "dma not available. Using PIO\n"); in mxcmci_probe()
1128 INIT_WORK(&host->datawork, mxcmci_datawork); in mxcmci_probe()
1131 dev_name(&pdev->dev), host); in mxcmci_probe()
1137 if (host->pdata && host->pdata->init) { in mxcmci_probe()
1138 ret = host->pdata->init(&pdev->dev, mxcmci_detect_irq, in mxcmci_probe()
1139 host->mmc); in mxcmci_probe()
1144 timer_setup(&host->watchdog, mxcmci_watchdog, 0); in mxcmci_probe()
1151 if (host->dma) in mxcmci_probe()
1152 dma_release_channel(host->dma); in mxcmci_probe()
1155 clk_disable_unprepare(host->clk_ipg); in mxcmci_probe()
1157 clk_disable_unprepare(host->clk_per); in mxcmci_probe()
1168 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_remove() local
1172 if (host->pdata && host->pdata->exit) in mxcmci_remove()
1173 host->pdata->exit(&pdev->dev, mmc); in mxcmci_remove()
1175 if (host->dma) in mxcmci_remove()
1176 dma_release_channel(host->dma); in mxcmci_remove()
1178 clk_disable_unprepare(host->clk_per); in mxcmci_remove()
1179 clk_disable_unprepare(host->clk_ipg); in mxcmci_remove()
1189 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_suspend() local
1191 clk_disable_unprepare(host->clk_per); in mxcmci_suspend()
1192 clk_disable_unprepare(host->clk_ipg); in mxcmci_suspend()
1199 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_resume() local
1202 ret = clk_prepare_enable(host->clk_per); in mxcmci_resume()
1206 ret = clk_prepare_enable(host->clk_ipg); in mxcmci_resume()
1208 clk_disable_unprepare(host->clk_per); in mxcmci_resume()