Lines Matching full:mmc
3 * linux/drivers/mmc/host/mxcmmc.c - Freescale i.MX MMCI driver
25 #include <linux/mmc/host.h>
26 #include <linux/mmc/card.h>
36 #include <linux/mmc/slot-gpio.h>
40 #include <linux/platform_data/mmc-mxcmmc.h>
44 #define DRIVER_NAME "mxc-mmc"
121 struct mmc_host *mmc; member
162 .name = "imx21-mmc",
165 .name = "imx31-mmc",
178 .compatible = "fsl,imx21-mmc",
181 .compatible = "fsl,imx31-mmc",
238 if (!IS_ERR(host->mmc->supply.vmmc)) { in mxcmci_set_power()
240 mmc_regulator_set_ocr(host->mmc, in mxcmci_set_power()
241 host->mmc->supply.vmmc, vdd); in mxcmci_set_power()
243 mmc_regulator_set_ocr(host->mmc, in mxcmci_set_power()
244 host->mmc->supply.vmmc, 0); in mxcmci_set_power()
248 host->pdata->setpower(mmc_dev(host->mmc), vdd); in mxcmci_set_power()
260 dev_dbg(mmc_dev(host->mmc), "mxcmci_softreset\n"); in mxcmci_softreset()
369 dev_dbg(mmc_dev(host->mmc), "%s: 0x%08x\n", __func__, stat); in mxcmci_dma_callback()
397 dev_err(mmc_dev(host->mmc), "unhandled response type 0x%x\n", in mxcmci_start_cmd()
443 mmc_request_done(host->mmc, req); in mxcmci_finish_request()
458 dev_dbg(mmc_dev(host->mmc), "request failed. status: 0x%08x\n", in mxcmci_finish_data()
461 dev_err(mmc_dev(host->mmc), "%s: -EILSEQ\n", __func__); in mxcmci_finish_data()
466 dev_err(mmc_dev(host->mmc), in mxcmci_finish_data()
470 dev_err(mmc_dev(host->mmc), in mxcmci_finish_data()
475 dev_err(mmc_dev(host->mmc), in mxcmci_finish_data()
479 dev_err(mmc_dev(host->mmc), "%s: -EIO\n", __func__); in mxcmci_finish_data()
503 dev_dbg(mmc_dev(host->mmc), "CMD TIMEOUT\n"); in mxcmci_read_response()
506 dev_dbg(mmc_dev(host->mmc), "cmd crc error\n"); in mxcmci_read_response()
726 dev_dbg(mmc_dev(host->mmc), "%s: 0x%08x\n", __func__, stat); in mxcmci_irq()
737 mmc_signal_sdio_irq(host->mmc); in mxcmci_irq()
750 mmc_detect_change(host->mmc, msecs_to_jiffies(200)); in mxcmci_irq()
755 static void mxcmci_request(struct mmc_host *mmc, struct mmc_request *req) in mxcmci_request() argument
757 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_request()
819 dev_dbg(mmc_dev(host->mmc), "scaler: %d divider: %d in: %d out: %d\n", in mxcmci_set_clk_rate()
823 static int mxcmci_setup_dma(struct mmc_host *mmc) in mxcmci_setup_dma() argument
825 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_setup_dma()
839 static void mxcmci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) in mxcmci_set_ios() argument
841 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_set_ios()
855 ret = mxcmci_setup_dma(mmc); in mxcmci_set_ios()
857 dev_err(mmc_dev(host->mmc), in mxcmci_set_ios()
890 struct mmc_host *mmc = data; in mxcmci_detect_irq() local
892 dev_dbg(mmc_dev(mmc), "%s\n", __func__); in mxcmci_detect_irq()
894 mmc_detect_change(mmc, msecs_to_jiffies(250)); in mxcmci_detect_irq()
898 static int mxcmci_get_ro(struct mmc_host *mmc) in mxcmci_get_ro() argument
900 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_get_ro()
903 return !!host->pdata->get_ro(mmc_dev(mmc)); in mxcmci_get_ro()
906 * context or gpio is invalid), then let the mmc core decide in mxcmci_get_ro()
909 return mmc_gpio_get_ro(mmc); in mxcmci_get_ro()
912 static void mxcmci_enable_sdio_irq(struct mmc_host *mmc, int enable) in mxcmci_enable_sdio_irq() argument
914 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_enable_sdio_irq()
968 dev_err(mmc_dev(host->mmc), in mxcmci_watchdog()
972 dev_err(mmc_dev(host->mmc), in mxcmci_watchdog()
985 mmc_request_done(host->mmc, req); in mxcmci_watchdog()
998 struct mmc_host *mmc; in mxcmci_probe() local
1016 mmc = mmc_alloc_host(sizeof(*host), &pdev->dev); in mxcmci_probe()
1017 if (!mmc) in mxcmci_probe()
1020 host = mmc_priv(mmc); in mxcmci_probe()
1030 ret = mmc_of_parse(mmc); in mxcmci_probe()
1033 mmc->ops = &mxcmci_ops; in mxcmci_probe()
1037 mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ; in mxcmci_probe()
1039 mmc->caps |= MMC_CAP_SDIO_IRQ; in mxcmci_probe()
1041 /* MMC core transfer sizes tunable parameters */ in mxcmci_probe()
1042 mmc->max_blk_size = 2048; in mxcmci_probe()
1043 mmc->max_blk_count = 65535; in mxcmci_probe()
1044 mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count; in mxcmci_probe()
1045 mmc->max_seg_size = mmc->max_req_size; in mxcmci_probe()
1056 mmc->max_segs = 64; in mxcmci_probe()
1058 host->mmc = mmc; in mxcmci_probe()
1064 else if (mmc_card_is_removable(mmc) in mxcmci_probe()
1068 ret = mmc_regulator_get_supply(mmc); in mxcmci_probe()
1072 if (!mmc->ocr_avail) { in mxcmci_probe()
1074 mmc->ocr_avail = pdata->ocr_avail; in mxcmci_probe()
1076 mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; in mxcmci_probe()
1110 dev_err(mmc_dev(host->mmc), "wrong rev.no. 0x%08x. aborting.\n", in mxcmci_probe()
1115 mmc->f_min = clk_get_rate(host->clk_per) >> 16; in mxcmci_probe()
1116 mmc->f_max = clk_get_rate(host->clk_per) >> 1; in mxcmci_probe()
1147 mmc->max_seg_size = dma_get_max_seg_size( in mxcmci_probe()
1150 dev_info(mmc_dev(host->mmc), "dma not available. Using PIO\n"); in mxcmci_probe()
1159 platform_set_drvdata(pdev, mmc); in mxcmci_probe()
1163 host->mmc); in mxcmci_probe()
1170 mmc_add_host(mmc); in mxcmci_probe()
1184 mmc_free_host(mmc); in mxcmci_probe()
1191 struct mmc_host *mmc = platform_get_drvdata(pdev); in mxcmci_remove() local
1192 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_remove()
1194 mmc_remove_host(mmc); in mxcmci_remove()
1197 host->pdata->exit(&pdev->dev, mmc); in mxcmci_remove()
1205 mmc_free_host(mmc); in mxcmci_remove()
1213 struct mmc_host *mmc = dev_get_drvdata(dev); in mxcmci_suspend() local
1214 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_suspend()
1223 struct mmc_host *mmc = dev_get_drvdata(dev); in mxcmci_resume() local
1224 struct mxcmci_host *host = mmc_priv(mmc); in mxcmci_resume()
1258 MODULE_ALIAS("platform:mxc-mmc");