• Home
  • Raw
  • Download

Lines Matching full:mmc

3  * davinci_mmc.c - TI DaVinci MMC/SD/SDIO driver
16 #include <linux/mmc/host.h>
22 #include <linux/mmc/mmc.h>
25 #include <linux/mmc/slot-gpio.h>
28 #include <linux/platform_data/mmc-davinci.h>
171 struct mmc_host *mmc; member
203 /* Version of the MMC/SD controller */
274 dev_dbg(mmc_dev(host->mmc), "CMD%d, arg 0x%08x%s\n", in mmc_davinci_start_command()
315 dev_dbg(mmc_dev(host->mmc), "unknown resp_type %04x\n", in mmc_davinci_start_command()
424 dev_dbg(mmc_dev(host->mmc), in mmc_davinci_send_dma_request()
446 dev_dbg(mmc_dev(host->mmc), in mmc_davinci_send_dma_request()
467 host->sg_len = dma_map_sg(mmc_dev(host->mmc), data->sg, data->sg_len, in mmc_davinci_start_dma_transfer()
473 dma_unmap_sg(mmc_dev(host->mmc), in mmc_davinci_start_dma_transfer()
497 host->dma_tx = dma_request_chan(mmc_dev(host->mmc), "tx"); in davinci_acquire_dma_channels()
499 dev_err(mmc_dev(host->mmc), "Can't get dma_tx channel\n"); in davinci_acquire_dma_channels()
503 host->dma_rx = dma_request_chan(mmc_dev(host->mmc), "rx"); in davinci_acquire_dma_channels()
505 dev_err(mmc_dev(host->mmc), "Can't get dma_rx channel\n"); in davinci_acquire_dma_channels()
533 dev_dbg(mmc_dev(host->mmc), "%s, %d blocks of %d bytes\n", in mmc_davinci_prepare_data()
536 dev_dbg(mmc_dev(host->mmc), " DTO %d cycles + %d ns\n", in mmc_davinci_prepare_data()
585 static void mmc_davinci_request(struct mmc_host *mmc, struct mmc_request *req) in mmc_davinci_request() argument
587 struct mmc_davinci_host *host = mmc_priv(mmc); in mmc_davinci_request()
601 dev_err(mmc_dev(host->mmc), "still BUSY? bad ... \n"); in mmc_davinci_request()
603 mmc_request_done(mmc, req); in mmc_davinci_request()
640 static void calculate_clk_divider(struct mmc_host *mmc, struct mmc_ios *ios) in calculate_clk_divider() argument
644 struct mmc_davinci_host *host = mmc_priv(mmc); in calculate_clk_divider()
686 static void mmc_davinci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) in mmc_davinci_set_ios() argument
688 struct mmc_davinci_host *host = mmc_priv(mmc); in mmc_davinci_set_ios()
689 struct platform_device *pdev = to_platform_device(mmc->parent); in mmc_davinci_set_ios()
692 dev_dbg(mmc_dev(host->mmc), in mmc_davinci_set_ios()
710 dev_dbg(mmc_dev(host->mmc), "Enabling 8 bit mode\n"); in mmc_davinci_set_ios()
716 dev_dbg(mmc_dev(host->mmc), "Enabling 4 bit mode\n"); in mmc_davinci_set_ios()
727 dev_dbg(mmc_dev(host->mmc), "Enabling 1 bit mode\n"); in mmc_davinci_set_ios()
739 calculate_clk_divider(mmc, ios); in mmc_davinci_set_ios()
759 dev_warn(mmc_dev(host->mmc), "powerup timeout\n"); in mmc_davinci_set_ios()
770 if (host->mmc->caps & MMC_CAP_SDIO_IRQ) { in mmc_davinci_xfer_done()
779 mmc_signal_sdio_irq(host->mmc); in mmc_davinci_xfer_done()
786 dma_unmap_sg(mmc_dev(host->mmc), data->sg, data->sg_len, in mmc_davinci_xfer_done()
793 mmc_request_done(host->mmc, data->mrq); in mmc_davinci_xfer_done()
821 mmc_request_done(host->mmc, cmd->mrq); in mmc_davinci_cmd_done()
856 dev_dbg(mmc_dev(host->mmc), in mmc_davinci_sdio_irq()
859 mmc_signal_sdio_irq(host->mmc); in mmc_davinci_sdio_irq()
874 dev_dbg(mmc_dev(host->mmc), in mmc_davinci_irq()
932 dev_err(mmc_dev(host->mmc), in mmc_davinci_irq()
942 dev_dbg(mmc_dev(host->mmc), in mmc_davinci_irq()
966 dev_dbg(mmc_dev(host->mmc), "data %s %s error\n", in mmc_davinci_irq()
976 dev_dbg(mmc_dev(host->mmc), in mmc_davinci_irq()
990 dev_dbg(mmc_dev(host->mmc), "Command CRC error\n"); in mmc_davinci_irq()
1009 static int mmc_davinci_get_cd(struct mmc_host *mmc) in mmc_davinci_get_cd() argument
1011 struct platform_device *pdev = to_platform_device(mmc->parent); in mmc_davinci_get_cd()
1017 return mmc_gpio_get_cd(mmc); in mmc_davinci_get_cd()
1020 static int mmc_davinci_get_ro(struct mmc_host *mmc) in mmc_davinci_get_ro() argument
1022 struct platform_device *pdev = to_platform_device(mmc->parent); in mmc_davinci_get_ro()
1028 return mmc_gpio_get_ro(mmc); in mmc_davinci_get_ro()
1031 static void mmc_davinci_enable_sdio_irq(struct mmc_host *mmc, int enable) in mmc_davinci_enable_sdio_irq() argument
1033 struct mmc_davinci_host *host = mmc_priv(mmc); in mmc_davinci_enable_sdio_irq()
1038 mmc_signal_sdio_irq(host->mmc); in mmc_davinci_enable_sdio_irq()
1067 struct mmc_host *mmc; in mmc_davinci_cpufreq_transition() local
1071 mmc = host->mmc; in mmc_davinci_cpufreq_transition()
1075 spin_lock_irqsave(&mmc->lock, flags); in mmc_davinci_cpufreq_transition()
1077 calculate_clk_divider(mmc, &mmc->ios); in mmc_davinci_cpufreq_transition()
1078 spin_unlock_irqrestore(&mmc->lock, flags); in mmc_davinci_cpufreq_transition()
1123 .name = "dm6441-mmc",
1126 .name = "da830-mmc",
1135 .compatible = "ti,dm6441-mmc",
1139 .compatible = "ti,da830-mmc",
1146 static int mmc_davinci_parse_pdata(struct mmc_host *mmc) in mmc_davinci_parse_pdata() argument
1148 struct platform_device *pdev = to_platform_device(mmc->parent); in mmc_davinci_parse_pdata()
1156 host = mmc_priv(mmc); in mmc_davinci_parse_pdata()
1164 mmc->caps |= MMC_CAP_4_BIT_DATA; in mmc_davinci_parse_pdata()
1167 mmc->caps |= (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA); in mmc_davinci_parse_pdata()
1169 mmc->f_min = 312500; in mmc_davinci_parse_pdata()
1170 mmc->f_max = 25000000; in mmc_davinci_parse_pdata()
1172 mmc->f_max = pdata->max_freq; in mmc_davinci_parse_pdata()
1174 mmc->caps |= pdata->caps; in mmc_davinci_parse_pdata()
1177 ret = mmc_gpiod_request_cd(mmc, "cd", 0, false, 0); in mmc_davinci_parse_pdata()
1181 mmc->caps |= MMC_CAP_NEEDS_POLL; in mmc_davinci_parse_pdata()
1183 ret = mmc_gpiod_request_ro(mmc, "wp", 0, 0); in mmc_davinci_parse_pdata()
1194 struct mmc_host *mmc = NULL; in davinci_mmcsd_probe() local
1213 mmc = mmc_alloc_host(sizeof(struct mmc_davinci_host), &pdev->dev); in davinci_mmcsd_probe()
1214 if (!mmc) in davinci_mmcsd_probe()
1217 host = mmc_priv(mmc); in davinci_mmcsd_probe()
1218 host->mmc = mmc; /* Important */ in davinci_mmcsd_probe()
1241 ret = mmc_of_parse(mmc); in davinci_mmcsd_probe()
1248 ret = mmc_davinci_parse_pdata(mmc); in davinci_mmcsd_probe()
1272 mmc->caps |= MMC_CAP_WAIT_WHILE_BUSY; in davinci_mmcsd_probe()
1278 mmc->ops = &mmc_davinci_ops; in davinci_mmcsd_probe()
1279 mmc->ocr_avail = MMC_VDD_32_33 | MMC_VDD_33_34; in davinci_mmcsd_probe()
1285 mmc->max_segs = MAX_NR_SG; in davinci_mmcsd_probe()
1288 mmc->max_seg_size = MAX_CCNT * rw_threshold; in davinci_mmcsd_probe()
1290 /* MMC/SD controller limits for multiblock requests */ in davinci_mmcsd_probe()
1291 mmc->max_blk_size = 4095; /* BLEN is 12 bits */ in davinci_mmcsd_probe()
1292 mmc->max_blk_count = 65535; /* NBLK is 16 bits */ in davinci_mmcsd_probe()
1293 mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count; in davinci_mmcsd_probe()
1295 dev_dbg(mmc_dev(host->mmc), "max_segs=%d\n", mmc->max_segs); in davinci_mmcsd_probe()
1296 dev_dbg(mmc_dev(host->mmc), "max_blk_size=%d\n", mmc->max_blk_size); in davinci_mmcsd_probe()
1297 dev_dbg(mmc_dev(host->mmc), "max_req_size=%d\n", mmc->max_req_size); in davinci_mmcsd_probe()
1298 dev_dbg(mmc_dev(host->mmc), "max_seg_size=%d\n", mmc->max_seg_size); in davinci_mmcsd_probe()
1308 ret = mmc_add_host(mmc); in davinci_mmcsd_probe()
1313 mmc_hostname(mmc), host); in davinci_mmcsd_probe()
1320 mmc_hostname(mmc), host); in davinci_mmcsd_probe()
1322 mmc->caps |= MMC_CAP_SDIO_IRQ; in davinci_mmcsd_probe()
1325 rename_region(mem, mmc_hostname(mmc)); in davinci_mmcsd_probe()
1327 dev_info(mmc_dev(host->mmc), "Using %s, %d-bit mode\n", in davinci_mmcsd_probe()
1329 (mmc->caps & MMC_CAP_4_BIT_DATA) ? 4 : 1); in davinci_mmcsd_probe()
1334 mmc_remove_host(mmc); in davinci_mmcsd_probe()
1345 mmc_free_host(mmc); in davinci_mmcsd_probe()
1354 mmc_remove_host(host->mmc); in davinci_mmcsd_remove()
1358 mmc_free_host(host->mmc); in davinci_mmcsd_remove()
1411 MODULE_DESCRIPTION("MMC/SD driver for Davinci MMC controller");