Lines Matching full:mmc

3  * Driver for the MMC / SD / SDIO IP found in:
22 * Handle MMC errors better
34 #include <linux/mmc/card.h>
35 #include <linux/mmc/host.h>
36 #include <linux/mmc/mmc.h>
37 #include <linux/mmc/slot-gpio.h>
46 #include <linux/mmc/sdio.h>
138 static void tmio_mmc_enable_sdio_irq(struct mmc_host *mmc, int enable) in tmio_mmc_enable_sdio_irq() argument
140 struct tmio_mmc_host *host = mmc_priv(mmc); in tmio_mmc_enable_sdio_irq()
146 pm_runtime_get_sync(mmc_dev(mmc)); in tmio_mmc_enable_sdio_irq()
163 pm_runtime_mark_last_busy(mmc_dev(mmc)); in tmio_mmc_enable_sdio_irq()
164 pm_runtime_put_autosuspend(mmc_dev(mmc)); in tmio_mmc_enable_sdio_irq()
212 tmio_mmc_set_bus_width(host, host->mmc->ios.bus_width); in tmio_mmc_reset()
226 if (host->mmc->card) in tmio_mmc_reset()
227 mmc_retune_needed(host->mmc); in tmio_mmc_reset()
274 mmc_request_done(host->mmc, mrq); in tmio_mmc_reset_work()
277 /* These are the bitmasks the tmio chip requires to implement the MMC response
633 struct mmc_host *mmc = host->mmc; in __tmio_mmc_card_detect_irq() local
639 if ((((ireg & TMIO_STAT_CARD_REMOVE) && mmc->card) || in __tmio_mmc_card_detect_irq()
640 ((ireg & TMIO_STAT_CARD_INSERT) && !mmc->card)) && in __tmio_mmc_card_detect_irq()
641 !work_pending(&mmc->detect.work)) in __tmio_mmc_card_detect_irq()
642 mmc_detect_change(host->mmc, msecs_to_jiffies(100)); in __tmio_mmc_card_detect_irq()
682 struct mmc_host *mmc = host->mmc; in __tmio_mmc_sdio_irq() local
699 if (mmc->caps & MMC_CAP_SDIO_IRQ && ireg & TMIO_SDIO_STAT_IOIRQ) in __tmio_mmc_sdio_irq()
700 mmc_signal_sdio_irq(mmc); in __tmio_mmc_sdio_irq()
737 if (host->mmc->ios.bus_width == MMC_BUS_WIDTH_4 || in tmio_mmc_start_data()
738 host->mmc->ios.bus_width == MMC_BUS_WIDTH_8) { in tmio_mmc_start_data()
743 mmc_hostname(host->mmc), data->blksz); in tmio_mmc_start_data()
754 if (host->mmc->max_blk_count >= SZ_64K) in tmio_mmc_start_data()
792 mmc_request_done(host->mmc, mrq); in tmio_process_mrq()
795 /* Process requests from the MMC layer */
796 static void tmio_mmc_request(struct mmc_host *mmc, struct mmc_request *mrq) in tmio_mmc_request() argument
798 struct tmio_mmc_host *host = mmc_priv(mmc); in tmio_mmc_request()
808 mmc_request_done(mmc, mrq); in tmio_mmc_request()
855 mmc_retune_needed(host->mmc); in tmio_mmc_finish_request()
866 mmc_request_done(host->mmc, mrq); in tmio_mmc_finish_request()
878 struct mmc_host *mmc = host->mmc; in tmio_mmc_power_on() local
883 if (!IS_ERR(mmc->supply.vmmc)) { in tmio_mmc_power_on()
884 ret = mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, vdd); in tmio_mmc_power_on()
898 ret = mmc_regulator_enable_vqmmc(mmc); in tmio_mmc_power_on()
909 struct mmc_host *mmc = host->mmc; in tmio_mmc_power_off() local
911 mmc_regulator_disable_vqmmc(mmc); in tmio_mmc_power_off()
913 if (!IS_ERR(mmc->supply.vmmc)) in tmio_mmc_power_off()
914 mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0); in tmio_mmc_power_off()
927 unsigned int clk_rate = host->mmc->actual_clock ?: host->mmc->f_max; in tmio_mmc_max_busy_timeout()
929 host->mmc->max_busy_timeout = host->get_timeout_cycles(host) / in tmio_mmc_max_busy_timeout()
933 /* Set MMC clock / power.
935 * run a MMC card at full speed (20MHz). The max clock is 24MHz on SD, but as
936 * MMC wont run that fast, it has to be clocked at 12MHz which is the next
939 static void tmio_mmc_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) in tmio_mmc_set_ios() argument
941 struct tmio_mmc_host *host = mmc_priv(mmc); in tmio_mmc_set_ios()
1011 static int tmio_mmc_get_ro(struct mmc_host *mmc) in tmio_mmc_get_ro() argument
1013 struct tmio_mmc_host *host = mmc_priv(mmc); in tmio_mmc_get_ro()
1019 static int tmio_mmc_get_cd(struct mmc_host *mmc) in tmio_mmc_get_cd() argument
1021 struct tmio_mmc_host *host = mmc_priv(mmc); in tmio_mmc_get_cd()
1050 struct mmc_host *mmc = host->mmc; in tmio_mmc_init_ocr() local
1053 err = mmc_regulator_get_supply(mmc); in tmio_mmc_init_ocr()
1058 if (!mmc->ocr_avail) in tmio_mmc_init_ocr()
1059 mmc->ocr_avail = pdata->ocr_mask; in tmio_mmc_init_ocr()
1065 if (!mmc->ocr_avail) in tmio_mmc_init_ocr()
1072 struct mmc_host *mmc) in tmio_mmc_of_parse() argument
1082 * "toshiba,mmc-wrprotect-disable" in tmio_mmc_of_parse()
1084 if (of_property_read_bool(np, "toshiba,mmc-wrprotect-disable")) in tmio_mmc_of_parse()
1085 mmc->caps2 |= MMC_CAP2_NO_WRITE_PROTECT; in tmio_mmc_of_parse()
1092 struct mmc_host *mmc; in tmio_mmc_host_alloc() local
1100 mmc = mmc_alloc_host(sizeof(struct tmio_mmc_host), &pdev->dev); in tmio_mmc_host_alloc()
1101 if (!mmc) in tmio_mmc_host_alloc()
1104 host = mmc_priv(mmc); in tmio_mmc_host_alloc()
1106 host->mmc = mmc; in tmio_mmc_host_alloc()
1110 mmc->ops = &host->ops; in tmio_mmc_host_alloc()
1112 ret = mmc_of_parse(host->mmc); in tmio_mmc_host_alloc()
1118 tmio_mmc_of_parse(pdev, mmc); in tmio_mmc_host_alloc()
1124 mmc_free_host(mmc); in tmio_mmc_host_alloc()
1132 mmc_free_host(host->mmc); in tmio_mmc_host_free()
1140 struct mmc_host *mmc = _host->mmc; in tmio_mmc_host_probe() local
1144 * Check the sanity of mmc->f_min to prevent host->set_clock() from in tmio_mmc_host_probe()
1147 if (mmc->f_min == 0) in tmio_mmc_host_probe()
1164 ret = mmc_gpiod_request_cd(mmc, "cd", 0, false, 0); in tmio_mmc_host_probe()
1168 mmc->caps |= MMC_CAP_4_BIT_DATA | pdata->capabilities; in tmio_mmc_host_probe()
1169 mmc->caps2 |= pdata->capabilities2; in tmio_mmc_host_probe()
1170 mmc->max_segs = pdata->max_segs ? : 32; in tmio_mmc_host_probe()
1171 mmc->max_blk_size = TMIO_MAX_BLK_SIZE; in tmio_mmc_host_probe()
1172 mmc->max_blk_count = pdata->max_blk_count ? : in tmio_mmc_host_probe()
1173 (PAGE_SIZE / mmc->max_blk_size) * mmc->max_segs; in tmio_mmc_host_probe()
1174 mmc->max_req_size = min_t(size_t, in tmio_mmc_host_probe()
1175 mmc->max_blk_size * mmc->max_blk_count, in tmio_mmc_host_probe()
1177 mmc->max_seg_size = mmc->max_req_size; in tmio_mmc_host_probe()
1179 if (mmc_can_gpio_ro(mmc)) in tmio_mmc_host_probe()
1182 if (mmc_can_gpio_cd(mmc)) in tmio_mmc_host_probe()
1186 _host->native_hotplug = !(mmc_can_gpio_cd(mmc) || in tmio_mmc_host_probe()
1187 mmc->caps & MMC_CAP_NEEDS_POLL || in tmio_mmc_host_probe()
1188 !mmc_card_is_removable(mmc)); in tmio_mmc_host_probe()
1223 ret = mmc_add_host(mmc); in tmio_mmc_host_probe()
1242 struct mmc_host *mmc = host->mmc; in tmio_mmc_host_remove() local
1251 mmc_remove_host(mmc); in tmio_mmc_host_remove()
1313 MODULE_DESCRIPTION("TMIO MMC core driver");