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
310 host->data = data; in mxcmci_setup_data()
313 mxcmci_writew(host, nob, MMC_REG_NOB); in mxcmci_setup_data()
314 mxcmci_writew(host, blksz, MMC_REG_BLK_LEN); in mxcmci_setup_data()
315 host->datasize = datasize; in mxcmci_setup_data()
317 if (!mxcmci_use_dma(host)) in mxcmci_setup_data()
322 host->do_dma = 0; in mxcmci_setup_data()
328 host->dma_dir = DMA_FROM_DEVICE; in mxcmci_setup_data()
331 host->dma_dir = DMA_TO_DEVICE; in mxcmci_setup_data()
337 nents = dma_map_sg(host->dma->device->dev, data->sg, in mxcmci_setup_data()
338 data->sg_len, host->dma_dir); in mxcmci_setup_data()
342 host->desc = dmaengine_prep_slave_sg(host->dma, in mxcmci_setup_data()
346 if (!host->desc) { in mxcmci_setup_data()
347 dma_unmap_sg(host->dma->device->dev, data->sg, data->sg_len, in mxcmci_setup_data()
348 host->dma_dir); in mxcmci_setup_data()
349 host->do_dma = 0; in mxcmci_setup_data()
354 dmaengine_submit(host->desc); in mxcmci_setup_data()
355 dma_async_issue_pending(host->dma); in mxcmci_setup_data()
357 mod_timer(&host->watchdog, jiffies + msecs_to_jiffies(MXCMCI_TIMEOUT_MS)); in mxcmci_setup_data()
362 static void mxcmci_cmd_done(struct mxcmci_host *host, unsigned int stat);
363 static void mxcmci_data_done(struct mxcmci_host *host, unsigned int stat);
367 struct mxcmci_host *host = data; in mxcmci_dma_callback() local
370 del_timer(&host->watchdog); in mxcmci_dma_callback()
372 stat = mxcmci_readl(host, MMC_REG_STATUS); in mxcmci_dma_callback()
374 dev_dbg(mmc_dev(host->mmc), "%s: 0x%08x\n", __func__, stat); in mxcmci_dma_callback()
376 mxcmci_data_done(host, stat); in mxcmci_dma_callback()
379 static int mxcmci_start_cmd(struct mxcmci_host *host, struct mmc_command *cmd, in mxcmci_start_cmd() argument
382 u32 int_cntr = host->default_irq_mask; in mxcmci_start_cmd()
385 WARN_ON(host->cmd != NULL); in mxcmci_start_cmd()
386 host->cmd = cmd; in mxcmci_start_cmd()
402 dev_err(mmc_dev(host->mmc), "unhandled response type 0x%x\n", in mxcmci_start_cmd()
410 if (mxcmci_use_dma(host)) { in mxcmci_start_cmd()
411 if (host->dma_dir == DMA_FROM_DEVICE) { in mxcmci_start_cmd()
412 host->desc->callback = mxcmci_dma_callback; in mxcmci_start_cmd()
413 host->desc->callback_param = host; in mxcmci_start_cmd()
419 spin_lock_irqsave(&host->lock, flags); in mxcmci_start_cmd()
420 if (host->use_sdio) in mxcmci_start_cmd()
422 mxcmci_writel(host, int_cntr, MMC_REG_INT_CNTR); in mxcmci_start_cmd()
423 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_start_cmd()
425 mxcmci_writew(host, cmd->opcode, MMC_REG_CMD); in mxcmci_start_cmd()
426 mxcmci_writel(host, cmd->arg, MMC_REG_ARG); in mxcmci_start_cmd()
427 mxcmci_writew(host, cmdat, MMC_REG_CMD_DAT_CONT); in mxcmci_start_cmd()
432 static void mxcmci_finish_request(struct mxcmci_host *host, in mxcmci_finish_request() argument
435 u32 int_cntr = host->default_irq_mask; in mxcmci_finish_request()
438 spin_lock_irqsave(&host->lock, flags); in mxcmci_finish_request()
439 if (host->use_sdio) in mxcmci_finish_request()
441 mxcmci_writel(host, int_cntr, MMC_REG_INT_CNTR); in mxcmci_finish_request()
442 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_finish_request()
444 host->req = NULL; in mxcmci_finish_request()
445 host->cmd = NULL; in mxcmci_finish_request()
446 host->data = NULL; in mxcmci_finish_request()
448 mmc_request_done(host->mmc, req); in mxcmci_finish_request()
451 static int mxcmci_finish_data(struct mxcmci_host *host, unsigned int stat) in mxcmci_finish_data() argument
453 struct mmc_data *data = host->data; in mxcmci_finish_data()
456 if (mxcmci_use_dma(host)) { in mxcmci_finish_data()
457 dma_unmap_sg(host->dma->device->dev, data->sg, data->sg_len, in mxcmci_finish_data()
458 host->dma_dir); in mxcmci_finish_data()
463 dev_dbg(mmc_dev(host->mmc), "request failed. status: 0x%08x\n", in mxcmci_finish_data()
466 dev_err(mmc_dev(host->mmc), "%s: -EILSEQ\n", __func__); in mxcmci_finish_data()
471 dev_err(mmc_dev(host->mmc), in mxcmci_finish_data()
475 dev_err(mmc_dev(host->mmc), in mxcmci_finish_data()
480 dev_err(mmc_dev(host->mmc), in mxcmci_finish_data()
484 dev_err(mmc_dev(host->mmc), "%s: -EIO\n", __func__); in mxcmci_finish_data()
488 data->bytes_xfered = host->datasize; in mxcmci_finish_data()
493 host->data = NULL; in mxcmci_finish_data()
498 static void mxcmci_read_response(struct mxcmci_host *host, unsigned int stat) in mxcmci_read_response() argument
500 struct mmc_command *cmd = host->cmd; in mxcmci_read_response()
508 dev_dbg(mmc_dev(host->mmc), "CMD TIMEOUT\n"); in mxcmci_read_response()
511 dev_dbg(mmc_dev(host->mmc), "cmd crc error\n"); in mxcmci_read_response()
518 a = mxcmci_readw(host, MMC_REG_RES_FIFO); in mxcmci_read_response()
519 b = mxcmci_readw(host, MMC_REG_RES_FIFO); in mxcmci_read_response()
523 a = mxcmci_readw(host, MMC_REG_RES_FIFO); in mxcmci_read_response()
524 b = mxcmci_readw(host, MMC_REG_RES_FIFO); in mxcmci_read_response()
525 c = mxcmci_readw(host, MMC_REG_RES_FIFO); in mxcmci_read_response()
531 static int mxcmci_poll_status(struct mxcmci_host *host, u32 mask) in mxcmci_poll_status() argument
537 stat = mxcmci_readl(host, MMC_REG_STATUS); in mxcmci_poll_status()
541 mxcmci_softreset(host); in mxcmci_poll_status()
542 mxcmci_set_clk_rate(host, host->clock); in mxcmci_poll_status()
551 static int mxcmci_pull(struct mxcmci_host *host, void *_buf, int bytes) in mxcmci_pull() argument
557 stat = mxcmci_poll_status(host, in mxcmci_pull()
561 *buf++ = cpu_to_le32(mxcmci_readl(host, MMC_REG_BUFFER_ACCESS)); in mxcmci_pull()
569 stat = mxcmci_poll_status(host, in mxcmci_pull()
573 tmp = cpu_to_le32(mxcmci_readl(host, MMC_REG_BUFFER_ACCESS)); in mxcmci_pull()
580 static int mxcmci_push(struct mxcmci_host *host, void *_buf, int bytes) in mxcmci_push() argument
586 stat = mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY); in mxcmci_push()
589 mxcmci_writel(host, cpu_to_le32(*buf++), MMC_REG_BUFFER_ACCESS); in mxcmci_push()
597 stat = mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY); in mxcmci_push()
602 mxcmci_writel(host, cpu_to_le32(tmp), MMC_REG_BUFFER_ACCESS); in mxcmci_push()
605 return mxcmci_poll_status(host, STATUS_BUF_WRITE_RDY); in mxcmci_push()
608 static int mxcmci_transfer_data(struct mxcmci_host *host) in mxcmci_transfer_data() argument
610 struct mmc_data *data = host->req->data; in mxcmci_transfer_data()
614 host->data = data; in mxcmci_transfer_data()
615 host->datasize = 0; in mxcmci_transfer_data()
619 stat = mxcmci_pull(host, sg_virt(sg), sg->length); in mxcmci_transfer_data()
622 host->datasize += sg->length; in mxcmci_transfer_data()
626 stat = mxcmci_push(host, sg_virt(sg), sg->length); in mxcmci_transfer_data()
629 host->datasize += sg->length; in mxcmci_transfer_data()
631 stat = mxcmci_poll_status(host, STATUS_WRITE_OP_DONE); in mxcmci_transfer_data()
640 struct mxcmci_host *host = container_of(work, struct mxcmci_host, in mxcmci_datawork() local
642 int datastat = mxcmci_transfer_data(host); in mxcmci_datawork()
644 mxcmci_writel(host, STATUS_READ_OP_DONE | STATUS_WRITE_OP_DONE, in mxcmci_datawork()
646 mxcmci_finish_data(host, datastat); in mxcmci_datawork()
648 if (host->req->stop) { in mxcmci_datawork()
649 if (mxcmci_start_cmd(host, host->req->stop, 0)) { in mxcmci_datawork()
650 mxcmci_finish_request(host, host->req); in mxcmci_datawork()
654 mxcmci_finish_request(host, host->req); in mxcmci_datawork()
658 static void mxcmci_data_done(struct mxcmci_host *host, unsigned int stat) in mxcmci_data_done() argument
664 spin_lock_irqsave(&host->lock, flags); in mxcmci_data_done()
666 if (!host->data) { in mxcmci_data_done()
667 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_data_done()
671 if (!host->req) { in mxcmci_data_done()
672 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_data_done()
676 req = host->req; in mxcmci_data_done()
678 host->req = NULL; /* we will handle finish req below */ in mxcmci_data_done()
680 data_error = mxcmci_finish_data(host, stat); in mxcmci_data_done()
682 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_data_done()
684 mxcmci_read_response(host, stat); in mxcmci_data_done()
685 host->cmd = NULL; in mxcmci_data_done()
688 if (mxcmci_start_cmd(host, req->stop, 0)) { in mxcmci_data_done()
689 mxcmci_finish_request(host, req); in mxcmci_data_done()
693 mxcmci_finish_request(host, req); in mxcmci_data_done()
697 static void mxcmci_cmd_done(struct mxcmci_host *host, unsigned int stat) in mxcmci_cmd_done() argument
699 mxcmci_read_response(host, stat); in mxcmci_cmd_done()
700 host->cmd = NULL; in mxcmci_cmd_done()
702 if (!host->data && host->req) { in mxcmci_cmd_done()
703 mxcmci_finish_request(host, host->req); in mxcmci_cmd_done()
711 if (!mxcmci_use_dma(host) && host->data) in mxcmci_cmd_done()
712 schedule_work(&host->datawork); in mxcmci_cmd_done()
718 struct mxcmci_host *host = devid; in mxcmci_irq() local
723 stat = mxcmci_readl(host, MMC_REG_STATUS); in mxcmci_irq()
724 mxcmci_writel(host, in mxcmci_irq()
729 dev_dbg(mmc_dev(host->mmc), "%s: 0x%08x\n", __func__, stat); in mxcmci_irq()
731 spin_lock_irqsave(&host->lock, flags); in mxcmci_irq()
732 sdio_irq = (stat & STATUS_SDIO_INT_ACTIVE) && host->use_sdio; in mxcmci_irq()
733 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_irq()
735 if (mxcmci_use_dma(host) && (stat & (STATUS_WRITE_OP_DONE))) in mxcmci_irq()
736 mxcmci_writel(host, STATUS_WRITE_OP_DONE, MMC_REG_STATUS); in mxcmci_irq()
739 mxcmci_writel(host, STATUS_SDIO_INT_ACTIVE, MMC_REG_STATUS); in mxcmci_irq()
740 mmc_signal_sdio_irq(host->mmc); in mxcmci_irq()
744 mxcmci_cmd_done(host, stat); in mxcmci_irq()
746 if (mxcmci_use_dma(host) && (stat & STATUS_WRITE_OP_DONE)) { in mxcmci_irq()
747 del_timer(&host->watchdog); in mxcmci_irq()
748 mxcmci_data_done(host, stat); in mxcmci_irq()
751 if (host->default_irq_mask && in mxcmci_irq()
753 mmc_detect_change(host->mmc, msecs_to_jiffies(200)); in mxcmci_irq()
760 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_request() local
761 unsigned int cmdat = host->cmdat; in mxcmci_request()
764 WARN_ON(host->req != NULL); in mxcmci_request()
766 host->req = req; in mxcmci_request()
767 host->cmdat &= ~CMD_DAT_CONT_INIT; in mxcmci_request()
769 if (host->dma) in mxcmci_request()
770 host->do_dma = 1; in mxcmci_request()
773 error = mxcmci_setup_data(host, req->data); in mxcmci_request()
786 error = mxcmci_start_cmd(host, req->cmd, cmdat); in mxcmci_request()
790 mxcmci_finish_request(host, req); in mxcmci_request()
793 static void mxcmci_set_clk_rate(struct mxcmci_host *host, unsigned int clk_ios) in mxcmci_set_clk_rate() argument
797 unsigned int clk_in = clk_get_rate(host->clk_per); in mxcmci_set_clk_rate()
820 mxcmci_writew(host, (prescaler << 4) | divider, MMC_REG_CLK_RATE); in mxcmci_set_clk_rate()
822 dev_dbg(mmc_dev(host->mmc), "scaler: %d divider: %d in: %d out: %d\n", in mxcmci_set_clk_rate()
828 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_setup_dma() local
829 struct dma_slave_config *config = &host->dma_slave_config; in mxcmci_setup_dma()
831 config->dst_addr = host->phys_base + MMC_REG_BUFFER_ACCESS; in mxcmci_setup_dma()
832 config->src_addr = host->phys_base + MMC_REG_BUFFER_ACCESS; in mxcmci_setup_dma()
835 config->dst_maxburst = host->burstlen; in mxcmci_setup_dma()
836 config->src_maxburst = host->burstlen; in mxcmci_setup_dma()
839 return dmaengine_slave_config(host->dma, config); in mxcmci_setup_dma()
844 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_set_ios() local
856 if (mxcmci_use_dma(host) && burstlen != host->burstlen) { in mxcmci_set_ios()
857 host->burstlen = burstlen; in mxcmci_set_ios()
860 dev_err(mmc_dev(host->mmc), in mxcmci_set_ios()
862 dma_release_channel(host->dma); in mxcmci_set_ios()
863 host->do_dma = 0; in mxcmci_set_ios()
864 host->dma = NULL; in mxcmci_set_ios()
869 host->cmdat |= CMD_DAT_CONT_BUS_WIDTH_4; in mxcmci_set_ios()
871 host->cmdat &= ~CMD_DAT_CONT_BUS_WIDTH_4; in mxcmci_set_ios()
873 if (host->power_mode != ios->power_mode) { in mxcmci_set_ios()
874 host->power_mode = ios->power_mode; in mxcmci_set_ios()
875 mxcmci_set_power(host, ios->vdd); in mxcmci_set_ios()
878 host->cmdat |= CMD_DAT_CONT_INIT; in mxcmci_set_ios()
882 mxcmci_set_clk_rate(host, ios->clock); in mxcmci_set_ios()
883 mxcmci_writew(host, STR_STP_CLK_START_CLK, MMC_REG_STR_STP_CLK); in mxcmci_set_ios()
885 mxcmci_writew(host, STR_STP_CLK_STOP_CLK, MMC_REG_STR_STP_CLK); in mxcmci_set_ios()
888 host->clock = ios->clock; in mxcmci_set_ios()
903 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_get_ro() local
905 if (host->pdata && host->pdata->get_ro) in mxcmci_get_ro()
906 return !!host->pdata->get_ro(mmc_dev(mmc)); in mxcmci_get_ro()
917 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_enable_sdio_irq() local
921 spin_lock_irqsave(&host->lock, flags); in mxcmci_enable_sdio_irq()
922 host->use_sdio = enable; in mxcmci_enable_sdio_irq()
923 int_cntr = mxcmci_readl(host, MMC_REG_INT_CNTR); in mxcmci_enable_sdio_irq()
930 mxcmci_writel(host, int_cntr, MMC_REG_INT_CNTR); in mxcmci_enable_sdio_irq()
931 spin_unlock_irqrestore(&host->lock, flags); in mxcmci_enable_sdio_irq()
934 static void mxcmci_init_card(struct mmc_host *host, struct mmc_card *card) in mxcmci_init_card() argument
936 struct mxcmci_host *mxcmci = mmc_priv(host); in mxcmci_init_card()
946 host->caps &= ~MMC_CAP_4_BIT_DATA; in mxcmci_init_card()
948 host->caps |= MMC_CAP_4_BIT_DATA; in mxcmci_init_card()
953 struct mxcmci_host *host = param; in filter() local
958 chan->private = &host->dma_data; in filter()
966 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_watchdog() local
967 struct mmc_request *req = host->req; in mxcmci_watchdog()
968 unsigned int stat = mxcmci_readl(host, MMC_REG_STATUS); in mxcmci_watchdog()
970 if (host->dma_dir == DMA_FROM_DEVICE) { in mxcmci_watchdog()
971 dmaengine_terminate_all(host->dma); in mxcmci_watchdog()
972 dev_err(mmc_dev(host->mmc), in mxcmci_watchdog()
976 dev_err(mmc_dev(host->mmc), in mxcmci_watchdog()
979 mxcmci_softreset(host); in mxcmci_watchdog()
984 if (host->data) in mxcmci_watchdog()
985 host->data->error = -ETIMEDOUT; in mxcmci_watchdog()
986 host->req = NULL; in mxcmci_watchdog()
987 host->cmd = NULL; in mxcmci_watchdog()
988 host->data = NULL; in mxcmci_watchdog()
989 mmc_request_done(host->mmc, req); in mxcmci_watchdog()
1003 struct mxcmci_host *host; in mxcmci_probe() local
1020 mmc = mmc_alloc_host(sizeof(*host), &pdev->dev); in mxcmci_probe()
1024 host = mmc_priv(mmc); in mxcmci_probe()
1026 host->base = devm_ioremap_resource(&pdev->dev, res); in mxcmci_probe()
1027 if (IS_ERR(host->base)) { in mxcmci_probe()
1028 ret = PTR_ERR(host->base); in mxcmci_probe()
1032 host->phys_base = res->start; in mxcmci_probe()
1053 host->devtype = id_entry->driver_data; in mxcmci_probe()
1055 host->devtype = pdev->id_entry->driver_data; in mxcmci_probe()
1059 if (!is_mpc512x_mmc(host)) in mxcmci_probe()
1062 host->mmc = mmc; in mxcmci_probe()
1063 host->pdata = pdata; in mxcmci_probe()
1064 spin_lock_init(&host->lock); in mxcmci_probe()
1084 host->default_irq_mask = in mxcmci_probe()
1087 host->default_irq_mask = 0; in mxcmci_probe()
1089 host->clk_ipg = devm_clk_get(&pdev->dev, "ipg"); in mxcmci_probe()
1090 if (IS_ERR(host->clk_ipg)) { in mxcmci_probe()
1091 ret = PTR_ERR(host->clk_ipg); in mxcmci_probe()
1095 host->clk_per = devm_clk_get(&pdev->dev, "per"); in mxcmci_probe()
1096 if (IS_ERR(host->clk_per)) { in mxcmci_probe()
1097 ret = PTR_ERR(host->clk_per); in mxcmci_probe()
1101 clk_prepare_enable(host->clk_per); in mxcmci_probe()
1102 clk_prepare_enable(host->clk_ipg); in mxcmci_probe()
1104 mxcmci_softreset(host); in mxcmci_probe()
1106 host->rev_no = mxcmci_readw(host, MMC_REG_REV_NO); in mxcmci_probe()
1107 if (host->rev_no != 0x400) { in mxcmci_probe()
1109 dev_err(mmc_dev(host->mmc), "wrong rev.no. 0x%08x. aborting.\n", in mxcmci_probe()
1110 host->rev_no); in mxcmci_probe()
1114 mmc->f_min = clk_get_rate(host->clk_per) >> 16; in mxcmci_probe()
1115 mmc->f_max = clk_get_rate(host->clk_per) >> 1; in mxcmci_probe()
1118 mxcmci_writew(host, 0x2db4, MMC_REG_READ_TO); in mxcmci_probe()
1120 mxcmci_writel(host, host->default_irq_mask, MMC_REG_INT_CNTR); in mxcmci_probe()
1122 if (!host->pdata) { in mxcmci_probe()
1123 host->dma = dma_request_slave_channel(&pdev->dev, "rx-tx"); in mxcmci_probe()
1127 host->dmareq = res->start; in mxcmci_probe()
1128 host->dma_data.peripheral_type = IMX_DMATYPE_SDHC; in mxcmci_probe()
1129 host->dma_data.priority = DMA_PRIO_LOW; in mxcmci_probe()
1130 host->dma_data.dma_request = host->dmareq; in mxcmci_probe()
1133 host->dma = dma_request_channel(mask, filter, host); in mxcmci_probe()
1136 if (host->dma) in mxcmci_probe()
1138 host->dma->device->dev); in mxcmci_probe()
1140 dev_info(mmc_dev(host->mmc), "dma not available. Using PIO\n"); in mxcmci_probe()
1142 INIT_WORK(&host->datawork, mxcmci_datawork); in mxcmci_probe()
1145 dev_name(&pdev->dev), host); in mxcmci_probe()
1151 if (host->pdata && host->pdata->init) { in mxcmci_probe()
1152 ret = host->pdata->init(&pdev->dev, mxcmci_detect_irq, in mxcmci_probe()
1153 host->mmc); in mxcmci_probe()
1158 init_timer(&host->watchdog); in mxcmci_probe()
1159 host->watchdog.function = &mxcmci_watchdog; in mxcmci_probe()
1160 host->watchdog.data = (unsigned long)mmc; in mxcmci_probe()
1167 if (host->dma) in mxcmci_probe()
1168 dma_release_channel(host->dma); in mxcmci_probe()
1171 clk_disable_unprepare(host->clk_per); in mxcmci_probe()
1172 clk_disable_unprepare(host->clk_ipg); in mxcmci_probe()
1183 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_remove() local
1187 if (host->pdata && host->pdata->exit) in mxcmci_remove()
1188 host->pdata->exit(&pdev->dev, mmc); in mxcmci_remove()
1190 if (host->dma) in mxcmci_remove()
1191 dma_release_channel(host->dma); in mxcmci_remove()
1193 clk_disable_unprepare(host->clk_per); in mxcmci_remove()
1194 clk_disable_unprepare(host->clk_ipg); in mxcmci_remove()
1204 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_suspend() local
1206 clk_disable_unprepare(host->clk_per); in mxcmci_suspend()
1207 clk_disable_unprepare(host->clk_ipg); in mxcmci_suspend()
1214 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_resume() local
1216 clk_prepare_enable(host->clk_per); in mxcmci_resume()
1217 clk_prepare_enable(host->clk_ipg); in mxcmci_resume()