mmc: mmc_spi: Support CD/RO GPIOs

Add support for passing CD/RO GPIO numbers directly to the mmc_spi
driver instead of relying solely on board code callbacks to retrieve the
CD/RO signals values. The driver will enable debouncing on the card
detect GPIO if the cd_debounce field is set to a non-zero value.

Signed-off-by: Laurent Pinchart <laurent.pinchart+renesas@ideasonboard.com>
Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Chris Ball <cjb@laptop.org>
This commit is contained in:
Laurent Pinchart 2013-08-08 12:38:32 +02:00 committed by Chris Ball
parent 214fc309d1
commit bf287a90ce
3 changed files with 52 additions and 43 deletions

View file

@ -7,6 +7,11 @@
struct device;
struct mmc_host;
#define MMC_SPI_USE_CD_GPIO (1 << 0)
#define MMC_SPI_USE_RO_GPIO (1 << 1)
#define MMC_SPI_CD_GPIO_ACTIVE_LOW (1 << 2)
#define MMC_SPI_RO_GPIO_ACTIVE_LOW (1 << 3)
/* Put this in platform_data of a device being used to manage an MMC/SD
* card slot. (Modeled after PXA mmc glue; see that for usage examples.)
*
@ -30,8 +35,19 @@ struct mmc_spi_platform_data {
*/
int (*get_cd)(struct device *);
/*
* Card Detect and Read Only GPIOs. To enable debouncing on the card
* detect GPIO, set the cd_debounce to the debounce time in
* microseconds.
*/
unsigned int flags;
unsigned int cd_gpio;
unsigned int cd_debounce;
unsigned int ro_gpio;
/* Capabilities to pass into mmc core (e.g. MMC_CAP_NEEDS_POLL). */
unsigned long caps;
unsigned long caps2;
/* how long to debounce card detect, in msecs */
u16 detect_delay;