1 #ifndef __LINUX_SPI_MMC_SPI_H
2 #define __LINUX_SPI_MMC_SPI_H
4 #include <linux/device.h>
5 #include <linux/spi/spi.h>
6 #include <linux/interrupt.h>
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.)
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 *".
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 *),
22 void (*exit)(struct device *, void *);
24 /* sense switch on sd cards */
25 int (*get_ro)(struct device *);
28 * If board does not use CD interrupts, driver can optimize polling
29 * using this function.
31 int (*get_cd)(struct device *);
33 /* Capabilities to pass into mmc core (e.g. MMC_CAP_NEEDS_POLL). */
36 /* how long to debounce card detect, in msecs */
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);
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);
49 static inline struct mmc_spi_platform_data *
50 mmc_spi_get_pdata(struct spi_device *spi)
52 return spi->dev.platform_data;
54 static inline void mmc_spi_put_pdata(struct spi_device *spi) {}
55 #endif /* CONFIG_OF */
57 #endif /* __LINUX_SPI_MMC_SPI_H */