Lines Matching +full:hs200 +full:- +full:cmd +full:- +full:int +full:- +full:delay

1 /* SPDX-License-Identifier: GPL-2.0-only */
12 #include <linux/fault-inject.h>
17 #include <linux/dma-direction.h>
18 #include <linux/blk-crypto-profile.h>
21 unsigned int clock; /* clock rate */
23 unsigned int power_delay_ms; /* waiting for stable power */
125 int err);
129 int (*request_atomic)(struct mmc_host *host,
141 * ios->clock might be 0. For some controllers, setting 0Hz
151 * 1 for a read-only card
152 * -ENOSYS when not supported (equal to NULL callback)
155 int (*get_ro)(struct mmc_host *host);
161 * -ENOSYS when not supported (equal to NULL callback)
164 int (*get_cd)(struct mmc_host *host);
166 void (*enable_sdio_irq)(struct mmc_host *host, int enable);
173 int (*start_signal_voltage_switch)(struct mmc_host *host, struct mmc_ios *ios);
176 int (*card_busy)(struct mmc_host *host);
179 int (*execute_tuning)(struct mmc_host *host, u32 opcode);
182 int (*prepare_hs400_tuning)(struct mmc_host *host, struct mmc_ios *ios);
185 int (*execute_hs400_tuning)(struct mmc_host *host, struct mmc_card *card);
188 int (*hs400_prepare_ddr)(struct mmc_host *host);
190 /* Prepare for switching from HS400 to HS200 */
199 int (*select_drive_strength)(struct mmc_card *card,
200 unsigned int max_dtr, int host_drv,
201 int card_drv, int *drv_type);
210 int (*multi_io_quirk)(struct mmc_card *card,
211 unsigned int direction, int blk_size);
214 int (*init_sd_express)(struct mmc_host *host, struct mmc_ios *ios);
219 int (*cqe_enable)(struct mmc_host *host, struct mmc_card *card);
220 /* Free resources, and make the CQE non-operational */
224 * effect of ->cqe_off().
226 int (*cqe_request)(struct mmc_host *host, struct mmc_request *mrq);
230 * Prepare the CQE and host controller to accept non-CQ commands. There
231 * is no corresponding ->cqe_on(), instead ->cqe_request() is required
239 int (*cqe_wait_for_idle)(struct mmc_host *host);
255 * (data->error or cmd->error for DCMD). Requests that did not error
272 * struct mmc_slot - MMC slot functions
274 * @cd_irq: MMC/SD-card slot hotplug detection IRQ or -EINVAL
275 * @handler_priv: MMC/SD-card slot context
277 * Some MMC/SD host controllers implement slot-functions like card and
278 * write-protect detection natively. However, a large number of controllers
280 * such slot-function drivers.
283 int cd_irq;
289 * mmc_context_info - synchronization details for mmc context
317 int index;
320 unsigned int f_min;
321 unsigned int f_max;
322 unsigned int f_init;
324 u32 ocr_avail_sdio; /* SDIO-specific OCR */
325 u32 ocr_avail_sd; /* SD-specific OCR */
326 u32 ocr_avail_mmc; /* MMC-specific OCR */
332 #define MMC_VDD_165_195 0x00000080 /* VDD voltage 1.65 - 1.95 */
353 #define MMC_CAP_MMC_HIGHSPEED (1 << 1) /* Can do MMC high-speed timing */
354 #define MMC_CAP_SD_HIGHSPEED (1 << 2) /* Can do SD high-speed timing */
357 #define MMC_CAP_NEEDS_POLL (1 << 5) /* Needs polling for card-detection */
399 #define MMC_CAP2_CD_ACTIVE_HIGH (1 << 10) /* Card-detect signal active high */
400 #define MMC_CAP2_RO_ACTIVE_HIGH (1 << 11) /* Write-protect signal active high */
409 …_WRITE_PROTECT (1 << 18) /* No physical write protect pin, assume that card is always read-write */
423 #define MMC_CAP2_ALT_GPT_TEGRA (1 << 28) /* Host with eMMC that has GPT entry at a non-standard loc…
425 int fixed_drv_type; /* fixed driver type for non-removable media */
430 unsigned int max_seg_size; /* see blk_queue_max_segment_size */
433 unsigned int max_req_size; /* maximum number of bytes in one req */
434 unsigned int max_blk_size; /* maximum size of one mmc block */
435 unsigned int max_blk_count; /* maximum number of blocks in one req */
436 unsigned int max_busy_timeout; /* max busy timeout in ms */
444 unsigned int use_spi_crc:1;
445 unsigned int claimed:1; /* host exclusively claimed */
446 unsigned int doing_init_tune:1; /* initial tuning in progress */
447 unsigned int can_retune:1; /* re-tuning can be used */
448 unsigned int doing_retune:1; /* re-tuning in progress */
449 unsigned int retune_now:1; /* do re-tuning at next req */
450 unsigned int retune_paused:1; /* re-tuning is temporarily disabled */
451 unsigned int retune_crc_disable:1; /* don't trigger retune upon crc */
452 unsigned int can_dma_map_merge:1; /* merging can be used */
454 int rescan_disable; /* disable card detection */
455 int rescan_entered; /* used with nonremovable devices */
457 int need_retune; /* re-tuning is needed */
458 int hold_retune; /* hold off re-tuning */
459 unsigned int retune_period; /* re-tuning period in secs */
460 struct timer_list retune_timer; /* for periodic re-tuning */
468 int claim_cnt; /* "claim" nesting count */
472 int detect_change; /* card detect flag */
477 unsigned int sdio_irqs;
501 unsigned int actual_clock; /* Actual HC clock rate */
503 unsigned int slotno; /* used for sdio acpi binding */
505 int dsr_req; /* DSR value is valid */
511 int cqe_qdepth;
529 struct mmc_host *mmc_alloc_host(int extra, struct device *);
530 int mmc_add_host(struct mmc_host *);
535 int mmc_of_parse(struct mmc_host *host);
536 int mmc_of_parse_voltage(struct mmc_host *host, u32 *mask);
540 return (void *)host->private; in mmc_priv()
548 #define mmc_host_is_spi(host) ((host)->caps & MMC_CAP_SPI)
550 #define mmc_dev(x) ((x)->parent)
551 #define mmc_classdev(x) (&(x)->class_dev)
552 #define mmc_hostname(x) (dev_name(&(x)->class_dev))
554 void mmc_detect_change(struct mmc_host *, unsigned long delay);
566 return host->sdio_irqs > 0; in sdio_irq_claimed()
571 host->ops->enable_sdio_irq(host, 0); in mmc_signal_sdio_irq()
572 host->sdio_irq_pending = true; in mmc_signal_sdio_irq()
573 if (host->sdio_irq_thread) in mmc_signal_sdio_irq()
574 wake_up_process(host->sdio_irq_thread); in mmc_signal_sdio_irq()
580 int mmc_regulator_set_ocr(struct mmc_host *mmc,
583 int mmc_regulator_set_vqmmc(struct mmc_host *mmc, struct mmc_ios *ios);
585 static inline int mmc_regulator_set_ocr(struct mmc_host *mmc, in mmc_regulator_set_ocr()
592 static inline int mmc_regulator_set_vqmmc(struct mmc_host *mmc, in mmc_regulator_set_vqmmc()
595 return -EINVAL; in mmc_regulator_set_vqmmc()
599 int mmc_regulator_get_supply(struct mmc_host *mmc);
601 static inline int mmc_card_is_removable(struct mmc_host *host) in mmc_card_is_removable()
603 return !(host->caps & MMC_CAP_NONREMOVABLE); in mmc_card_is_removable()
606 static inline int mmc_card_keep_power(struct mmc_host *host) in mmc_card_keep_power()
608 return host->pm_flags & MMC_PM_KEEP_POWER; in mmc_card_keep_power()
611 static inline int mmc_card_wake_sdio_irq(struct mmc_host *host) in mmc_card_wake_sdio_irq()
613 return host->pm_flags & MMC_PM_WAKE_SDIO_IRQ; in mmc_card_wake_sdio_irq()
617 static inline int mmc_card_hs(struct mmc_card *card) in mmc_card_hs()
619 return card->host->ios.timing == MMC_TIMING_SD_HS || in mmc_card_hs()
620 card->host->ios.timing == MMC_TIMING_MMC_HS; in mmc_card_hs()
624 static inline int mmc_card_uhs(struct mmc_card *card) in mmc_card_uhs()
626 return card->host->ios.timing >= MMC_TIMING_UHS_SDR12 && in mmc_card_uhs()
627 card->host->ios.timing <= MMC_TIMING_UHS_DDR50; in mmc_card_uhs()
634 if (host->can_retune) in mmc_retune_needed()
635 host->need_retune = 1; in mmc_retune_needed()
640 return host->can_retune == 1; in mmc_can_retune()
645 return host->doing_retune == 1; in mmc_doing_retune()
650 return host->doing_retune == 1 || host->doing_init_tune == 1; in mmc_doing_tune()
655 return data->flags & MMC_DATA_WRITE ? DMA_TO_DEVICE : DMA_FROM_DEVICE; in mmc_get_dma_dir()
661 host->err_stats[stat] += 1; in mmc_debugfs_err_stats_inc()
664 int mmc_send_tuning(struct mmc_host *host, u32 opcode, int *cmd_error);
665 int mmc_send_abort_tuning(struct mmc_host *host, u32 opcode);
666 int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd);