Lines Matching refs:host
216 static void mmc_davinci_sg_to_buf(struct mmc_davinci_host *host) in mmc_davinci_sg_to_buf() argument
218 host->buffer_bytes_left = sg_dma_len(host->sg); in mmc_davinci_sg_to_buf()
219 host->buffer = sg_virt(host->sg); in mmc_davinci_sg_to_buf()
220 if (host->buffer_bytes_left > host->bytes_left) in mmc_davinci_sg_to_buf()
221 host->buffer_bytes_left = host->bytes_left; in mmc_davinci_sg_to_buf()
224 static void davinci_fifo_data_trans(struct mmc_davinci_host *host, in davinci_fifo_data_trans() argument
230 if (host->buffer_bytes_left == 0) { in davinci_fifo_data_trans()
231 host->sg = sg_next(host->data->sg); in davinci_fifo_data_trans()
232 mmc_davinci_sg_to_buf(host); in davinci_fifo_data_trans()
235 p = host->buffer; in davinci_fifo_data_trans()
236 if (n > host->buffer_bytes_left) in davinci_fifo_data_trans()
237 n = host->buffer_bytes_left; in davinci_fifo_data_trans()
238 host->buffer_bytes_left -= n; in davinci_fifo_data_trans()
239 host->bytes_left -= n; in davinci_fifo_data_trans()
245 if (host->data_dir == DAVINCI_MMC_DATADIR_WRITE) { in davinci_fifo_data_trans()
247 writel(*((u32 *)p), host->base + DAVINCI_MMCDXR); in davinci_fifo_data_trans()
251 iowrite8_rep(host->base + DAVINCI_MMCDXR, p, (n & 3)); in davinci_fifo_data_trans()
256 *((u32 *)p) = readl(host->base + DAVINCI_MMCDRR); in davinci_fifo_data_trans()
260 ioread8_rep(host->base + DAVINCI_MMCDRR, p, (n & 3)); in davinci_fifo_data_trans()
264 host->buffer = p; in davinci_fifo_data_trans()
267 static void mmc_davinci_start_command(struct mmc_davinci_host *host, in mmc_davinci_start_command() argument
273 dev_dbg(mmc_dev(host->mmc), "CMD%d, arg 0x%08x%s\n", in mmc_davinci_start_command()
293 host->cmd = cmd; in mmc_davinci_start_command()
314 dev_dbg(mmc_dev(host->mmc), "unknown resp_type %04x\n", in mmc_davinci_start_command()
323 if (host->do_dma) in mmc_davinci_start_command()
326 if (host->version == MMC_CTLR_VERSION_2 && host->data != NULL && in mmc_davinci_start_command()
327 host->data_dir == DAVINCI_MMC_DATADIR_READ) in mmc_davinci_start_command()
335 if (host->data_dir == DAVINCI_MMC_DATADIR_WRITE) in mmc_davinci_start_command()
338 if (host->bus_mode == MMC_BUSMODE_PUSHPULL) in mmc_davinci_start_command()
342 writel(0x1FFF, host->base + DAVINCI_MMCTOR); in mmc_davinci_start_command()
346 if (host->data_dir == DAVINCI_MMC_DATADIR_WRITE) { in mmc_davinci_start_command()
349 if (!host->do_dma) in mmc_davinci_start_command()
351 } else if (host->data_dir == DAVINCI_MMC_DATADIR_READ) { in mmc_davinci_start_command()
354 if (!host->do_dma) in mmc_davinci_start_command()
362 if (!host->do_dma && (host->data_dir == DAVINCI_MMC_DATADIR_WRITE)) in mmc_davinci_start_command()
363 davinci_fifo_data_trans(host, rw_threshold); in mmc_davinci_start_command()
365 writel(cmd->arg, host->base + DAVINCI_MMCARGHL); in mmc_davinci_start_command()
366 writel(cmd_reg, host->base + DAVINCI_MMCCMD); in mmc_davinci_start_command()
368 host->active_request = true; in mmc_davinci_start_command()
370 if (!host->do_dma && host->bytes_left <= poll_threshold) { in mmc_davinci_start_command()
373 while (host->active_request && count--) { in mmc_davinci_start_command()
374 mmc_davinci_irq(0, host); in mmc_davinci_start_command()
379 if (host->active_request) in mmc_davinci_start_command()
380 writel(im_val, host->base + DAVINCI_MMCIM); in mmc_davinci_start_command()
387 static void davinci_abort_dma(struct mmc_davinci_host *host) in davinci_abort_dma() argument
391 if (host->data_dir == DAVINCI_MMC_DATADIR_READ) in davinci_abort_dma()
392 sync_dev = host->dma_rx; in davinci_abort_dma()
394 sync_dev = host->dma_tx; in davinci_abort_dma()
399 static int mmc_davinci_send_dma_request(struct mmc_davinci_host *host, in mmc_davinci_send_dma_request() argument
406 if (host->data_dir == DAVINCI_MMC_DATADIR_WRITE) { in mmc_davinci_send_dma_request()
409 .dst_addr = host->mem_res->start + DAVINCI_MMCDXR, in mmc_davinci_send_dma_request()
414 chan = host->dma_tx; in mmc_davinci_send_dma_request()
415 dmaengine_slave_config(host->dma_tx, &dma_tx_conf); in mmc_davinci_send_dma_request()
417 desc = dmaengine_prep_slave_sg(host->dma_tx, in mmc_davinci_send_dma_request()
419 host->sg_len, in mmc_davinci_send_dma_request()
423 dev_dbg(mmc_dev(host->mmc), in mmc_davinci_send_dma_request()
431 .src_addr = host->mem_res->start + DAVINCI_MMCDRR, in mmc_davinci_send_dma_request()
436 chan = host->dma_rx; in mmc_davinci_send_dma_request()
437 dmaengine_slave_config(host->dma_rx, &dma_rx_conf); in mmc_davinci_send_dma_request()
439 desc = dmaengine_prep_slave_sg(host->dma_rx, in mmc_davinci_send_dma_request()
441 host->sg_len, in mmc_davinci_send_dma_request()
445 dev_dbg(mmc_dev(host->mmc), in mmc_davinci_send_dma_request()
459 static int mmc_davinci_start_dma_transfer(struct mmc_davinci_host *host, in mmc_davinci_start_dma_transfer() argument
466 host->sg_len = dma_map_sg(mmc_dev(host->mmc), data->sg, data->sg_len, in mmc_davinci_start_dma_transfer()
470 for (i = 0; i < host->sg_len; i++) { in mmc_davinci_start_dma_transfer()
472 dma_unmap_sg(mmc_dev(host->mmc), in mmc_davinci_start_dma_transfer()
479 host->do_dma = 1; in mmc_davinci_start_dma_transfer()
480 ret = mmc_davinci_send_dma_request(host, data); in mmc_davinci_start_dma_transfer()
485 static void davinci_release_dma_channels(struct mmc_davinci_host *host) in davinci_release_dma_channels() argument
487 if (!host->use_dma) in davinci_release_dma_channels()
490 dma_release_channel(host->dma_tx); in davinci_release_dma_channels()
491 dma_release_channel(host->dma_rx); in davinci_release_dma_channels()
494 static int davinci_acquire_dma_channels(struct mmc_davinci_host *host) in davinci_acquire_dma_channels() argument
496 host->dma_tx = dma_request_chan(mmc_dev(host->mmc), "tx"); in davinci_acquire_dma_channels()
497 if (IS_ERR(host->dma_tx)) { in davinci_acquire_dma_channels()
498 dev_err(mmc_dev(host->mmc), "Can't get dma_tx channel\n"); in davinci_acquire_dma_channels()
499 return PTR_ERR(host->dma_tx); in davinci_acquire_dma_channels()
502 host->dma_rx = dma_request_chan(mmc_dev(host->mmc), "rx"); in davinci_acquire_dma_channels()
503 if (IS_ERR(host->dma_rx)) { in davinci_acquire_dma_channels()
504 dev_err(mmc_dev(host->mmc), "Can't get dma_rx channel\n"); in davinci_acquire_dma_channels()
505 dma_release_channel(host->dma_tx); in davinci_acquire_dma_channels()
506 return PTR_ERR(host->dma_rx); in davinci_acquire_dma_channels()
515 mmc_davinci_prepare_data(struct mmc_davinci_host *host, struct mmc_request *req) in mmc_davinci_prepare_data() argument
521 if (host->version == MMC_CTLR_VERSION_2) in mmc_davinci_prepare_data()
524 host->data = data; in mmc_davinci_prepare_data()
526 host->data_dir = DAVINCI_MMC_DATADIR_NONE; in mmc_davinci_prepare_data()
527 writel(0, host->base + DAVINCI_MMCBLEN); in mmc_davinci_prepare_data()
528 writel(0, host->base + DAVINCI_MMCNBLK); in mmc_davinci_prepare_data()
532 dev_dbg(mmc_dev(host->mmc), "%s, %d blocks of %d bytes\n", in mmc_davinci_prepare_data()
535 dev_dbg(mmc_dev(host->mmc), " DTO %d cycles + %d ns\n", in mmc_davinci_prepare_data()
538 (data->timeout_ns / host->ns_in_one_cycle); in mmc_davinci_prepare_data()
542 writel(timeout, host->base + DAVINCI_MMCTOD); in mmc_davinci_prepare_data()
543 writel(data->blocks, host->base + DAVINCI_MMCNBLK); in mmc_davinci_prepare_data()
544 writel(data->blksz, host->base + DAVINCI_MMCBLEN); in mmc_davinci_prepare_data()
548 host->data_dir = DAVINCI_MMC_DATADIR_WRITE; in mmc_davinci_prepare_data()
550 host->base + DAVINCI_MMCFIFOCTL); in mmc_davinci_prepare_data()
552 host->base + DAVINCI_MMCFIFOCTL); in mmc_davinci_prepare_data()
554 host->data_dir = DAVINCI_MMC_DATADIR_READ; in mmc_davinci_prepare_data()
556 host->base + DAVINCI_MMCFIFOCTL); in mmc_davinci_prepare_data()
558 host->base + DAVINCI_MMCFIFOCTL); in mmc_davinci_prepare_data()
561 host->buffer = NULL; in mmc_davinci_prepare_data()
562 host->bytes_left = data->blocks * data->blksz; in mmc_davinci_prepare_data()
572 if (host->use_dma && (host->bytes_left & (rw_threshold - 1)) == 0 in mmc_davinci_prepare_data()
573 && mmc_davinci_start_dma_transfer(host, data) == 0) { in mmc_davinci_prepare_data()
575 host->bytes_left = 0; in mmc_davinci_prepare_data()
578 host->sg_len = data->sg_len; in mmc_davinci_prepare_data()
579 host->sg = host->data->sg; in mmc_davinci_prepare_data()
580 mmc_davinci_sg_to_buf(host); in mmc_davinci_prepare_data()
586 struct mmc_davinci_host *host = mmc_priv(mmc); in mmc_davinci_request() local
594 mmcst1 = readl(host->base + DAVINCI_MMCST1); in mmc_davinci_request()
600 dev_err(mmc_dev(host->mmc), "still BUSY? bad ... \n"); in mmc_davinci_request()
606 host->do_dma = 0; in mmc_davinci_request()
607 mmc_davinci_prepare_data(host, req); in mmc_davinci_request()
608 mmc_davinci_start_command(host, req->cmd); in mmc_davinci_request()
611 static unsigned int calculate_freq_for_card(struct mmc_davinci_host *host, in calculate_freq_for_card() argument
616 mmc_pclk = host->mmc_input_clk; in calculate_freq_for_card()
630 host->ns_in_one_cycle = (1000000) / (((mmc_pclk in calculate_freq_for_card()
633 host->ns_in_one_cycle = (1000000) / (((mmc_pclk in calculate_freq_for_card()
643 struct mmc_davinci_host *host = mmc_priv(mmc); in calculate_clk_divider() local
657 temp = readl(host->base + DAVINCI_MMCCLK) & ~MMCCLK_CLKRT_MASK; in calculate_clk_divider()
659 writel(temp, host->base + DAVINCI_MMCCLK); in calculate_clk_divider()
662 host->ns_in_one_cycle = (1000000) / (MMCSD_INIT_CLOCK/1000); in calculate_clk_divider()
665 mmc_push_pull_freq = calculate_freq_for_card(host, ios->clock); in calculate_clk_divider()
670 temp = readl(host->base + DAVINCI_MMCCLK) & ~MMCCLK_CLKEN; in calculate_clk_divider()
671 writel(temp, host->base + DAVINCI_MMCCLK); in calculate_clk_divider()
675 temp = readl(host->base + DAVINCI_MMCCLK) & ~MMCCLK_CLKRT_MASK; in calculate_clk_divider()
677 writel(temp, host->base + DAVINCI_MMCCLK); in calculate_clk_divider()
679 writel(temp | MMCCLK_CLKEN, host->base + DAVINCI_MMCCLK); in calculate_clk_divider()
687 struct mmc_davinci_host *host = mmc_priv(mmc); in mmc_davinci_set_ios() local
691 dev_dbg(mmc_dev(host->mmc), in mmc_davinci_set_ios()
709 dev_dbg(mmc_dev(host->mmc), "Enabling 8 bit mode\n"); in mmc_davinci_set_ios()
710 writel((readl(host->base + DAVINCI_MMCCTL) & in mmc_davinci_set_ios()
712 host->base + DAVINCI_MMCCTL); in mmc_davinci_set_ios()
715 dev_dbg(mmc_dev(host->mmc), "Enabling 4 bit mode\n"); in mmc_davinci_set_ios()
716 if (host->version == MMC_CTLR_VERSION_2) in mmc_davinci_set_ios()
717 writel((readl(host->base + DAVINCI_MMCCTL) & in mmc_davinci_set_ios()
719 host->base + DAVINCI_MMCCTL); in mmc_davinci_set_ios()
721 writel(readl(host->base + DAVINCI_MMCCTL) | in mmc_davinci_set_ios()
723 host->base + DAVINCI_MMCCTL); in mmc_davinci_set_ios()
726 dev_dbg(mmc_dev(host->mmc), "Enabling 1 bit mode\n"); in mmc_davinci_set_ios()
727 if (host->version == MMC_CTLR_VERSION_2) in mmc_davinci_set_ios()
728 writel(readl(host->base + DAVINCI_MMCCTL) & in mmc_davinci_set_ios()
730 host->base + DAVINCI_MMCCTL); in mmc_davinci_set_ios()
732 writel(readl(host->base + DAVINCI_MMCCTL) & in mmc_davinci_set_ios()
734 host->base + DAVINCI_MMCCTL); in mmc_davinci_set_ios()
740 host->bus_mode = ios->bus_mode; in mmc_davinci_set_ios()
746 writel(0, host->base + DAVINCI_MMCARGHL); in mmc_davinci_set_ios()
747 writel(MMCCMD_INITCK, host->base + DAVINCI_MMCCMD); in mmc_davinci_set_ios()
749 u32 tmp = readl(host->base + DAVINCI_MMCST0); in mmc_davinci_set_ios()
758 dev_warn(mmc_dev(host->mmc), "powerup timeout\n"); in mmc_davinci_set_ios()
765 mmc_davinci_xfer_done(struct mmc_davinci_host *host, struct mmc_data *data) in mmc_davinci_xfer_done() argument
767 host->data = NULL; in mmc_davinci_xfer_done()
769 if (host->mmc->caps & MMC_CAP_SDIO_IRQ) { in mmc_davinci_xfer_done()
775 if (host->sdio_int && !(readl(host->base + DAVINCI_SDIOST0) & in mmc_davinci_xfer_done()
777 writel(SDIOIST_IOINT, host->base + DAVINCI_SDIOIST); in mmc_davinci_xfer_done()
778 mmc_signal_sdio_irq(host->mmc); in mmc_davinci_xfer_done()
782 if (host->do_dma) { in mmc_davinci_xfer_done()
783 davinci_abort_dma(host); in mmc_davinci_xfer_done()
785 dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len, in mmc_davinci_xfer_done()
787 host->do_dma = false; in mmc_davinci_xfer_done()
789 host->data_dir = DAVINCI_MMC_DATADIR_NONE; in mmc_davinci_xfer_done()
791 if (!data->stop || (host->cmd && host->cmd->error)) { in mmc_davinci_xfer_done()
792 mmc_request_done(host->mmc, data->mrq); in mmc_davinci_xfer_done()
793 writel(0, host->base + DAVINCI_MMCIM); in mmc_davinci_xfer_done()
794 host->active_request = false; in mmc_davinci_xfer_done()
796 mmc_davinci_start_command(host, data->stop); in mmc_davinci_xfer_done()
799 static void mmc_davinci_cmd_done(struct mmc_davinci_host *host, in mmc_davinci_cmd_done() argument
802 host->cmd = NULL; in mmc_davinci_cmd_done()
807 cmd->resp[3] = readl(host->base + DAVINCI_MMCRSP01); in mmc_davinci_cmd_done()
808 cmd->resp[2] = readl(host->base + DAVINCI_MMCRSP23); in mmc_davinci_cmd_done()
809 cmd->resp[1] = readl(host->base + DAVINCI_MMCRSP45); in mmc_davinci_cmd_done()
810 cmd->resp[0] = readl(host->base + DAVINCI_MMCRSP67); in mmc_davinci_cmd_done()
813 cmd->resp[0] = readl(host->base + DAVINCI_MMCRSP67); in mmc_davinci_cmd_done()
817 if (host->data == NULL || cmd->error) { in mmc_davinci_cmd_done()
820 mmc_request_done(host->mmc, cmd->mrq); in mmc_davinci_cmd_done()
821 writel(0, host->base + DAVINCI_MMCIM); in mmc_davinci_cmd_done()
822 host->active_request = false; in mmc_davinci_cmd_done()
826 static inline void mmc_davinci_reset_ctrl(struct mmc_davinci_host *host, in mmc_davinci_reset_ctrl() argument
831 temp = readl(host->base + DAVINCI_MMCCTL); in mmc_davinci_reset_ctrl()
837 writel(temp, host->base + DAVINCI_MMCCTL); in mmc_davinci_reset_ctrl()
842 davinci_abort_data(struct mmc_davinci_host *host, struct mmc_data *data) in davinci_abort_data() argument
844 mmc_davinci_reset_ctrl(host, 1); in davinci_abort_data()
845 mmc_davinci_reset_ctrl(host, 0); in davinci_abort_data()
850 struct mmc_davinci_host *host = dev_id; in mmc_davinci_sdio_irq() local
853 status = readl(host->base + DAVINCI_SDIOIST); in mmc_davinci_sdio_irq()
855 dev_dbg(mmc_dev(host->mmc), in mmc_davinci_sdio_irq()
857 writel(status | SDIOIST_IOINT, host->base + DAVINCI_SDIOIST); in mmc_davinci_sdio_irq()
858 mmc_signal_sdio_irq(host->mmc); in mmc_davinci_sdio_irq()
865 struct mmc_davinci_host *host = (struct mmc_davinci_host *)dev_id; in mmc_davinci_irq() local
869 struct mmc_data *data = host->data; in mmc_davinci_irq()
871 if (host->cmd == NULL && host->data == NULL) { in mmc_davinci_irq()
872 status = readl(host->base + DAVINCI_MMCST0); in mmc_davinci_irq()
873 dev_dbg(mmc_dev(host->mmc), in mmc_davinci_irq()
876 writel(0, host->base + DAVINCI_MMCIM); in mmc_davinci_irq()
880 status = readl(host->base + DAVINCI_MMCST0); in mmc_davinci_irq()
890 if (host->bytes_left && (status & (MMCST0_DXRDY | MMCST0_DRRDY))) { in mmc_davinci_irq()
900 im_val = readl(host->base + DAVINCI_MMCIM); in mmc_davinci_irq()
901 writel(0, host->base + DAVINCI_MMCIM); in mmc_davinci_irq()
904 davinci_fifo_data_trans(host, rw_threshold); in mmc_davinci_irq()
905 status = readl(host->base + DAVINCI_MMCST0); in mmc_davinci_irq()
907 } while (host->bytes_left && in mmc_davinci_irq()
916 writel(im_val, host->base + DAVINCI_MMCIM); in mmc_davinci_irq()
922 if ((host->do_dma == 0) && (host->bytes_left > 0)) { in mmc_davinci_irq()
926 davinci_fifo_data_trans(host, host->bytes_left); in mmc_davinci_irq()
931 dev_err(mmc_dev(host->mmc), in mmc_davinci_irq()
941 dev_dbg(mmc_dev(host->mmc), in mmc_davinci_irq()
945 davinci_abort_data(host, data); in mmc_davinci_irq()
960 u32 temp = readb(host->base + DAVINCI_MMCDRSP); in mmc_davinci_irq()
965 dev_dbg(mmc_dev(host->mmc), "data %s %s error\n", in mmc_davinci_irq()
969 davinci_abort_data(host, data); in mmc_davinci_irq()
974 if (host->cmd) { in mmc_davinci_irq()
975 dev_dbg(mmc_dev(host->mmc), in mmc_davinci_irq()
977 host->cmd->opcode, qstatus); in mmc_davinci_irq()
978 host->cmd->error = -ETIMEDOUT; in mmc_davinci_irq()
981 davinci_abort_data(host, data); in mmc_davinci_irq()
989 dev_dbg(mmc_dev(host->mmc), "Command CRC error\n"); in mmc_davinci_irq()
990 if (host->cmd) { in mmc_davinci_irq()
991 host->cmd->error = -EILSEQ; in mmc_davinci_irq()
998 end_command = host->cmd ? 1 : 0; in mmc_davinci_irq()
1002 mmc_davinci_cmd_done(host, host->cmd); in mmc_davinci_irq()
1004 mmc_davinci_xfer_done(host, data); in mmc_davinci_irq()
1032 struct mmc_davinci_host *host = mmc_priv(mmc); in mmc_davinci_enable_sdio_irq() local
1035 if (!(readl(host->base + DAVINCI_SDIOST0) & SDIOST0_DAT1_HI)) { in mmc_davinci_enable_sdio_irq()
1036 writel(SDIOIST_IOINT, host->base + DAVINCI_SDIOIST); in mmc_davinci_enable_sdio_irq()
1037 mmc_signal_sdio_irq(host->mmc); in mmc_davinci_enable_sdio_irq()
1039 host->sdio_int = true; in mmc_davinci_enable_sdio_irq()
1040 writel(readl(host->base + DAVINCI_SDIOIEN) | in mmc_davinci_enable_sdio_irq()
1041 SDIOIEN_IOINTEN, host->base + DAVINCI_SDIOIEN); in mmc_davinci_enable_sdio_irq()
1044 host->sdio_int = false; in mmc_davinci_enable_sdio_irq()
1045 writel(readl(host->base + DAVINCI_SDIOIEN) & ~SDIOIEN_IOINTEN, in mmc_davinci_enable_sdio_irq()
1046 host->base + DAVINCI_SDIOIEN); in mmc_davinci_enable_sdio_irq()
1064 struct mmc_davinci_host *host; in mmc_davinci_cpufreq_transition() local
1069 host = container_of(nb, struct mmc_davinci_host, freq_transition); in mmc_davinci_cpufreq_transition()
1070 mmc = host->mmc; in mmc_davinci_cpufreq_transition()
1071 mmc_pclk = clk_get_rate(host->clk); in mmc_davinci_cpufreq_transition()
1075 host->mmc_input_clk = mmc_pclk; in mmc_davinci_cpufreq_transition()
1083 static inline int mmc_davinci_cpufreq_register(struct mmc_davinci_host *host) in mmc_davinci_cpufreq_register() argument
1085 host->freq_transition.notifier_call = mmc_davinci_cpufreq_transition; in mmc_davinci_cpufreq_register()
1087 return cpufreq_register_notifier(&host->freq_transition, in mmc_davinci_cpufreq_register()
1091 static inline void mmc_davinci_cpufreq_deregister(struct mmc_davinci_host *host) in mmc_davinci_cpufreq_deregister() argument
1093 cpufreq_unregister_notifier(&host->freq_transition, in mmc_davinci_cpufreq_deregister()
1097 static inline int mmc_davinci_cpufreq_register(struct mmc_davinci_host *host) in mmc_davinci_cpufreq_register() argument
1102 static inline void mmc_davinci_cpufreq_deregister(struct mmc_davinci_host *host) in mmc_davinci_cpufreq_deregister() argument
1106 static void init_mmcsd_host(struct mmc_davinci_host *host) in init_mmcsd_host() argument
1109 mmc_davinci_reset_ctrl(host, 1); in init_mmcsd_host()
1111 writel(0, host->base + DAVINCI_MMCCLK); in init_mmcsd_host()
1112 writel(MMCCLK_CLKEN, host->base + DAVINCI_MMCCLK); in init_mmcsd_host()
1114 writel(0x1FFF, host->base + DAVINCI_MMCTOR); in init_mmcsd_host()
1115 writel(0xFFFF, host->base + DAVINCI_MMCTOD); in init_mmcsd_host()
1117 mmc_davinci_reset_ctrl(host, 0); in init_mmcsd_host()
1149 struct mmc_davinci_host *host; in mmc_davinci_parse_pdata() local
1155 host = mmc_priv(mmc); in mmc_davinci_parse_pdata()
1156 if (!host) in mmc_davinci_parse_pdata()
1160 host->nr_sg = pdata->nr_sg - 1; in mmc_davinci_parse_pdata()
1191 struct mmc_davinci_host *host = NULL; in davinci_mmcsd_probe() local
1215 host = mmc_priv(mmc); in davinci_mmcsd_probe()
1216 host->mmc = mmc; /* Important */ in davinci_mmcsd_probe()
1218 host->mem_res = mem; in davinci_mmcsd_probe()
1219 host->base = devm_ioremap(&pdev->dev, mem->start, mem_size); in davinci_mmcsd_probe()
1220 if (!host->base) { in davinci_mmcsd_probe()
1225 host->clk = devm_clk_get(&pdev->dev, NULL); in davinci_mmcsd_probe()
1226 if (IS_ERR(host->clk)) { in davinci_mmcsd_probe()
1227 ret = PTR_ERR(host->clk); in davinci_mmcsd_probe()
1230 ret = clk_prepare_enable(host->clk); in davinci_mmcsd_probe()
1234 host->mmc_input_clk = clk_get_rate(host->clk); in davinci_mmcsd_probe()
1252 if (host->nr_sg > MAX_NR_SG || !host->nr_sg) in davinci_mmcsd_probe()
1253 host->nr_sg = MAX_NR_SG; in davinci_mmcsd_probe()
1255 init_mmcsd_host(host); in davinci_mmcsd_probe()
1257 host->use_dma = use_dma; in davinci_mmcsd_probe()
1258 host->mmc_irq = irq; in davinci_mmcsd_probe()
1259 host->sdio_irq = platform_get_irq_optional(pdev, 1); in davinci_mmcsd_probe()
1261 if (host->use_dma) { in davinci_mmcsd_probe()
1262 ret = davinci_acquire_dma_channels(host); in davinci_mmcsd_probe()
1266 host->use_dma = 0; in davinci_mmcsd_probe()
1273 host->version = id_entry->driver_data; in davinci_mmcsd_probe()
1292 dev_dbg(mmc_dev(host->mmc), "max_segs=%d\n", mmc->max_segs); in davinci_mmcsd_probe()
1293 dev_dbg(mmc_dev(host->mmc), "max_blk_size=%d\n", mmc->max_blk_size); in davinci_mmcsd_probe()
1294 dev_dbg(mmc_dev(host->mmc), "max_req_size=%d\n", mmc->max_req_size); in davinci_mmcsd_probe()
1295 dev_dbg(mmc_dev(host->mmc), "max_seg_size=%d\n", mmc->max_seg_size); in davinci_mmcsd_probe()
1297 platform_set_drvdata(pdev, host); in davinci_mmcsd_probe()
1299 ret = mmc_davinci_cpufreq_register(host); in davinci_mmcsd_probe()
1310 mmc_hostname(mmc), host); in davinci_mmcsd_probe()
1314 if (host->sdio_irq >= 0) { in davinci_mmcsd_probe()
1315 ret = devm_request_irq(&pdev->dev, host->sdio_irq, in davinci_mmcsd_probe()
1317 mmc_hostname(mmc), host); in davinci_mmcsd_probe()
1324 dev_info(mmc_dev(host->mmc), "Using %s, %d-bit mode\n", in davinci_mmcsd_probe()
1325 host->use_dma ? "DMA" : "PIO", in davinci_mmcsd_probe()
1333 mmc_davinci_cpufreq_deregister(host); in davinci_mmcsd_probe()
1335 davinci_release_dma_channels(host); in davinci_mmcsd_probe()
1338 clk_disable_unprepare(host->clk); in davinci_mmcsd_probe()
1349 struct mmc_davinci_host *host = platform_get_drvdata(pdev); in davinci_mmcsd_remove() local
1351 mmc_remove_host(host->mmc); in davinci_mmcsd_remove()
1352 mmc_davinci_cpufreq_deregister(host); in davinci_mmcsd_remove()
1353 davinci_release_dma_channels(host); in davinci_mmcsd_remove()
1354 clk_disable_unprepare(host->clk); in davinci_mmcsd_remove()
1355 mmc_free_host(host->mmc); in davinci_mmcsd_remove()
1361 struct mmc_davinci_host *host = dev_get_drvdata(dev); in davinci_mmcsd_suspend() local
1363 writel(0, host->base + DAVINCI_MMCIM); in davinci_mmcsd_suspend()
1364 mmc_davinci_reset_ctrl(host, 1); in davinci_mmcsd_suspend()
1365 clk_disable(host->clk); in davinci_mmcsd_suspend()
1372 struct mmc_davinci_host *host = dev_get_drvdata(dev); in davinci_mmcsd_resume() local
1375 ret = clk_enable(host->clk); in davinci_mmcsd_resume()
1379 mmc_davinci_reset_ctrl(host, 0); in davinci_mmcsd_resume()