Lines Matching refs:mmc
178 struct mmc_host *mmc; member
238 return mmc_gpio_get_cd(host->mmc); in omap_hsmmc_card_detect()
245 return mmc_gpio_get_cd(host->mmc); in omap_hsmmc_get_cover_state()
248 static int omap_hsmmc_enable_supply(struct mmc_host *mmc) in omap_hsmmc_enable_supply() argument
251 struct omap_hsmmc_host *host = mmc_priv(mmc); in omap_hsmmc_enable_supply()
252 struct mmc_ios *ios = &mmc->ios; in omap_hsmmc_enable_supply()
254 if (mmc->supply.vmmc) { in omap_hsmmc_enable_supply()
255 ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, ios->vdd); in omap_hsmmc_enable_supply()
261 if (mmc->supply.vqmmc && !host->vqmmc_enabled) { in omap_hsmmc_enable_supply()
262 ret = regulator_enable(mmc->supply.vqmmc); in omap_hsmmc_enable_supply()
264 dev_err(mmc_dev(mmc), "vmmc_aux reg enable failed\n"); in omap_hsmmc_enable_supply()
273 if (mmc->supply.vmmc) in omap_hsmmc_enable_supply()
274 mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0); in omap_hsmmc_enable_supply()
279 static int omap_hsmmc_disable_supply(struct mmc_host *mmc) in omap_hsmmc_disable_supply() argument
283 struct omap_hsmmc_host *host = mmc_priv(mmc); in omap_hsmmc_disable_supply()
285 if (mmc->supply.vqmmc && host->vqmmc_enabled) { in omap_hsmmc_disable_supply()
286 ret = regulator_disable(mmc->supply.vqmmc); in omap_hsmmc_disable_supply()
288 dev_err(mmc_dev(mmc), "vmmc_aux reg disable failed\n"); in omap_hsmmc_disable_supply()
294 if (mmc->supply.vmmc) { in omap_hsmmc_disable_supply()
295 ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0); in omap_hsmmc_disable_supply()
303 if (mmc->supply.vqmmc) { in omap_hsmmc_disable_supply()
304 status = regulator_enable(mmc->supply.vqmmc); in omap_hsmmc_disable_supply()
306 dev_err(mmc_dev(mmc), "vmmc_aux re-enable failed\n"); in omap_hsmmc_disable_supply()
358 struct mmc_host *mmc = host->mmc; in omap_hsmmc_set_power() local
368 if (!mmc->supply.vmmc) in omap_hsmmc_set_power()
392 ret = omap_hsmmc_enable_supply(mmc); in omap_hsmmc_set_power()
400 ret = omap_hsmmc_disable_supply(mmc); in omap_hsmmc_set_power()
411 omap_hsmmc_disable_supply(mmc); in omap_hsmmc_set_power()
438 struct mmc_host *mmc = host->mmc; in omap_hsmmc_disable_boot_regulators() local
446 ret = omap_hsmmc_disable_boot_regulator(mmc->supply.vmmc); in omap_hsmmc_disable_boot_regulators()
452 ret = omap_hsmmc_disable_boot_regulator(mmc->supply.vqmmc); in omap_hsmmc_disable_boot_regulators()
473 struct mmc_host *mmc = host->mmc; in omap_hsmmc_reg_get() local
478 mmc->supply.vmmc = devm_regulator_get_optional(host->dev, "vmmc"); in omap_hsmmc_reg_get()
479 if (IS_ERR(mmc->supply.vmmc)) { in omap_hsmmc_reg_get()
480 ret = PTR_ERR(mmc->supply.vmmc); in omap_hsmmc_reg_get()
484 PTR_ERR(mmc->supply.vmmc)); in omap_hsmmc_reg_get()
485 mmc->supply.vmmc = NULL; in omap_hsmmc_reg_get()
487 ocr_value = mmc_regulator_get_ocrmask(mmc->supply.vmmc); in omap_hsmmc_reg_get()
493 mmc->supply.vqmmc = devm_regulator_get_optional(host->dev, "vmmc_aux"); in omap_hsmmc_reg_get()
494 if (IS_ERR(mmc->supply.vqmmc)) { in omap_hsmmc_reg_get()
495 ret = PTR_ERR(mmc->supply.vqmmc); in omap_hsmmc_reg_get()
499 PTR_ERR(mmc->supply.vqmmc)); in omap_hsmmc_reg_get()
500 mmc->supply.vqmmc = NULL; in omap_hsmmc_reg_get()
526 static int omap_hsmmc_gpio_init(struct mmc_host *mmc, in omap_hsmmc_gpio_init() argument
533 ret = mmc_gpio_request_cd(mmc, pdata->gpio_cod, 0); in omap_hsmmc_gpio_init()
538 mmc_gpio_set_cd_isr(mmc, omap_hsmmc_cover_irq); in omap_hsmmc_gpio_init()
540 ret = mmc_gpio_request_cd(mmc, pdata->gpio_cd, 0); in omap_hsmmc_gpio_init()
548 ret = mmc_gpio_request_ro(mmc, pdata->gpio_wp); in omap_hsmmc_gpio_init()
573 dev_dbg(mmc_dev(host->mmc), "MMC Clock is not stopped\n"); in omap_hsmmc_stop_clock()
631 struct mmc_ios *ios = &host->mmc->ios; in omap_hsmmc_set_clock()
636 dev_vdbg(mmc_dev(host->mmc), "Set clock to %uHz\n", ios->clock); in omap_hsmmc_set_clock()
681 struct mmc_ios *ios = &host->mmc->ios; in omap_hsmmc_set_bus_width()
709 struct mmc_ios *ios = &host->mmc->ios; in omap_hsmmc_set_bus_mode()
727 struct mmc_ios *ios = &host->mmc->ios; in omap_hsmmc_context_restore()
751 if (host->mmc->caps & MMC_CAP_SDIO_IRQ) in omap_hsmmc_context_restore()
783 dev_dbg(mmc_dev(host->mmc), "context is restored: restore count %d\n", in omap_hsmmc_context_restore()
858 struct mmc_host *mmc = container_of(dev, struct mmc_host, class_dev); in omap_hsmmc_show_cover_switch() local
859 struct omap_hsmmc_host *host = mmc_priv(mmc); in omap_hsmmc_show_cover_switch()
871 struct mmc_host *mmc = container_of(dev, struct mmc_host, class_dev); in omap_hsmmc_show_slot_name() local
872 struct omap_hsmmc_host *host = mmc_priv(mmc); in omap_hsmmc_show_slot_name()
888 dev_vdbg(mmc_dev(host->mmc), "%s: CMD%d, argument 0x%08x\n", in omap_hsmmc_start_command()
889 mmc_hostname(host->mmc), cmd->opcode, cmd->arg); in omap_hsmmc_start_command()
967 mmc_request_done(host->mmc, mrq); in omap_hsmmc_request_done()
1092 dev_vdbg(mmc_dev(host->mmc), "%s\n", res); in omap_hsmmc_dbg_report_irq()
1133 dev_err(mmc_dev(host->mmc), in omap_hsmmc_reset_controller_fsm()
1161 dev_vdbg(mmc_dev(host->mmc), "IRQ Status is %x\n", status); in omap_hsmmc_do_irq()
1190 dev_dbg(mmc_dev(host->mmc), "AC12 err: 0x%x\n", ac12); in omap_hsmmc_do_irq()
1215 mmc_signal_sdio_irq(host->mmc); in omap_hsmmc_irq()
1296 dev_err(mmc_dev(host->mmc), "Unable to switch operating voltage\n"); in omap_hsmmc_switch_opcond()
1311 mmc_hostname(host->mmc)); in omap_hsmmc_protect_card()
1318 mmc_hostname(host->mmc)); in omap_hsmmc_protect_card()
1331 sysfs_notify(&host->mmc->class_dev.kobj, NULL, "cover_switch"); in omap_hsmmc_cover_irq()
1334 mmc_detect_change(host->mmc, (HZ * 200) / 1000); in omap_hsmmc_cover_irq()
1367 mmc_request_done(host->mmc, mrq); in omap_hsmmc_dma_callback()
1460 dev_err(mmc_dev(host->mmc), "prep_slave_sg() failed\n"); in omap_hsmmc_setup_dma_transfer()
1551 dev_err(mmc_dev(host->mmc), "MMC start dma failure\n"); in omap_hsmmc_prepare_data()
1558 static void omap_hsmmc_post_req(struct mmc_host *mmc, struct mmc_request *mrq, in omap_hsmmc_post_req() argument
1561 struct omap_hsmmc_host *host = mmc_priv(mmc); in omap_hsmmc_post_req()
1573 static void omap_hsmmc_pre_req(struct mmc_host *mmc, struct mmc_request *mrq, in omap_hsmmc_pre_req() argument
1576 struct omap_hsmmc_host *host = mmc_priv(mmc); in omap_hsmmc_pre_req()
1595 static void omap_hsmmc_request(struct mmc_host *mmc, struct mmc_request *req) in omap_hsmmc_request() argument
1597 struct omap_hsmmc_host *host = mmc_priv(mmc); in omap_hsmmc_request()
1618 mmc_request_done(mmc, req); in omap_hsmmc_request()
1633 mmc_request_done(mmc, req); in omap_hsmmc_request()
1648 static void omap_hsmmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) in omap_hsmmc_set_ios() argument
1650 struct omap_hsmmc_host *host = mmc_priv(mmc); in omap_hsmmc_set_ios()
1687 dev_dbg(mmc_dev(host->mmc), in omap_hsmmc_set_ios()
1702 static int omap_hsmmc_get_cd(struct mmc_host *mmc) in omap_hsmmc_get_cd() argument
1704 struct omap_hsmmc_host *host = mmc_priv(mmc); in omap_hsmmc_get_cd()
1711 static void omap_hsmmc_init_card(struct mmc_host *mmc, struct mmc_card *card) in omap_hsmmc_init_card() argument
1713 struct omap_hsmmc_host *host = mmc_priv(mmc); in omap_hsmmc_init_card()
1719 static void omap_hsmmc_enable_sdio_irq(struct mmc_host *mmc, int enable) in omap_hsmmc_enable_sdio_irq() argument
1721 struct omap_hsmmc_host *host = mmc_priv(mmc); in omap_hsmmc_enable_sdio_irq()
1769 dev_err(mmc_dev(host->mmc), "Unable to request wake IRQ\n"); in omap_hsmmc_configure_wake_irq()
1859 struct mmc_host *mmc = s->private; in omap_hsmmc_regs_show() local
1860 struct omap_hsmmc_host *host = mmc_priv(mmc); in omap_hsmmc_regs_show()
1862 seq_printf(s, "mmc%d:\n", mmc->index); in omap_hsmmc_regs_show()
1864 (mmc->caps & MMC_CAP_SDIO_IRQ) ? "interrupt" : "polling"); in omap_hsmmc_regs_show()
1866 if (mmc->caps & MMC_CAP_SDIO_IRQ) { in omap_hsmmc_regs_show()
1908 static void omap_hsmmc_debugfs(struct mmc_host *mmc) in omap_hsmmc_debugfs() argument
1910 if (mmc->debugfs_root) in omap_hsmmc_debugfs()
1911 debugfs_create_file("regs", S_IRUSR, mmc->debugfs_root, in omap_hsmmc_debugfs()
1912 mmc, &mmc_regs_fops); in omap_hsmmc_debugfs()
1917 static void omap_hsmmc_debugfs(struct mmc_host *mmc) in omap_hsmmc_debugfs() argument
2000 struct mmc_host *mmc; in omap_hsmmc_probe() local
2038 mmc = mmc_alloc_host(sizeof(struct omap_hsmmc_host), &pdev->dev); in omap_hsmmc_probe()
2039 if (!mmc) { in omap_hsmmc_probe()
2044 ret = mmc_of_parse(mmc); in omap_hsmmc_probe()
2048 host = mmc_priv(mmc); in omap_hsmmc_probe()
2049 host->mmc = mmc; in omap_hsmmc_probe()
2062 ret = omap_hsmmc_gpio_init(mmc, host, pdata); in omap_hsmmc_probe()
2071 mmc->ops = &omap_hsmmc_ops; in omap_hsmmc_probe()
2073 mmc->f_min = OMAP_MMC_MIN_CLOCK; in omap_hsmmc_probe()
2076 mmc->f_max = pdata->max_freq; in omap_hsmmc_probe()
2077 else if (mmc->f_max == 0) in omap_hsmmc_probe()
2078 mmc->f_max = OMAP_MMC_MAX_CLOCK; in omap_hsmmc_probe()
2109 dev_warn(mmc_dev(host->mmc), "Failed to enable debounce clk\n"); in omap_hsmmc_probe()
2115 mmc->max_segs = 1024; in omap_hsmmc_probe()
2117 mmc->max_blk_size = 512; /* Block Length at max can be 1024 */ in omap_hsmmc_probe()
2118 mmc->max_blk_count = 0xFFFF; /* No. of Blocks is 16 bits */ in omap_hsmmc_probe()
2119 mmc->max_req_size = mmc->max_blk_size * mmc->max_blk_count; in omap_hsmmc_probe()
2120 mmc->max_seg_size = mmc->max_req_size; in omap_hsmmc_probe()
2122 mmc->caps |= MMC_CAP_MMC_HIGHSPEED | MMC_CAP_SD_HIGHSPEED | in omap_hsmmc_probe()
2125 mmc->caps |= mmc_pdata(host)->caps; in omap_hsmmc_probe()
2126 if (mmc->caps & MMC_CAP_8_BIT_DATA) in omap_hsmmc_probe()
2127 mmc->caps |= MMC_CAP_4_BIT_DATA; in omap_hsmmc_probe()
2130 mmc->caps |= MMC_CAP_NONREMOVABLE; in omap_hsmmc_probe()
2132 mmc->pm_caps |= mmc_pdata(host)->pm_caps; in omap_hsmmc_probe()
2139 dev_err(mmc_dev(host->mmc), "cannot get DMA TX channel\n"); in omap_hsmmc_probe()
2147 dev_err(mmc_dev(host->mmc), "cannot get DMA RX channel\n"); in omap_hsmmc_probe()
2162 dev_err(mmc_dev(host->mmc), "unable to obtain RX DMA engine channel %u\n", rx_req); in omap_hsmmc_probe()
2172 dev_err(mmc_dev(host->mmc), "unable to obtain TX DMA engine channel %u\n", tx_req); in omap_hsmmc_probe()
2179 mmc_hostname(mmc), host); in omap_hsmmc_probe()
2181 dev_err(mmc_dev(host->mmc), "Unable to grab HSMMC IRQ\n"); in omap_hsmmc_probe()
2189 mmc->ocr_avail = mmc_pdata(host)->ocr_mask; in omap_hsmmc_probe()
2203 mmc->caps |= MMC_CAP_SDIO_IRQ; in omap_hsmmc_probe()
2207 mmc_add_host(mmc); in omap_hsmmc_probe()
2210 ret = device_create_file(&mmc->class_dev, &dev_attr_slot_name); in omap_hsmmc_probe()
2215 ret = device_create_file(&mmc->class_dev, in omap_hsmmc_probe()
2221 omap_hsmmc_debugfs(mmc); in omap_hsmmc_probe()
2228 mmc_remove_host(mmc); in omap_hsmmc_probe()
2241 mmc_free_host(mmc); in omap_hsmmc_probe()
2251 mmc_remove_host(host->mmc); in omap_hsmmc_remove()
2264 mmc_free_host(host->mmc); in omap_hsmmc_remove()
2279 if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER)) { in omap_hsmmc_suspend()
2307 if (!(host->mmc->pm_flags & MMC_PM_KEEP_POWER)) in omap_hsmmc_resume()
2328 if ((host->mmc->caps & MMC_CAP_SDIO_IRQ) && in omap_hsmmc_runtime_suspend()
2369 if ((host->mmc->caps & MMC_CAP_SDIO_IRQ) && in omap_hsmmc_runtime_resume()