| David Brownell | 15a0580 | 2007-08-08 09:12:54 -0700 | [diff] [blame] | 1 | #ifndef __LINUX_SPI_MMC_SPI_H | 
|  | 2 | #define __LINUX_SPI_MMC_SPI_H | 
|  | 3 |  | 
| Anton Vorontsov | 9c43df5 | 2008-12-30 18:15:28 +0300 | [diff] [blame] | 4 | #include <linux/spi/spi.h> | 
| Anton Vorontsov | 63e1462 | 2008-06-01 11:49:32 +0200 | [diff] [blame] | 5 | #include <linux/interrupt.h> | 
|  | 6 |  | 
| Paul Gortmaker | 313162d | 2012-01-30 11:46:54 -0500 | [diff] [blame] | 7 | struct device; | 
| David Brownell | 15a0580 | 2007-08-08 09:12:54 -0700 | [diff] [blame] | 8 | struct mmc_host; | 
|  | 9 |  | 
|  | 10 | /* Put this in platform_data of a device being used to manage an MMC/SD | 
|  | 11 | * card slot.  (Modeled after PXA mmc glue; see that for usage examples.) | 
|  | 12 | * | 
|  | 13 | * REVISIT This is not a spi-specific notion.  Any card slot should be | 
|  | 14 | * able to handle it.  If the MMC core doesn't adopt this kind of notion, | 
|  | 15 | * switch the "struct device *" parameters over to "struct spi_device *". | 
|  | 16 | */ | 
|  | 17 | struct mmc_spi_platform_data { | 
|  | 18 | /* driver activation and (optional) card detect irq hookup */ | 
|  | 19 | int (*init)(struct device *, | 
|  | 20 | irqreturn_t (*)(int, void *), | 
|  | 21 | void *); | 
|  | 22 | void (*exit)(struct device *, void *); | 
|  | 23 |  | 
|  | 24 | /* sense switch on sd cards */ | 
|  | 25 | int (*get_ro)(struct device *); | 
|  | 26 |  | 
| Anton Vorontsov | 619ef4b | 2008-06-17 18:17:21 +0400 | [diff] [blame] | 27 | /* | 
|  | 28 | * If board does not use CD interrupts, driver can optimize polling | 
|  | 29 | * using this function. | 
|  | 30 | */ | 
|  | 31 | int (*get_cd)(struct device *); | 
|  | 32 |  | 
|  | 33 | /* Capabilities to pass into mmc core (e.g. MMC_CAP_NEEDS_POLL). */ | 
|  | 34 | unsigned long caps; | 
|  | 35 |  | 
| David Brownell | 15a0580 | 2007-08-08 09:12:54 -0700 | [diff] [blame] | 36 | /* how long to debounce card detect, in msecs */ | 
|  | 37 | u16 detect_delay; | 
|  | 38 |  | 
|  | 39 | /* power management */ | 
|  | 40 | u16 powerup_msecs;		/* delay of up to 250 msec */ | 
|  | 41 | u32 ocr_mask;			/* available voltages */ | 
|  | 42 | void (*setpower)(struct device *, unsigned int maskval); | 
|  | 43 | }; | 
|  | 44 |  | 
| Anton Vorontsov | 9c43df5 | 2008-12-30 18:15:28 +0300 | [diff] [blame] | 45 | #ifdef CONFIG_OF | 
|  | 46 | extern struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi); | 
|  | 47 | extern void mmc_spi_put_pdata(struct spi_device *spi); | 
|  | 48 | #else | 
|  | 49 | static inline struct mmc_spi_platform_data * | 
|  | 50 | mmc_spi_get_pdata(struct spi_device *spi) | 
|  | 51 | { | 
|  | 52 | return spi->dev.platform_data; | 
|  | 53 | } | 
|  | 54 | static inline void mmc_spi_put_pdata(struct spi_device *spi) {} | 
|  | 55 | #endif /* CONFIG_OF */ | 
|  | 56 |  | 
| David Brownell | 15a0580 | 2007-08-08 09:12:54 -0700 | [diff] [blame] | 57 | #endif /* __LINUX_SPI_MMC_SPI_H */ |