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

1 /* SPDX-License-Identifier: GPL-2.0-or-later */
3 * linux/drivers/mmc/host/sdhci.h - Secure Digital Host Controller Interface driver
7 * Copyright (C) 2005-2008 Pierre Ossman, All Rights Reserved.
166 #define SDHCI_INT_ALL_MASK ((unsigned int)-1)
188 #define SDHCI_CTRL_HS400 0x0005 /* Non-standard */
235 #define SDHCI_SUPPORT_HS400 0x80000000 /* Non-standard */
244 /* 4C-4F reserved for more max current */
251 /* 55-57 reserved */
256 /* 60-FB reserved */
264 #define SDHCI_PRESET_FOR_HS400 0x74 /* Non-standard */
294 #define SDHCI_DEFAULT_BOUNDARY_ARG (ilog2(SDHCI_DEFAULT_BOUNDARY_SIZE) - 12)
296 /* ADMA2 32-bit DMA descriptor size */
299 /* ADMA2 32-bit descriptor */
301 __le16 cmd; member
308 #define SDHCI_ADMA2_MASK (SDHCI_ADMA2_ALIGN - 1)
312 * alignment for the descriptor table even in 32-bit DMA mode. Memory
318 * ADMA2 64-bit DMA descriptor size
320 * descriptors for 64-bit addressing mode: 96-bit Descriptor and 128-bit
322 * register, 128-bit Descriptor will be selected.
324 #define SDHCI_ADMA2_64_DESC_SZ(host) ((host)->v4_mode ? 16 : 12)
327 * ADMA2 64-bit descriptor. Note 12-byte descriptor can't always be 8-byte
331 __le16 cmd; member
360 mmc_debugfs_err_stats_inc((host)->mmc, MMC_ERR_##err_name)
372 unsigned int quirks; /* Deviations from spec. */
386 /* Controller can only DMA from 32-bit aligned addresses */
400 /* Controller does not provide transfer-complete interrupt when not busy */
404 /* Controller reports inverted write-protect state */
414 /* Controller cannot do multi-block transfers */
416 /* Controller can only handle 1-bit data transfers */
418 /* Controller needs 10ms delay between applying power and clock */
430 /* Controller doesn't have HISPD bit field in HI-SPEED SD card */
434 /* The read-only detection via SDHCI_PRESENT_STATE register is unstable */
437 unsigned int quirks2; /* More deviations from spec. */
445 /* Controller has a non-standard host control register */
447 /* Controller does not support HS200 */
453 /* Controller does not support 64-bit DMA */
455 /* need clear transfer mode register before send cmd */
457 /* Capability register bit-63 indicates HS400 support */
475 * 32-bit block count may not support eMMC where upper bits of CMD23 are used
476 * for other purposes. Consequently we support 16-bit block count by default.
477 * Otherwise, SDHCI_QUIRK2_USE_32BIT_BLK_CNT can be selected to use 32-bit
482 int irq; /* Device IRQ */
487 unsigned int bounce_buffer_size;
503 int flags; /* Host attributes */
512 #define SDHCI_USE_64_BIT_DMA (1<<12) /* Use 64-bit DMA */
518 unsigned int version; /* SDHCI spec. version */
520 unsigned int max_clk; /* Max possible freq (MHz) */
521 unsigned int timeout_clk; /* Timeout freq (KHz) */
523 unsigned int clk_mul; /* Clock Muliplier value */
525 unsigned int clock; /* Current clock (MHz) */
527 u8 drv_type; /* Current UHS-I driver type */
528 bool reinit_uhs; /* Force UHS-related re-initialization */
533 bool pending_reset; /* Cmd/data reset is pending */
540 struct mmc_command *cmd; /* Current command */ member
544 unsigned int data_early:1; /* Data finished before cmd */
547 unsigned int blocks; /* remaining PIO blocks */
549 int sg_count; /* Mapped sg entries */
550 int max_adma; /* Max. length in ADMA descriptor */
561 unsigned int desc_sz; /* ADMA current descriptor size */
562 unsigned int alloc_desc_sz; /* ADMA descr. max size host supports */
580 unsigned int ocr_avail_sdio; /* OCR bit masks */
581 unsigned int ocr_avail_sd;
582 unsigned int ocr_avail_mmc;
597 unsigned int tuning_done; /* Condition flag set when CMD19 succeeds */
599 unsigned int tuning_count; /* Timer count for re-tuning */
600 unsigned int tuning_mode; /* Re-tuning mode supported by host */
601 unsigned int tuning_err; /* Error code for re-tuning */
605 /* Delay (ms) between tuning commands */
606 int tuning_delay;
607 int tuning_loop_count;
622 u32 (*read_l)(struct sdhci_host *host, int reg);
623 u16 (*read_w)(struct sdhci_host *host, int reg);
624 u8 (*read_b)(struct sdhci_host *host, int reg);
625 void (*write_l)(struct sdhci_host *host, u32 val, int reg);
626 void (*write_w)(struct sdhci_host *host, u16 val, int reg);
627 void (*write_b)(struct sdhci_host *host, u8 val, int reg);
630 void (*set_clock)(struct sdhci_host *host, unsigned int clock);
636 int (*set_dma_mask)(struct sdhci_host *host);
637 int (*enable_dma)(struct sdhci_host *host);
638 unsigned int (*get_max_clock)(struct sdhci_host *host);
639 unsigned int (*get_min_clock)(struct sdhci_host *host);
641 unsigned int (*get_timeout_clock)(struct sdhci_host *host);
642 unsigned int (*get_max_timeout_count)(struct sdhci_host *host);
644 struct mmc_command *cmd);
645 void (*set_bus_width)(struct sdhci_host *host, int width);
648 unsigned int (*get_ro)(struct sdhci_host *host);
650 int (*platform_execute_tuning)(struct sdhci_host *host, u32 opcode);
651 void (*set_uhs_signaling)(struct sdhci_host *host, unsigned int uhs);
657 dma_addr_t addr, int len, unsigned int cmd);
660 unsigned int length);
668 static inline void sdhci_writel(struct sdhci_host *host, u32 val, int reg) in sdhci_writel()
670 if (unlikely(host->ops->write_l)) in sdhci_writel()
671 host->ops->write_l(host, val, reg); in sdhci_writel()
673 writel(val, host->ioaddr + reg); in sdhci_writel()
676 static inline void sdhci_writew(struct sdhci_host *host, u16 val, int reg) in sdhci_writew()
678 if (unlikely(host->ops->write_w)) in sdhci_writew()
679 host->ops->write_w(host, val, reg); in sdhci_writew()
681 writew(val, host->ioaddr + reg); in sdhci_writew()
684 static inline void sdhci_writeb(struct sdhci_host *host, u8 val, int reg) in sdhci_writeb()
686 if (unlikely(host->ops->write_b)) in sdhci_writeb()
687 host->ops->write_b(host, val, reg); in sdhci_writeb()
689 writeb(val, host->ioaddr + reg); in sdhci_writeb()
692 static inline u32 sdhci_readl(struct sdhci_host *host, int reg) in sdhci_readl()
694 if (unlikely(host->ops->read_l)) in sdhci_readl()
695 return host->ops->read_l(host, reg); in sdhci_readl()
697 return readl(host->ioaddr + reg); in sdhci_readl()
700 static inline u16 sdhci_readw(struct sdhci_host *host, int reg) in sdhci_readw()
702 if (unlikely(host->ops->read_w)) in sdhci_readw()
703 return host->ops->read_w(host, reg); in sdhci_readw()
705 return readw(host->ioaddr + reg); in sdhci_readw()
708 static inline u8 sdhci_readb(struct sdhci_host *host, int reg) in sdhci_readb()
710 if (unlikely(host->ops->read_b)) in sdhci_readb()
711 return host->ops->read_b(host, reg); in sdhci_readb()
713 return readb(host->ioaddr + reg); in sdhci_readb()
718 static inline void sdhci_writel(struct sdhci_host *host, u32 val, int reg) in sdhci_writel()
720 writel(val, host->ioaddr + reg); in sdhci_writel()
723 static inline void sdhci_writew(struct sdhci_host *host, u16 val, int reg) in sdhci_writew()
725 writew(val, host->ioaddr + reg); in sdhci_writew()
728 static inline void sdhci_writeb(struct sdhci_host *host, u8 val, int reg) in sdhci_writeb()
730 writeb(val, host->ioaddr + reg); in sdhci_writeb()
733 static inline u32 sdhci_readl(struct sdhci_host *host, int reg) in sdhci_readl()
735 return readl(host->ioaddr + reg); in sdhci_readl()
738 static inline u16 sdhci_readw(struct sdhci_host *host, int reg) in sdhci_readw()
740 return readw(host->ioaddr + reg); in sdhci_readw()
743 static inline u8 sdhci_readb(struct sdhci_host *host, int reg) in sdhci_readb()
745 return readb(host->ioaddr + reg); in sdhci_readb()
755 return host->private; in sdhci_priv()
760 int sdhci_setup_host(struct sdhci_host *host);
762 int __sdhci_add_host(struct sdhci_host *host);
763 int sdhci_add_host(struct sdhci_host *host);
764 void sdhci_remove_host(struct sdhci_host *host, int dead);
771 u16 sdhci_calc_clk(struct sdhci_host *host, unsigned int clock,
772 unsigned int *actual_clock);
773 void sdhci_set_clock(struct sdhci_host *host, unsigned int clock);
782 int sdhci_get_cd_nogpio(struct mmc_host *mmc);
784 int sdhci_request_atomic(struct mmc_host *mmc, struct mmc_request *mrq);
785 void sdhci_set_bus_width(struct sdhci_host *host, int width);
788 int sdhci_execute_tuning(struct mmc_host *mmc, u32 opcode);
790 int sdhci_start_signal_voltage_switch(struct mmc_host *mmc,
792 void sdhci_enable_sdio_irq(struct mmc_host *mmc, int enable);
794 dma_addr_t addr, int len, unsigned int cmd);
797 int sdhci_suspend_host(struct sdhci_host *host);
798 int sdhci_resume_host(struct sdhci_host *host);
799 int sdhci_runtime_suspend_host(struct sdhci_host *host);
800 int sdhci_runtime_resume_host(struct sdhci_host *host, int soft_reset);
805 bool sdhci_cqe_irq(struct sdhci_host *host, u32 intmask, int *cmd_error,
806 int *data_error);
818 void __sdhci_set_timeout(struct sdhci_host *host, struct mmc_command *cmd);