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>
14 #include <linux/mmc/core.h>
15 #include <linux/mmc/card.h>
16 #include <linux/mmc/pm.h>
17 #include <linux/dma-direction.h>
108 * ios->clock might be 0. For some controllers, setting 0Hz
117 * 0 for a read/write card
118 * 1 for a read-only card
119 * -ENOSYS when not supported (equal to NULL callback)
126 * 0 for a absent card
127 * 1 for a present card
128 * -ENOSYS when not supported (equal to NULL callback)
138 void (*init_card)(struct mmc_host *host, struct mmc_card *card);
142 /* Check if the card is pulling dat[0:3] low */
163 int (*select_drive_strength)(struct mmc_card *card,
166 /* Reset the eMMC card via RST_n */
174 int (*multi_io_quirk)(struct mmc_card *card,
180 int (*cqe_enable)(struct mmc_host *host, struct mmc_card *card);
181 /* Free resources, and make the CQE non-operational */
185 * effect of ->cqe_off().
191 * Prepare the CQE and host controller to accept non-CQ commands. There
192 * is no corresponding ->cqe_on(), instead ->cqe_request() is required
216 * (data->error or cmd->error for DCMD). Requests that did not error
223 /* active mmc request */
226 * Check error status of completed mmc request.
233 * struct mmc_slot - MMC slot functions
235 * @cd_irq: MMC/SD-card slot hotplug detection IRQ or -EINVAL
236 * @handler_priv: MMC/SD-card slot context
238 * Some MMC/SD host controllers implement slot-functions like card and
239 * write-protect detection natively. However, a large number of controllers
241 * such slot-function drivers.
250 * mmc_context_info - synchronization details for mmc context
253 * @is_waiting_last_req mmc context waiting for single running request
267 struct regulator *vmmc; /* Card power supply */
285 u32 ocr_avail_sdio; /* SDIO-specific OCR */
286 u32 ocr_avail_sd; /* SD-specific OCR */
287 u32 ocr_avail_mmc; /* MMC-specific OCR */
296 #define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */
317 #define MMC_CAP_MMC_HIGHSPEED (1 << 1) /* Can do MMC high-speed timing */
318 #define MMC_CAP_SD_HIGHSPEED (1 << 2) /* Can do SD high-speed timing */
321 #define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */
323 #define MMC_CAP_AGGRESSIVE_PM (1 << 7) /* Suspend (e)MMC/SD at idle */
325 #define MMC_CAP_WAIT_WHILE_BUSY (1 << 9) /* Waits while card is busy */
347 #define MMC_CAP_CD_WAKE (1 << 28) /* Enable card detect wake */
350 #define MMC_CAP_HW_RESET (1 << 31) /* Reset the eMMC card via RST_n */
361 #define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */
362 #define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */
371 …_WRITE_PROTECT (1 << 18) /* No physical write protect pin, assume that card is always read-write */
375 #define MMC_CAP2_NO_MMC (1 << 22) /* Do not send (e)MMC commands during initialization */
381 int fixed_drv_type; /* fixed driver type for non-removable media */
390 unsigned int max_blk_size; /* maximum size of one mmc block */
404 unsigned int can_retune:1; /* re-tuning can be used */
405 unsigned int doing_retune:1; /* re-tuning in progress */
406 unsigned int retune_now:1; /* do re-tuning at next req */
407 unsigned int retune_paused:1; /* re-tuning is temporarily disabled */
408 unsigned int use_blk_mq:1; /* use blk-mq */
412 int rescan_disable; /* disable card detection */
415 int need_retune; /* re-tuning is needed */
416 int hold_retune; /* hold off re-tuning */
417 unsigned int retune_period; /* re-tuning period in secs */
418 struct timer_list retune_timer; /* for periodic re-tuning */
422 struct mmc_card *card; /* device attached to this host */ member
430 int detect_change; /* card detect flag */
491 return (void *)host->private; in mmc_priv()
499 #define mmc_host_is_spi(host) ((host)->caps & MMC_CAP_SPI)
501 #define mmc_dev(x) ((x)->parent)
502 #define mmc_classdev(x) (&(x)->class_dev)
503 #define mmc_hostname(x) (dev_name(&(x)->class_dev))
517 return host->sdio_irqs > 0; in sdio_irq_claimed()
522 host->ops->enable_sdio_irq(host, 0); in mmc_signal_sdio_irq()
523 host->sdio_irq_pending = true; in mmc_signal_sdio_irq()
524 if (host->sdio_irq_thread) in mmc_signal_sdio_irq()
525 wake_up_process(host->sdio_irq_thread); in mmc_signal_sdio_irq()
531 int mmc_regulator_set_ocr(struct mmc_host *mmc,
534 int mmc_regulator_set_vqmmc(struct mmc_host *mmc, struct mmc_ios *ios);
536 static inline int mmc_regulator_set_ocr(struct mmc_host *mmc, in mmc_regulator_set_ocr() argument
543 static inline int mmc_regulator_set_vqmmc(struct mmc_host *mmc, in mmc_regulator_set_vqmmc() argument
546 return -EINVAL; in mmc_regulator_set_vqmmc()
550 int mmc_regulator_get_supply(struct mmc_host *mmc);
554 return !(host->caps & MMC_CAP_NONREMOVABLE); in mmc_card_is_removable()
559 return host->pm_flags & MMC_PM_KEEP_POWER; in mmc_card_keep_power()
564 return host->pm_flags & MMC_PM_WAKE_SDIO_IRQ; in mmc_card_wake_sdio_irq()
568 static inline int mmc_card_hs(struct mmc_card *card) in mmc_card_hs() argument
570 return card->host->ios.timing == MMC_TIMING_SD_HS || in mmc_card_hs()
571 card->host->ios.timing == MMC_TIMING_MMC_HS; in mmc_card_hs()
575 static inline int mmc_card_uhs(struct mmc_card *card) in mmc_card_uhs() argument
577 return card->host->ios.timing >= MMC_TIMING_UHS_SDR12 && in mmc_card_uhs()
578 card->host->ios.timing <= MMC_TIMING_UHS_DDR50; in mmc_card_uhs()
585 if (host->can_retune) in mmc_retune_needed()
586 host->need_retune = 1; in mmc_retune_needed()
591 return host->can_retune == 1; in mmc_can_retune()
596 return host->doing_retune == 1; in mmc_doing_retune()
601 return host->doing_retune == 1 || host->doing_init_tune == 1; in mmc_doing_tune()
606 return data->flags & MMC_DATA_WRITE ? DMA_TO_DEVICE : DMA_FROM_DEVICE; in mmc_get_dma_dir()