mmc_spi.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. /* sense switch on sd cards */
  25. int (*get_ro)(struct device *);
  26. /*
  27. * If board does not use CD interrupts, driver can optimize polling
  28. * using this function.
  29. */
  30. int (*get_cd)(struct device *);
  31. /*
  32. * Card Detect and Read Only GPIOs. To enable debouncing on the card
  33. * detect GPIO, set the cd_debounce to the debounce time in
  34. * microseconds.
  35. */
  36. unsigned int flags;
  37. unsigned int cd_gpio;
  38. unsigned int cd_debounce;
  39. unsigned int ro_gpio;
  40. /* Capabilities to pass into mmc core (e.g. MMC_CAP_NEEDS_POLL). */
  41. unsigned long caps;
  42. unsigned long caps2;
  43. /* how long to debounce card detect, in msecs */
  44. u16 detect_delay;
  45. /* power management */
  46. u16 powerup_msecs; /* delay of up to 250 msec */
  47. u32 ocr_mask; /* available voltages */
  48. void (*setpower)(struct device *, unsigned int maskval);
  49. };
  50. #ifdef CONFIG_OF
  51. extern struct mmc_spi_platform_data *mmc_spi_get_pdata(struct spi_device *spi);
  52. extern void mmc_spi_put_pdata(struct spi_device *spi);
  53. #else
  54. static inline struct mmc_spi_platform_data *
  55. mmc_spi_get_pdata(struct spi_device *spi)
  56. {
  57. return spi->dev.platform_data;
  58. }
  59. static inline void mmc_spi_put_pdata(struct spi_device *spi) {}
  60. #endif /* CONFIG_OF */
  61. #endif /* __LINUX_SPI_MMC_SPI_H */