mmc_spi.h 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. #define MMC_SPI_USE_CD_GPIO (1 << 0)
  8. #define MMC_SPI_USE_RO_GPIO (1 << 1)
  9. #define MMC_SPI_CD_GPIO_ACTIVE_LOW (1 << 2)
  10. #define MMC_SPI_RO_GPIO_ACTIVE_LOW (1 << 3)
  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.)
  13. *
  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 *".
  17. */
  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 *),
  22. void *);
  23. void (*exit)(struct device *, void *);
  24. /*
  25. * Card Detect and Read Only GPIOs. To enable debouncing on the card
  26. * detect GPIO, set the cd_debounce to the debounce time in
  27. * microseconds.
  28. */
  29. unsigned int flags;
  30. unsigned int cd_gpio;
  31. unsigned int cd_debounce;
  32. unsigned int ro_gpio;
  33. /* Capabilities to pass into mmc core (e.g. MMC_CAP_NEEDS_POLL). */
  34. unsigned long caps;
  35. unsigned long caps2;
  36. /* how long to debounce card detect, in msecs */
  37. u16 detect_delay;
  38. /* power management */
  39. u16 powerup_msecs; /* delay of up to 250 msec */
  40. u32 ocr_mask; /* available voltages */
  41. void (*setpower)(struct device *, unsigned int maskval);
  42. };
  43. #ifdef CONFIG_OF
  44. extern struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi);
  45. extern void mmc_spi_put_pdata(struct spi_device *spi);
  46. #else
  47. static inline struct mmc_spi_platform_data *
  48. mmc_spi_get_pdata(struct spi_device *spi)
  49. {
  50. return spi->dev.platform_data;
  51. }
  52. static inline void mmc_spi_put_pdata(struct spi_device *spi) {}
  53. #endif /* CONFIG_OF */
  54. #endif /* __LINUX_SPI_MMC_SPI_H */