blob: 0f4eb165f2542fbafcfe6433c0fa0ef8f8396260 [file] [log] [blame]
David Brownell15a05802007-08-08 09:12:54 -07001#ifndef __LINUX_SPI_MMC_SPI_H
2#define __LINUX_SPI_MMC_SPI_H
3
Anton Vorontsov9c43df52008-12-30 18:15:28 +03004#include <linux/device.h>
5#include <linux/spi/spi.h>
Anton Vorontsov63e14622008-06-01 11:49:32 +02006#include <linux/interrupt.h>
7
David Brownell15a05802007-08-08 09:12:54 -07008struct 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 */
17struct 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 Vorontsov619ef4b2008-06-17 18:17:21 +040027 /*
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 Brownell15a05802007-08-08 09:12:54 -070036 /* 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 Vorontsov9c43df52008-12-30 18:15:28 +030045#ifdef CONFIG_OF
46extern struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi);
47extern void mmc_spi_put_pdata(struct spi_device *spi);
48#else
49static inline struct mmc_spi_platform_data *
50mmc_spi_get_pdata(struct spi_device *spi)
51{
52 return spi->dev.platform_data;
53}
54static inline void mmc_spi_put_pdata(struct spi_device *spi) {}
55#endif /* CONFIG_OF */
56
David Brownell15a05802007-08-08 09:12:54 -070057#endif /* __LINUX_SPI_MMC_SPI_H */