Lines Matching refs:host
228 static void mmc_davinci_sg_to_buf(struct mmc_davinci_host *host) in mmc_davinci_sg_to_buf() argument
230 host->buffer_bytes_left = sg_dma_len(host->sg); in mmc_davinci_sg_to_buf()
231 host->buffer = sg_virt(host->sg); in mmc_davinci_sg_to_buf()
232 if (host->buffer_bytes_left > host->bytes_left) in mmc_davinci_sg_to_buf()
233 host->buffer_bytes_left = host->bytes_left; in mmc_davinci_sg_to_buf()
236 static void davinci_fifo_data_trans(struct mmc_davinci_host *host, in davinci_fifo_data_trans() argument
242 if (host->buffer_bytes_left == 0) { in davinci_fifo_data_trans()
243 host->sg = sg_next(host->data->sg); in davinci_fifo_data_trans()
244 mmc_davinci_sg_to_buf(host); in davinci_fifo_data_trans()
247 p = host->buffer; in davinci_fifo_data_trans()
248 if (n > host->buffer_bytes_left) in davinci_fifo_data_trans()
249 n = host->buffer_bytes_left; in davinci_fifo_data_trans()
250 host->buffer_bytes_left -= n; in davinci_fifo_data_trans()
251 host->bytes_left -= n; in davinci_fifo_data_trans()
257 if (host->data_dir == DAVINCI_MMC_DATADIR_WRITE) { in davinci_fifo_data_trans()
259 writel(*((u32 *)p), host->base + DAVINCI_MMCDXR); in davinci_fifo_data_trans()
263 iowrite8_rep(host->base + DAVINCI_MMCDXR, p, (n & 3)); in davinci_fifo_data_trans()
268 *((u32 *)p) = readl(host->base + DAVINCI_MMCDRR); in davinci_fifo_data_trans()
272 ioread8_rep(host->base + DAVINCI_MMCDRR, p, (n & 3)); in davinci_fifo_data_trans()
276 host->buffer = p; in davinci_fifo_data_trans()
279 static void mmc_davinci_start_command(struct mmc_davinci_host *host, in mmc_davinci_start_command() argument
285 dev_dbg(mmc_dev(host->mmc), "CMD%d, arg 0x%08x%s\n", in mmc_davinci_start_command()
305 host->cmd = cmd; in mmc_davinci_start_command()
326 dev_dbg(mmc_dev(host->mmc), "unknown resp_type %04x\n", in mmc_davinci_start_command()
335 if (host->do_dma) in mmc_davinci_start_command()
338 if (host->version == MMC_CTLR_VERSION_2 && host->data != NULL && in mmc_davinci_start_command()
339 host->data_dir == DAVINCI_MMC_DATADIR_READ) in mmc_davinci_start_command()
347 if (host->data_dir == DAVINCI_MMC_DATADIR_WRITE) in mmc_davinci_start_command()
350 if (host->bus_mode == MMC_BUSMODE_PUSHPULL) in mmc_davinci_start_command()
354 writel(0x1FFF, host->base + DAVINCI_MMCTOR); in mmc_davinci_start_command()
358 if (host->data_dir == DAVINCI_MMC_DATADIR_WRITE) { in mmc_davinci_start_command()
361 if (!host->do_dma) in mmc_davinci_start_command()
363 } else if (host->data_dir == DAVINCI_MMC_DATADIR_READ) { in mmc_davinci_start_command()
366 if (!host->do_dma) in mmc_davinci_start_command()
374 if (!host->do_dma && (host->data_dir == DAVINCI_MMC_DATADIR_WRITE)) in mmc_davinci_start_command()
375 davinci_fifo_data_trans(host, rw_threshold); in mmc_davinci_start_command()
377 writel(cmd->arg, host->base + DAVINCI_MMCARGHL); in mmc_davinci_start_command()
378 writel(cmd_reg, host->base + DAVINCI_MMCCMD); in mmc_davinci_start_command()
380 host->active_request = true; in mmc_davinci_start_command()
382 if (!host->do_dma && host->bytes_left <= poll_threshold) { in mmc_davinci_start_command()
385 while (host->active_request && count--) { in mmc_davinci_start_command()
386 mmc_davinci_irq(0, host); in mmc_davinci_start_command()
391 if (host->active_request) in mmc_davinci_start_command()
392 writel(im_val, host->base + DAVINCI_MMCIM); in mmc_davinci_start_command()
399 static void davinci_abort_dma(struct mmc_davinci_host *host) in davinci_abort_dma() argument
403 if (host->data_dir == DAVINCI_MMC_DATADIR_READ) in davinci_abort_dma()
404 sync_dev = host->dma_rx; in davinci_abort_dma()
406 sync_dev = host->dma_tx; in davinci_abort_dma()
411 static int mmc_davinci_send_dma_request(struct mmc_davinci_host *host, in mmc_davinci_send_dma_request() argument
418 if (host->data_dir == DAVINCI_MMC_DATADIR_WRITE) { in mmc_davinci_send_dma_request()
421 .dst_addr = host->mem_res->start + DAVINCI_MMCDXR, in mmc_davinci_send_dma_request()
426 chan = host->dma_tx; in mmc_davinci_send_dma_request()
427 dmaengine_slave_config(host->dma_tx, &dma_tx_conf); in mmc_davinci_send_dma_request()
429 desc = dmaengine_prep_slave_sg(host->dma_tx, in mmc_davinci_send_dma_request()
431 host->sg_len, in mmc_davinci_send_dma_request()
435 dev_dbg(mmc_dev(host->mmc), in mmc_davinci_send_dma_request()
443 .src_addr = host->mem_res->start + DAVINCI_MMCDRR, in mmc_davinci_send_dma_request()
448 chan = host->dma_rx; in mmc_davinci_send_dma_request()
449 dmaengine_slave_config(host->dma_rx, &dma_rx_conf); in mmc_davinci_send_dma_request()
451 desc = dmaengine_prep_slave_sg(host->dma_rx, in mmc_davinci_send_dma_request()
453 host->sg_len, in mmc_davinci_send_dma_request()
457 dev_dbg(mmc_dev(host->mmc), in mmc_davinci_send_dma_request()
471 static int mmc_davinci_start_dma_transfer(struct mmc_davinci_host *host, in mmc_davinci_start_dma_transfer() argument
478 host->sg_len = dma_map_sg(mmc_dev(host->mmc), data->sg, data->sg_len, in mmc_davinci_start_dma_transfer()
484 for (i = 0; i < host->sg_len; i++) { in mmc_davinci_start_dma_transfer()
486 dma_unmap_sg(mmc_dev(host->mmc), in mmc_davinci_start_dma_transfer()
495 host->do_dma = 1; in mmc_davinci_start_dma_transfer()
496 ret = mmc_davinci_send_dma_request(host, data); in mmc_davinci_start_dma_transfer()
502 davinci_release_dma_channels(struct mmc_davinci_host *host) in davinci_release_dma_channels() argument
504 if (!host->use_dma) in davinci_release_dma_channels()
507 dma_release_channel(host->dma_tx); in davinci_release_dma_channels()
508 dma_release_channel(host->dma_rx); in davinci_release_dma_channels()
511 static int __init davinci_acquire_dma_channels(struct mmc_davinci_host *host) in davinci_acquire_dma_channels() argument
513 host->dma_tx = dma_request_chan(mmc_dev(host->mmc), "tx"); in davinci_acquire_dma_channels()
514 if (IS_ERR(host->dma_tx)) { in davinci_acquire_dma_channels()
515 dev_err(mmc_dev(host->mmc), "Can't get dma_tx channel\n"); in davinci_acquire_dma_channels()
516 return PTR_ERR(host->dma_tx); in davinci_acquire_dma_channels()
519 host->dma_rx = dma_request_chan(mmc_dev(host->mmc), "rx"); in davinci_acquire_dma_channels()
520 if (IS_ERR(host->dma_rx)) { in davinci_acquire_dma_channels()
521 dev_err(mmc_dev(host->mmc), "Can't get dma_rx channel\n"); in davinci_acquire_dma_channels()
522 dma_release_channel(host->dma_tx); in davinci_acquire_dma_channels()
523 return PTR_ERR(host->dma_rx); in davinci_acquire_dma_channels()
532 mmc_davinci_prepare_data(struct mmc_davinci_host *host, struct mmc_request *req) in mmc_davinci_prepare_data() argument
538 if (host->version == MMC_CTLR_VERSION_2) in mmc_davinci_prepare_data()
541 host->data = data; in mmc_davinci_prepare_data()
543 host->data_dir = DAVINCI_MMC_DATADIR_NONE; in mmc_davinci_prepare_data()
544 writel(0, host->base + DAVINCI_MMCBLEN); in mmc_davinci_prepare_data()
545 writel(0, host->base + DAVINCI_MMCNBLK); in mmc_davinci_prepare_data()
549 dev_dbg(mmc_dev(host->mmc), "%s, %d blocks of %d bytes\n", in mmc_davinci_prepare_data()
552 dev_dbg(mmc_dev(host->mmc), " DTO %d cycles + %d ns\n", in mmc_davinci_prepare_data()
555 (data->timeout_ns / host->ns_in_one_cycle); in mmc_davinci_prepare_data()
559 writel(timeout, host->base + DAVINCI_MMCTOD); in mmc_davinci_prepare_data()
560 writel(data->blocks, host->base + DAVINCI_MMCNBLK); in mmc_davinci_prepare_data()
561 writel(data->blksz, host->base + DAVINCI_MMCBLEN); in mmc_davinci_prepare_data()
565 host->data_dir = DAVINCI_MMC_DATADIR_WRITE; in mmc_davinci_prepare_data()
567 host->base + DAVINCI_MMCFIFOCTL); in mmc_davinci_prepare_data()
569 host->base + DAVINCI_MMCFIFOCTL); in mmc_davinci_prepare_data()
571 host->data_dir = DAVINCI_MMC_DATADIR_READ; in mmc_davinci_prepare_data()
573 host->base + DAVINCI_MMCFIFOCTL); in mmc_davinci_prepare_data()
575 host->base + DAVINCI_MMCFIFOCTL); in mmc_davinci_prepare_data()
578 host->buffer = NULL; in mmc_davinci_prepare_data()
579 host->bytes_left = data->blocks * data->blksz; in mmc_davinci_prepare_data()
589 if (host->use_dma && (host->bytes_left & (rw_threshold - 1)) == 0 in mmc_davinci_prepare_data()
590 && mmc_davinci_start_dma_transfer(host, data) == 0) { in mmc_davinci_prepare_data()
592 host->bytes_left = 0; in mmc_davinci_prepare_data()
595 host->sg_len = data->sg_len; in mmc_davinci_prepare_data()
596 host->sg = host->data->sg; in mmc_davinci_prepare_data()
597 mmc_davinci_sg_to_buf(host); in mmc_davinci_prepare_data()
603 struct mmc_davinci_host *host = mmc_priv(mmc); in mmc_davinci_request() local
611 mmcst1 = readl(host->base + DAVINCI_MMCST1); in mmc_davinci_request()
617 dev_err(mmc_dev(host->mmc), "still BUSY? bad ... \n"); in mmc_davinci_request()
623 host->do_dma = 0; in mmc_davinci_request()
624 mmc_davinci_prepare_data(host, req); in mmc_davinci_request()
625 mmc_davinci_start_command(host, req->cmd); in mmc_davinci_request()
628 static unsigned int calculate_freq_for_card(struct mmc_davinci_host *host, in calculate_freq_for_card() argument
633 mmc_pclk = host->mmc_input_clk; in calculate_freq_for_card()
647 host->ns_in_one_cycle = (1000000) / (((mmc_pclk in calculate_freq_for_card()
650 host->ns_in_one_cycle = (1000000) / (((mmc_pclk in calculate_freq_for_card()
660 struct mmc_davinci_host *host = mmc_priv(mmc); in calculate_clk_divider() local
674 temp = readl(host->base + DAVINCI_MMCCLK) & ~MMCCLK_CLKRT_MASK; in calculate_clk_divider()
676 writel(temp, host->base + DAVINCI_MMCCLK); in calculate_clk_divider()
679 host->ns_in_one_cycle = (1000000) / (MMCSD_INIT_CLOCK/1000); in calculate_clk_divider()
682 mmc_push_pull_freq = calculate_freq_for_card(host, ios->clock); in calculate_clk_divider()
687 temp = readl(host->base + DAVINCI_MMCCLK) & ~MMCCLK_CLKEN; in calculate_clk_divider()
688 writel(temp, host->base + DAVINCI_MMCCLK); in calculate_clk_divider()
692 temp = readl(host->base + DAVINCI_MMCCLK) & ~MMCCLK_CLKRT_MASK; in calculate_clk_divider()
694 writel(temp, host->base + DAVINCI_MMCCLK); in calculate_clk_divider()
696 writel(temp | MMCCLK_CLKEN, host->base + DAVINCI_MMCCLK); in calculate_clk_divider()
704 struct mmc_davinci_host *host = mmc_priv(mmc); in mmc_davinci_set_ios() local
708 dev_dbg(mmc_dev(host->mmc), in mmc_davinci_set_ios()
726 dev_dbg(mmc_dev(host->mmc), "Enabling 8 bit mode\n"); in mmc_davinci_set_ios()
727 writel((readl(host->base + DAVINCI_MMCCTL) & in mmc_davinci_set_ios()
729 host->base + DAVINCI_MMCCTL); in mmc_davinci_set_ios()
732 dev_dbg(mmc_dev(host->mmc), "Enabling 4 bit mode\n"); in mmc_davinci_set_ios()
733 if (host->version == MMC_CTLR_VERSION_2) in mmc_davinci_set_ios()
734 writel((readl(host->base + DAVINCI_MMCCTL) & in mmc_davinci_set_ios()
736 host->base + DAVINCI_MMCCTL); in mmc_davinci_set_ios()
738 writel(readl(host->base + DAVINCI_MMCCTL) | in mmc_davinci_set_ios()
740 host->base + DAVINCI_MMCCTL); in mmc_davinci_set_ios()
743 dev_dbg(mmc_dev(host->mmc), "Enabling 1 bit mode\n"); in mmc_davinci_set_ios()
744 if (host->version == MMC_CTLR_VERSION_2) in mmc_davinci_set_ios()
745 writel(readl(host->base + DAVINCI_MMCCTL) & in mmc_davinci_set_ios()
747 host->base + DAVINCI_MMCCTL); in mmc_davinci_set_ios()
749 writel(readl(host->base + DAVINCI_MMCCTL) & in mmc_davinci_set_ios()
751 host->base + DAVINCI_MMCCTL); in mmc_davinci_set_ios()
757 host->bus_mode = ios->bus_mode; in mmc_davinci_set_ios()
763 writel(0, host->base + DAVINCI_MMCARGHL); in mmc_davinci_set_ios()
764 writel(MMCCMD_INITCK, host->base + DAVINCI_MMCCMD); in mmc_davinci_set_ios()
766 u32 tmp = readl(host->base + DAVINCI_MMCST0); in mmc_davinci_set_ios()
775 dev_warn(mmc_dev(host->mmc), "powerup timeout\n"); in mmc_davinci_set_ios()
782 mmc_davinci_xfer_done(struct mmc_davinci_host *host, struct mmc_data *data) in mmc_davinci_xfer_done() argument
784 host->data = NULL; in mmc_davinci_xfer_done()
786 if (host->mmc->caps & MMC_CAP_SDIO_IRQ) { in mmc_davinci_xfer_done()
792 if (host->sdio_int && !(readl(host->base + DAVINCI_SDIOST0) & in mmc_davinci_xfer_done()
794 writel(SDIOIST_IOINT, host->base + DAVINCI_SDIOIST); in mmc_davinci_xfer_done()
795 mmc_signal_sdio_irq(host->mmc); in mmc_davinci_xfer_done()
799 if (host->do_dma) { in mmc_davinci_xfer_done()
800 davinci_abort_dma(host); in mmc_davinci_xfer_done()
802 dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len, in mmc_davinci_xfer_done()
806 host->do_dma = false; in mmc_davinci_xfer_done()
808 host->data_dir = DAVINCI_MMC_DATADIR_NONE; in mmc_davinci_xfer_done()
810 if (!data->stop || (host->cmd && host->cmd->error)) { in mmc_davinci_xfer_done()
811 mmc_request_done(host->mmc, data->mrq); in mmc_davinci_xfer_done()
812 writel(0, host->base + DAVINCI_MMCIM); in mmc_davinci_xfer_done()
813 host->active_request = false; in mmc_davinci_xfer_done()
815 mmc_davinci_start_command(host, data->stop); in mmc_davinci_xfer_done()
818 static void mmc_davinci_cmd_done(struct mmc_davinci_host *host, in mmc_davinci_cmd_done() argument
821 host->cmd = NULL; in mmc_davinci_cmd_done()
826 cmd->resp[3] = readl(host->base + DAVINCI_MMCRSP01); in mmc_davinci_cmd_done()
827 cmd->resp[2] = readl(host->base + DAVINCI_MMCRSP23); in mmc_davinci_cmd_done()
828 cmd->resp[1] = readl(host->base + DAVINCI_MMCRSP45); in mmc_davinci_cmd_done()
829 cmd->resp[0] = readl(host->base + DAVINCI_MMCRSP67); in mmc_davinci_cmd_done()
832 cmd->resp[0] = readl(host->base + DAVINCI_MMCRSP67); in mmc_davinci_cmd_done()
836 if (host->data == NULL || cmd->error) { in mmc_davinci_cmd_done()
839 mmc_request_done(host->mmc, cmd->mrq); in mmc_davinci_cmd_done()
840 writel(0, host->base + DAVINCI_MMCIM); in mmc_davinci_cmd_done()
841 host->active_request = false; in mmc_davinci_cmd_done()
845 static inline void mmc_davinci_reset_ctrl(struct mmc_davinci_host *host, in mmc_davinci_reset_ctrl() argument
850 temp = readl(host->base + DAVINCI_MMCCTL); in mmc_davinci_reset_ctrl()
856 writel(temp, host->base + DAVINCI_MMCCTL); in mmc_davinci_reset_ctrl()
861 davinci_abort_data(struct mmc_davinci_host *host, struct mmc_data *data) in davinci_abort_data() argument
863 mmc_davinci_reset_ctrl(host, 1); in davinci_abort_data()
864 mmc_davinci_reset_ctrl(host, 0); in davinci_abort_data()
869 struct mmc_davinci_host *host = dev_id; in mmc_davinci_sdio_irq() local
872 status = readl(host->base + DAVINCI_SDIOIST); in mmc_davinci_sdio_irq()
874 dev_dbg(mmc_dev(host->mmc), in mmc_davinci_sdio_irq()
876 writel(status | SDIOIST_IOINT, host->base + DAVINCI_SDIOIST); in mmc_davinci_sdio_irq()
877 mmc_signal_sdio_irq(host->mmc); in mmc_davinci_sdio_irq()
884 struct mmc_davinci_host *host = (struct mmc_davinci_host *)dev_id; in mmc_davinci_irq() local
888 struct mmc_data *data = host->data; in mmc_davinci_irq()
890 if (host->cmd == NULL && host->data == NULL) { in mmc_davinci_irq()
891 status = readl(host->base + DAVINCI_MMCST0); in mmc_davinci_irq()
892 dev_dbg(mmc_dev(host->mmc), in mmc_davinci_irq()
895 writel(0, host->base + DAVINCI_MMCIM); in mmc_davinci_irq()
899 status = readl(host->base + DAVINCI_MMCST0); in mmc_davinci_irq()
909 if (host->bytes_left && (status & (MMCST0_DXRDY | MMCST0_DRRDY))) { in mmc_davinci_irq()
919 im_val = readl(host->base + DAVINCI_MMCIM); in mmc_davinci_irq()
920 writel(0, host->base + DAVINCI_MMCIM); in mmc_davinci_irq()
923 davinci_fifo_data_trans(host, rw_threshold); in mmc_davinci_irq()
924 status = readl(host->base + DAVINCI_MMCST0); in mmc_davinci_irq()
926 } while (host->bytes_left && in mmc_davinci_irq()
935 writel(im_val, host->base + DAVINCI_MMCIM); in mmc_davinci_irq()
941 if ((host->do_dma == 0) && (host->bytes_left > 0)) { in mmc_davinci_irq()
945 davinci_fifo_data_trans(host, host->bytes_left); in mmc_davinci_irq()
950 dev_err(mmc_dev(host->mmc), in mmc_davinci_irq()
960 dev_dbg(mmc_dev(host->mmc), in mmc_davinci_irq()
964 davinci_abort_data(host, data); in mmc_davinci_irq()
979 u32 temp = readb(host->base + DAVINCI_MMCDRSP); in mmc_davinci_irq()
984 dev_dbg(mmc_dev(host->mmc), "data %s %s error\n", in mmc_davinci_irq()
988 davinci_abort_data(host, data); in mmc_davinci_irq()
993 if (host->cmd) { in mmc_davinci_irq()
994 dev_dbg(mmc_dev(host->mmc), in mmc_davinci_irq()
996 host->cmd->opcode, qstatus); in mmc_davinci_irq()
997 host->cmd->error = -ETIMEDOUT; in mmc_davinci_irq()
1000 davinci_abort_data(host, data); in mmc_davinci_irq()
1008 dev_dbg(mmc_dev(host->mmc), "Command CRC error\n"); in mmc_davinci_irq()
1009 if (host->cmd) { in mmc_davinci_irq()
1010 host->cmd->error = -EILSEQ; in mmc_davinci_irq()
1017 end_command = (int) host->cmd; in mmc_davinci_irq()
1021 mmc_davinci_cmd_done(host, host->cmd); in mmc_davinci_irq()
1023 mmc_davinci_xfer_done(host, data); in mmc_davinci_irq()
1049 struct mmc_davinci_host *host = mmc_priv(mmc); in mmc_davinci_enable_sdio_irq() local
1052 if (!(readl(host->base + DAVINCI_SDIOST0) & SDIOST0_DAT1_HI)) { in mmc_davinci_enable_sdio_irq()
1053 writel(SDIOIST_IOINT, host->base + DAVINCI_SDIOIST); in mmc_davinci_enable_sdio_irq()
1054 mmc_signal_sdio_irq(host->mmc); in mmc_davinci_enable_sdio_irq()
1056 host->sdio_int = true; in mmc_davinci_enable_sdio_irq()
1057 writel(readl(host->base + DAVINCI_SDIOIEN) | in mmc_davinci_enable_sdio_irq()
1058 SDIOIEN_IOINTEN, host->base + DAVINCI_SDIOIEN); in mmc_davinci_enable_sdio_irq()
1061 host->sdio_int = false; in mmc_davinci_enable_sdio_irq()
1062 writel(readl(host->base + DAVINCI_SDIOIEN) & ~SDIOIEN_IOINTEN, in mmc_davinci_enable_sdio_irq()
1063 host->base + DAVINCI_SDIOIEN); in mmc_davinci_enable_sdio_irq()
1081 struct mmc_davinci_host *host; in mmc_davinci_cpufreq_transition() local
1086 host = container_of(nb, struct mmc_davinci_host, freq_transition); in mmc_davinci_cpufreq_transition()
1087 mmc = host->mmc; in mmc_davinci_cpufreq_transition()
1088 mmc_pclk = clk_get_rate(host->clk); in mmc_davinci_cpufreq_transition()
1092 host->mmc_input_clk = mmc_pclk; in mmc_davinci_cpufreq_transition()
1100 static inline int mmc_davinci_cpufreq_register(struct mmc_davinci_host *host) in mmc_davinci_cpufreq_register() argument
1102 host->freq_transition.notifier_call = mmc_davinci_cpufreq_transition; in mmc_davinci_cpufreq_register()
1104 return cpufreq_register_notifier(&host->freq_transition, in mmc_davinci_cpufreq_register()
1108 static inline void mmc_davinci_cpufreq_deregister(struct mmc_davinci_host *host) in mmc_davinci_cpufreq_deregister() argument
1110 cpufreq_unregister_notifier(&host->freq_transition, in mmc_davinci_cpufreq_deregister()
1114 static inline int mmc_davinci_cpufreq_register(struct mmc_davinci_host *host) in mmc_davinci_cpufreq_register() argument
1119 static inline void mmc_davinci_cpufreq_deregister(struct mmc_davinci_host *host) in mmc_davinci_cpufreq_deregister() argument
1123 static void __init init_mmcsd_host(struct mmc_davinci_host *host) in init_mmcsd_host() argument
1126 mmc_davinci_reset_ctrl(host, 1); in init_mmcsd_host()
1128 writel(0, host->base + DAVINCI_MMCCLK); in init_mmcsd_host()
1129 writel(MMCCLK_CLKEN, host->base + DAVINCI_MMCCLK); in init_mmcsd_host()
1131 writel(0x1FFF, host->base + DAVINCI_MMCTOR); in init_mmcsd_host()
1132 writel(0xFFFF, host->base + DAVINCI_MMCTOD); in init_mmcsd_host()
1134 mmc_davinci_reset_ctrl(host, 0); in init_mmcsd_host()
1205 struct mmc_davinci_host *host = NULL; in davinci_mmcsd_probe() local
1235 host = mmc_priv(mmc); in davinci_mmcsd_probe()
1236 host->mmc = mmc; /* Important */ in davinci_mmcsd_probe()
1238 host->mem_res = mem; in davinci_mmcsd_probe()
1239 host->base = devm_ioremap(&pdev->dev, mem->start, mem_size); in davinci_mmcsd_probe()
1240 if (!host->base) { in davinci_mmcsd_probe()
1245 host->clk = devm_clk_get(&pdev->dev, NULL); in davinci_mmcsd_probe()
1246 if (IS_ERR(host->clk)) { in davinci_mmcsd_probe()
1247 ret = PTR_ERR(host->clk); in davinci_mmcsd_probe()
1250 ret = clk_prepare_enable(host->clk); in davinci_mmcsd_probe()
1254 host->mmc_input_clk = clk_get_rate(host->clk); in davinci_mmcsd_probe()
1256 init_mmcsd_host(host); in davinci_mmcsd_probe()
1259 host->nr_sg = pdata->nr_sg - 1; in davinci_mmcsd_probe()
1261 if (host->nr_sg > MAX_NR_SG || !host->nr_sg) in davinci_mmcsd_probe()
1262 host->nr_sg = MAX_NR_SG; in davinci_mmcsd_probe()
1264 host->use_dma = use_dma; in davinci_mmcsd_probe()
1265 host->mmc_irq = irq; in davinci_mmcsd_probe()
1266 host->sdio_irq = platform_get_irq(pdev, 1); in davinci_mmcsd_probe()
1268 if (host->use_dma) { in davinci_mmcsd_probe()
1269 ret = davinci_acquire_dma_channels(host); in davinci_mmcsd_probe()
1273 host->use_dma = 0; in davinci_mmcsd_probe()
1288 host->version = id_entry->driver_data; in davinci_mmcsd_probe()
1313 dev_dbg(mmc_dev(host->mmc), "max_segs=%d\n", mmc->max_segs); in davinci_mmcsd_probe()
1314 dev_dbg(mmc_dev(host->mmc), "max_blk_size=%d\n", mmc->max_blk_size); in davinci_mmcsd_probe()
1315 dev_dbg(mmc_dev(host->mmc), "max_req_size=%d\n", mmc->max_req_size); in davinci_mmcsd_probe()
1316 dev_dbg(mmc_dev(host->mmc), "max_seg_size=%d\n", mmc->max_seg_size); in davinci_mmcsd_probe()
1318 platform_set_drvdata(pdev, host); in davinci_mmcsd_probe()
1320 ret = mmc_davinci_cpufreq_register(host); in davinci_mmcsd_probe()
1331 mmc_hostname(mmc), host); in davinci_mmcsd_probe()
1335 if (host->sdio_irq >= 0) { in davinci_mmcsd_probe()
1336 ret = devm_request_irq(&pdev->dev, host->sdio_irq, in davinci_mmcsd_probe()
1338 mmc_hostname(mmc), host); in davinci_mmcsd_probe()
1345 dev_info(mmc_dev(host->mmc), "Using %s, %d-bit mode\n", in davinci_mmcsd_probe()
1346 host->use_dma ? "DMA" : "PIO", in davinci_mmcsd_probe()
1354 mmc_davinci_cpufreq_deregister(host); in davinci_mmcsd_probe()
1356 davinci_release_dma_channels(host); in davinci_mmcsd_probe()
1358 clk_disable_unprepare(host->clk); in davinci_mmcsd_probe()
1369 struct mmc_davinci_host *host = platform_get_drvdata(pdev); in davinci_mmcsd_remove() local
1371 mmc_remove_host(host->mmc); in davinci_mmcsd_remove()
1372 mmc_davinci_cpufreq_deregister(host); in davinci_mmcsd_remove()
1373 davinci_release_dma_channels(host); in davinci_mmcsd_remove()
1374 clk_disable_unprepare(host->clk); in davinci_mmcsd_remove()
1375 mmc_free_host(host->mmc); in davinci_mmcsd_remove()
1384 struct mmc_davinci_host *host = platform_get_drvdata(pdev); in davinci_mmcsd_suspend() local
1386 writel(0, host->base + DAVINCI_MMCIM); in davinci_mmcsd_suspend()
1387 mmc_davinci_reset_ctrl(host, 1); in davinci_mmcsd_suspend()
1388 clk_disable(host->clk); in davinci_mmcsd_suspend()
1396 struct mmc_davinci_host *host = platform_get_drvdata(pdev); in davinci_mmcsd_resume() local
1398 clk_enable(host->clk); in davinci_mmcsd_resume()
1399 mmc_davinci_reset_ctrl(host, 0); in davinci_mmcsd_resume()