1 /* SPDX-License-Identifier: GPL-2.0 */
2 #ifndef __LINUX_SPI_MMC_SPI_H
3 #define __LINUX_SPI_MMC_SPI_H
5 #include <linux/spi/spi.h>
6 #include <linux/interrupt.h>
11 /* Put this in platform_data of a device being used to manage an MMC/SD
12 * card slot. (Modeled after PXA mmc glue; see that for usage examples.)
14 * REVISIT This is not a spi-specific notion. Any card slot should be
15 * able to handle it. If the MMC core doesn't adopt this kind of notion,
16 * switch the "struct device *" parameters over to "struct spi_device *".
18 struct mmc_spi_platform_data {
19 /* driver activation and (optional) card detect irq hookup */
20 int (*init)(struct device *,
21 irqreturn_t (*)(int, void *),
23 void (*exit)(struct device *, void *);
25 /* Capabilities to pass into mmc core (e.g. MMC_CAP_NEEDS_POLL). */
29 /* how long to debounce card detect, in msecs */
32 /* power management */
33 u16 powerup_msecs; /* delay of up to 250 msec */
34 u32 ocr_mask; /* available voltages */
35 void (*setpower)(struct device *, unsigned int maskval);
39 extern struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi);
40 extern void mmc_spi_put_pdata(struct spi_device *spi);
42 static inline struct mmc_spi_platform_data *
43 mmc_spi_get_pdata(struct spi_device *spi)
45 return spi->dev.platform_data;
47 static inline void mmc_spi_put_pdata(struct spi_device *spi) {}
48 #endif /* CONFIG_OF */
50 #endif /* __LINUX_SPI_MMC_SPI_H */