Lines Matching full:mmc
6 * JZ4740 SD/MMC controller driver
18 #include <linux/mmc/host.h>
19 #include <linux/mmc/slot-gpio.h>
131 * The MMC core allows to prepare a mmc_request while another mmc_request
150 struct mmc_host *mmc; member
230 struct device *dev = mmc_dev(host->mmc); in jz4740_mmc_acquire_dma_channels()
241 host->dma_tx = dma_request_chan(mmc_dev(host->mmc), "tx"); in jz4740_mmc_acquire_dma_channels()
243 dev_err(mmc_dev(host->mmc), "Failed to get dma_tx channel\n"); in jz4740_mmc_acquire_dma_channels()
247 host->dma_rx = dma_request_chan(mmc_dev(host->mmc), "rx"); in jz4740_mmc_acquire_dma_channels()
249 dev_err(mmc_dev(host->mmc), "Failed to get dma_rx channel\n"); in jz4740_mmc_acquire_dma_channels()
262 if (max_seg_size < host->mmc->max_seg_size) in jz4740_mmc_acquire_dma_channels()
263 host->mmc->max_seg_size = max_seg_size; in jz4740_mmc_acquire_dma_channels()
270 if (max_seg_size < host->mmc->max_seg_size) in jz4740_mmc_acquire_dma_channels()
271 host->mmc->max_seg_size = max_seg_size; in jz4740_mmc_acquire_dma_channels()
316 dev_err(mmc_dev(host->mmc), in jz4740_mmc_prepare_dma_data()
357 dev_err(mmc_dev(host->mmc), in jz4740_mmc_start_dma_transfer()
374 static void jz4740_mmc_pre_request(struct mmc_host *mmc, in jz4740_mmc_pre_request() argument
377 struct jz4740_mmc_host *host = mmc_priv(mmc); in jz4740_mmc_pre_request()
388 static void jz4740_mmc_post_request(struct mmc_host *mmc, in jz4740_mmc_post_request() argument
392 struct jz4740_mmc_host *host = mmc_priv(mmc); in jz4740_mmc_post_request()
467 mmc_request_done(host->mmc, req); in jz4740_mmc_request_done()
712 * The JZ4780's MMC controller has integrated DMA ability in jz4740_mmc_send_command()
859 mmc_signal_sdio_irq(host->mmc); in jz_mmc_irq()
894 clk_set_rate(host->clk, host->mmc->f_max); in jz4740_mmc_set_clock_rate()
923 static void jz4740_mmc_request(struct mmc_host *mmc, struct mmc_request *req) in jz4740_mmc_request() argument
925 struct jz4740_mmc_host *host = mmc_priv(mmc); in jz4740_mmc_request()
939 static void jz4740_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) in jz4740_mmc_set_ios() argument
941 struct jz4740_mmc_host *host = mmc_priv(mmc); in jz4740_mmc_set_ios()
950 if (!IS_ERR(mmc->supply.vmmc)) in jz4740_mmc_set_ios()
951 mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd); in jz4740_mmc_set_ios()
956 if (!IS_ERR(mmc->supply.vqmmc) && !host->vqmmc_enabled) { in jz4740_mmc_set_ios()
957 ret = regulator_enable(mmc->supply.vqmmc); in jz4740_mmc_set_ios()
965 if (!IS_ERR(mmc->supply.vmmc)) in jz4740_mmc_set_ios()
966 mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0); in jz4740_mmc_set_ios()
967 if (!IS_ERR(mmc->supply.vqmmc) && host->vqmmc_enabled) { in jz4740_mmc_set_ios()
968 regulator_disable(mmc->supply.vqmmc); in jz4740_mmc_set_ios()
994 static void jz4740_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable) in jz4740_mmc_enable_sdio_irq() argument
996 struct jz4740_mmc_host *host = mmc_priv(mmc); in jz4740_mmc_enable_sdio_irq()
1000 static int jz4740_voltage_switch(struct mmc_host *mmc, struct mmc_ios *ios) in jz4740_voltage_switch() argument
1005 if (!IS_ERR(mmc->supply.vqmmc)) { in jz4740_voltage_switch()
1006 ret = mmc_regulator_set_vqmmc(mmc, ios); in jz4740_voltage_switch()
1029 { .compatible = "ingenic,jz4740-mmc", .data = (void *) JZ_MMC_JZ4740 },
1030 { .compatible = "ingenic,jz4725b-mmc", .data = (void *)JZ_MMC_JZ4725B },
1031 { .compatible = "ingenic,jz4760-mmc", .data = (void *) JZ_MMC_JZ4760 },
1032 { .compatible = "ingenic,jz4775-mmc", .data = (void *) JZ_MMC_JZ4780 },
1033 { .compatible = "ingenic,jz4780-mmc", .data = (void *) JZ_MMC_JZ4780 },
1034 { .compatible = "ingenic,x1000-mmc", .data = (void *) JZ_MMC_X1000 },
1042 struct mmc_host *mmc; in jz4740_mmc_probe() local
1045 mmc = mmc_alloc_host(sizeof(struct jz4740_mmc_host), &pdev->dev); in jz4740_mmc_probe()
1046 if (!mmc) { in jz4740_mmc_probe()
1047 dev_err(&pdev->dev, "Failed to alloc mmc host structure\n"); in jz4740_mmc_probe()
1051 host = mmc_priv(mmc); in jz4740_mmc_probe()
1056 ret = mmc_of_parse(mmc); in jz4740_mmc_probe()
1062 mmc_regulator_get_supply(mmc); in jz4740_mmc_probe()
1070 host->clk = devm_clk_get(&pdev->dev, "mmc"); in jz4740_mmc_probe()
1073 dev_err(&pdev->dev, "Failed to get mmc clock\n"); in jz4740_mmc_probe()
1083 mmc->ops = &jz4740_mmc_ops; in jz4740_mmc_probe()
1084 if (!mmc->f_max) in jz4740_mmc_probe()
1085 mmc->f_max = JZ_MMC_CLK_RATE; in jz4740_mmc_probe()
1093 if (host->version == JZ_MMC_JZ4760 && mmc->f_max > JZ_MMC_CLK_RATE) in jz4740_mmc_probe()
1094 mmc->f_max = JZ_MMC_CLK_RATE; in jz4740_mmc_probe()
1096 mmc->f_min = mmc->f_max / 128; in jz4740_mmc_probe()
1097 mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; in jz4740_mmc_probe()
1103 mmc->max_busy_timeout = JZ_MMC_REQ_TIMEOUT_MS; in jz4740_mmc_probe()
1105 mmc->max_blk_size = (1 << 10) - 1; in jz4740_mmc_probe()
1106 mmc->max_blk_count = (1 << 15) - 1; in jz4740_mmc_probe()
1107 mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count; in jz4740_mmc_probe()
1109 mmc->max_segs = 128; in jz4740_mmc_probe()
1110 mmc->max_seg_size = mmc->max_req_size; in jz4740_mmc_probe()
1112 host->mmc = mmc; in jz4740_mmc_probe()
1135 ret = mmc_add_host(mmc); in jz4740_mmc_probe()
1138 dev_err(&pdev->dev, "Failed to add mmc host: %d\n", ret); in jz4740_mmc_probe()
1141 dev_info(&pdev->dev, "Ingenic SD/MMC card driver registered\n"); in jz4740_mmc_probe()
1145 (mmc->caps & MMC_CAP_8_BIT_DATA) ? 8 : in jz4740_mmc_probe()
1146 ((mmc->caps & MMC_CAP_4_BIT_DATA) ? 4 : 1)); in jz4740_mmc_probe()
1156 mmc_free_host(mmc); in jz4740_mmc_probe()
1169 mmc_remove_host(host->mmc); in jz4740_mmc_remove()
1176 mmc_free_host(host->mmc); in jz4740_mmc_remove()
1196 .name = "jz4740-mmc",
1205 MODULE_DESCRIPTION("JZ4740 SD/MMC controller driver");