diff options
author | ian <ian@FreeBSD.org> | 2017-01-15 22:10:32 +0000 |
---|---|---|
committer | ian <ian@FreeBSD.org> | 2017-01-15 22:10:32 +0000 |
commit | 6868bda4bad5820f9bb79562db7184320af04c30 (patch) | |
tree | 9bd8aa0d04b2148c56d7c4e970977f670be15a02 /sys/dev/sdhci/sdhci.h | |
parent | b1d40028dfe120489903320906bf0587a735fe45 (diff) | |
download | FreeBSD-src-6868bda4bad5820f9bb79562db7184320af04c30.zip FreeBSD-src-6868bda4bad5820f9bb79562db7184320af04c30.tar.gz |
MFC r308187, r311660, r311693, r311727, r311797:
Toggle card insert/remove interrupt enable bits on events.
Add a new sdhci interface method, get_card_present().
Now that the PRESENT_STATE register is only used for the inhibit bits loop
in this function, sdhci_start_command(), eliminate the state variable and
restructure the loop to read the register just once at the top of the loop.
Add support for non-removable media, and a quirk to use polling to detect
card insert/remove events on controllers that don't implement the insert
and remove interrupts.
Add sdhci_handle_card_present_locked() that can be called from the interrupt
handler which already holds the mutex, and have sdhci_handle_card_present()
be just a tiny wrapper that does the locking for external callers.
Diffstat (limited to 'sys/dev/sdhci/sdhci.h')
-rw-r--r-- | sys/dev/sdhci/sdhci.h | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/sys/dev/sdhci/sdhci.h b/sys/dev/sdhci/sdhci.h index 2638b4f..3f2f73a 100644 --- a/sys/dev/sdhci/sdhci.h +++ b/sys/dev/sdhci/sdhci.h @@ -65,6 +65,8 @@ #define SDHCI_QUIRK_DONT_SET_HISPD_BIT (1<<15) /* Alternate clock source is required when supplying a 400 KHz clock. */ #define SDHCI_QUIRK_BCM577XX_400KHZ_CLKSRC (1<<16) +/* Card insert/remove interrupts don't work, polling required. */ +#define SDHCI_QUIRK_POLL_CARD_PRESENT (1<<17) /* * Controller registers @@ -273,8 +275,9 @@ struct sdhci_slot { device_t dev; /* Slot device */ u_char num; /* Slot number */ u_char opt; /* Slot options */ -#define SDHCI_HAVE_DMA 1 -#define SDHCI_PLATFORM_TRANSFER 2 +#define SDHCI_HAVE_DMA 0x01 +#define SDHCI_PLATFORM_TRANSFER 0x02 +#define SDHCI_NON_REMOVABLE 0x04 u_char version; int timeout; /* Transfer timeout */ uint32_t max_clk; /* Max possible freq */ @@ -284,7 +287,9 @@ struct sdhci_slot { u_char *dmamem; bus_addr_t paddr; /* DMA buffer address */ struct task card_task; /* Card presence check task */ - struct callout card_callout; /* Card insert delay callout */ + struct timeout_task + card_delayed_task;/* Card insert delayed task */ + struct callout card_poll_callout;/* Card present polling callout */ struct callout timeout_callout;/* Card command/data response timeout */ struct mmc_host host; /* Host parameters */ struct mmc_request *req; /* Current request */ @@ -322,5 +327,7 @@ int sdhci_generic_acquire_host(device_t brdev, device_t reqdev); int sdhci_generic_release_host(device_t brdev, device_t reqdev); void sdhci_generic_intr(struct sdhci_slot *slot); uint32_t sdhci_generic_min_freq(device_t brdev, struct sdhci_slot *slot); +bool sdhci_generic_get_card_present(device_t brdev, struct sdhci_slot *slot); +void sdhci_handle_card_present(struct sdhci_slot *slot, bool is_present); #endif /* __SDHCI_H__ */ |