mmc_spi.h 1.6 KB

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