Lines Matching +full:mmc +full:- +full:card

1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * linux/include/linux/mmc/host.h
12 #include <linux/fault-inject.h>
15 #include <linux/mmc/core.h>
16 #include <linux/mmc/card.h>
17 #include <linux/mmc/pm.h>
18 #include <linux/dma-direction.h>
19 #include <linux/blk-crypto-profile.h>
142 * ios->clock might be 0. For some controllers, setting 0Hz
151 * 0 for a read/write card
152 * 1 for a read-only card
153 * -ENOSYS when not supported (equal to NULL callback)
160 * 0 for a absent card
161 * 1 for a present card
162 * -ENOSYS when not supported (equal to NULL callback)
172 void (*init_card)(struct mmc_host *host, struct mmc_card *card);
176 /* Check if the card is pulling dat[0] low */
186 int (*execute_hs400_tuning)(struct mmc_host *host, struct mmc_card *card);
188 /* Optional callback to prepare for SD high-speed tuning */
189 int (*prepare_sd_hs_tuning)(struct mmc_host *host, struct mmc_card *card);
191 /* Optional callback to execute SD high-speed tuning */
192 int (*execute_sd_hs_tuning)(struct mmc_host *host, struct mmc_card *card);
206 int (*select_drive_strength)(struct mmc_card *card,
209 /* Reset the eMMC card via RST_n */
217 int (*multi_io_quirk)(struct mmc_card *card,
220 /* Initialize an SD express card, mandatory for MMC_CAP2_SD_EXP. */
226 int (*cqe_enable)(struct mmc_host *host, struct mmc_card *card);
227 /* Free resources, and make the CQE non-operational */
231 * effect of ->cqe_off().
237 * Prepare the CQE and host controller to accept non-CQ commands. There
238 * is no corresponding ->cqe_on(), instead ->cqe_request() is required
262 * (data->error or cmd->error for DCMD). Requests that did not error
269 * struct mmc_slot - MMC slot functions
271 * @cd_irq: MMC/SD-card slot hotplug detection IRQ or -EINVAL
272 * @handler_priv: MMC/SD-card slot context
274 * Some MMC/SD host controllers implement slot-functions like card and
275 * write-protect detection natively. However, a large number of controllers
277 * such slot-function drivers.
289 struct regulator *vmmc; /* Card power supply */
307 u32 ocr_avail_sdio; /* SDIO-specific OCR */
308 u32 ocr_avail_sd; /* SD-specific OCR */
309 u32 ocr_avail_mmc; /* MMC-specific OCR */
315 #define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */
336 #define MMC_CAP_MMC_HIGHSPEED (1 << 1) /* Can do MMC high-speed timing */
337 #define MMC_CAP_SD_HIGHSPEED (1 << 2) /* Can do SD high-speed timing */
340 #define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */
342 #define MMC_CAP_AGGRESSIVE_PM (1 << 7) /* Suspend (e)MMC/SD at idle */
344 #define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */
366 #define MMC_CAP_CD_WAKE (1 << 28) /* Enable card detect wake */
369 #define MMC_CAP_HW_RESET (1 << 31) /* Reset the eMMC card via RST_n */
382 #define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */
383 #define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */
392 …_WRITE_PROTECT (1 << 18) /* No physical write protect pin, assume that card is always read-write */
396 #define MMC_CAP2_NO_MMC (1 << 22) /* Do not send (e)MMC commands during initialization */
406 #define MMC_CAP2_ALT_GPT_TEGRA (1 << 28) /* Host with eMMC that has GPT entry at a non-standard loc…
408 int fixed_drv_type; /* fixed driver type for non-removable media */
413 unsigned int max_seg_size; /* lim->max_segment_size */
414 unsigned short max_segs; /* lim->max_segments */
417 unsigned int max_blk_size; /* maximum size of one mmc block */
430 unsigned int can_retune:1; /* re-tuning can be used */
431 unsigned int doing_retune:1; /* re-tuning in progress */
432 unsigned int retune_now:1; /* do re-tuning at next req */
433 unsigned int retune_paused:1; /* re-tuning is temporarily disabled */
438 int rescan_disable; /* disable card detection */
441 int need_retune; /* re-tuning is needed */
442 int hold_retune; /* hold off re-tuning */
443 unsigned int retune_period; /* re-tuning period in secs */
444 struct timer_list retune_timer; /* for periodic re-tuning */
448 struct mmc_card *card; /* device attached to this host */ member
456 int detect_change; /* card detect flag */
526 return (void *)host->private; in mmc_priv()
534 #define mmc_host_is_spi(host) ((host)->caps & MMC_CAP_SPI)
536 #define mmc_dev(x) ((x)->parent)
537 #define mmc_classdev(x) (&(x)->class_dev)
538 #define mmc_hostname(x) (dev_name(&(x)->class_dev))
552 return host->sdio_irqs > 0; in sdio_irq_claimed()
557 host->ops->enable_sdio_irq(host, 0); in mmc_signal_sdio_irq()
558 host->sdio_irq_pending = true; in mmc_signal_sdio_irq()
559 if (host->sdio_irq_thread) in mmc_signal_sdio_irq()
560 wake_up_process(host->sdio_irq_thread); in mmc_signal_sdio_irq()
566 int mmc_regulator_set_ocr(struct mmc_host *mmc,
569 int mmc_regulator_set_vqmmc(struct mmc_host *mmc, struct mmc_ios *ios);
571 static inline int mmc_regulator_set_ocr(struct mmc_host *mmc, in mmc_regulator_set_ocr() argument
578 static inline int mmc_regulator_set_vqmmc(struct mmc_host *mmc, in mmc_regulator_set_vqmmc() argument
581 return -EINVAL; in mmc_regulator_set_vqmmc()
585 int mmc_regulator_get_supply(struct mmc_host *mmc);
586 int mmc_regulator_enable_vqmmc(struct mmc_host *mmc);
587 void mmc_regulator_disable_vqmmc(struct mmc_host *mmc);
591 return !(host->caps & MMC_CAP_NONREMOVABLE); in mmc_card_is_removable()
596 return host->pm_flags & MMC_PM_KEEP_POWER; in mmc_card_keep_power()
601 return host->pm_flags & MMC_PM_WAKE_SDIO_IRQ; in mmc_card_wake_sdio_irq()
605 static inline int mmc_card_hs(struct mmc_card *card) in mmc_card_hs() argument
607 return card->host->ios.timing == MMC_TIMING_SD_HS || in mmc_card_hs()
608 card->host->ios.timing == MMC_TIMING_MMC_HS; in mmc_card_hs()
612 static inline int mmc_card_uhs(struct mmc_card *card) in mmc_card_uhs() argument
614 return card->host->ios.timing >= MMC_TIMING_UHS_SDR12 && in mmc_card_uhs()
615 card->host->ios.timing <= MMC_TIMING_UHS_DDR50; in mmc_card_uhs()
622 if (host->can_retune) in mmc_retune_needed()
623 host->need_retune = 1; in mmc_retune_needed()
628 return host->can_retune == 1; in mmc_can_retune()
633 return host->doing_retune == 1; in mmc_doing_retune()
638 return host->doing_retune == 1 || host->doing_init_tune == 1; in mmc_doing_tune()
643 return data->flags & MMC_DATA_WRITE ? DMA_TO_DEVICE : DMA_FROM_DEVICE; in mmc_get_dma_dir()
649 host->err_stats[stat] += 1; in mmc_debugfs_err_stats_inc()
652 int mmc_sd_switch(struct mmc_card *card, bool mode, int group,
654 int mmc_send_status(struct mmc_card *card, u32 *status);
657 int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd);