mmc-omap.h 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  1. /*
  2. * MMC definitions for OMAP2
  3. *
  4. * Copyright (C) 2006 Nokia Corporation
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License version 2 as
  8. * published by the Free Software Foundation.
  9. */
  10. #define OMAP_MMC_MAX_SLOTS 2
  11. /*
  12. * struct omap_mmc_dev_attr.flags possibilities
  13. *
  14. * OMAP_HSMMC_SUPPORTS_DUAL_VOLT: Some HSMMC controller instances can
  15. * operate with either 1.8Vdc or 3.0Vdc card voltages; this flag
  16. * should be set if this is the case. See for example Section 22.5.3
  17. * "MMC/SD/SDIO1 Bus Voltage Selection" of the OMAP34xx Multimedia
  18. * Device Silicon Revision 3.1.x Revision ZR (July 2011) (SWPU223R).
  19. *
  20. * OMAP_HSMMC_BROKEN_MULTIBLOCK_READ: Multiple-block read transfers
  21. * don't work correctly on some MMC controller instances on some
  22. * OMAP3 SoCs; this flag should be set if this is the case. See
  23. * for example Advisory 2.1.1.128 "MMC: Multiple Block Read
  24. * Operation Issue" in _OMAP3530/3525/3515/3503 Silicon Errata_
  25. * Revision F (October 2010) (SPRZ278F).
  26. */
  27. #define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(0)
  28. #define OMAP_HSMMC_BROKEN_MULTIBLOCK_READ BIT(1)
  29. struct mmc_card;
  30. struct omap_mmc_dev_attr {
  31. u8 flags;
  32. };
  33. struct omap_mmc_platform_data {
  34. /* back-link to device */
  35. struct device *dev;
  36. /* number of slots per controller */
  37. unsigned nr_slots:2;
  38. /* set if your board has components or wiring that limits the
  39. * maximum frequency on the MMC bus */
  40. unsigned int max_freq;
  41. /* switch the bus to a new slot */
  42. int (*switch_slot)(struct device *dev, int slot);
  43. /* initialize board-specific MMC functionality, can be NULL if
  44. * not supported */
  45. int (*init)(struct device *dev);
  46. void (*cleanup)(struct device *dev);
  47. void (*shutdown)(struct device *dev);
  48. /* To handle board related suspend/resume functionality for MMC */
  49. int (*suspend)(struct device *dev, int slot);
  50. int (*resume)(struct device *dev, int slot);
  51. /* Return context loss count due to PM states changing */
  52. int (*get_context_loss_count)(struct device *dev);
  53. /* Integrating attributes from the omap_hwmod layer */
  54. u8 controller_flags;
  55. /* Register offset deviation */
  56. u16 reg_offset;
  57. struct omap_mmc_slot_data {
  58. /*
  59. * 4/8 wires and any additional host capabilities
  60. * need to OR'd all capabilities (ref. linux/mmc/host.h)
  61. */
  62. u8 wires; /* Used for the MMC driver on omap1 and 2420 */
  63. u32 caps; /* Used for the MMC driver on 2430 and later */
  64. u32 pm_caps; /* PM capabilities of the mmc */
  65. /*
  66. * nomux means "standard" muxing is wrong on this board, and
  67. * that board-specific code handled it before common init logic.
  68. */
  69. unsigned nomux:1;
  70. /* switch pin can be for card detect (default) or card cover */
  71. unsigned cover:1;
  72. /* use the internal clock */
  73. unsigned internal_clock:1;
  74. /* nonremovable e.g. eMMC */
  75. unsigned nonremovable:1;
  76. /* Try to sleep or power off when possible */
  77. unsigned power_saving:1;
  78. /* If using power_saving and the MMC power is not to go off */
  79. unsigned no_off:1;
  80. /* eMMC does not handle power off when not in sleep state */
  81. unsigned no_regulator_off_init:1;
  82. /* Regulator off remapped to sleep */
  83. unsigned vcc_aux_disable_is_sleep:1;
  84. /* we can put the features above into this variable */
  85. #define HSMMC_HAS_PBIAS (1 << 0)
  86. #define HSMMC_HAS_UPDATED_RESET (1 << 1)
  87. #define HSMMC_HAS_HSPE_SUPPORT (1 << 2)
  88. #define MMC_OMAP7XX (1 << 3)
  89. #define MMC_OMAP15XX (1 << 4)
  90. #define MMC_OMAP16XX (1 << 5)
  91. unsigned features;
  92. int switch_pin; /* gpio (card detect) */
  93. int gpio_wp; /* gpio (write protect) */
  94. int (*set_bus_mode)(struct device *dev, int slot, int bus_mode);
  95. int (*set_power)(struct device *dev, int slot,
  96. int power_on, int vdd);
  97. int (*get_ro)(struct device *dev, int slot);
  98. void (*remux)(struct device *dev, int slot, int power_on);
  99. /* Call back before enabling / disabling regulators */
  100. void (*before_set_reg)(struct device *dev, int slot,
  101. int power_on, int vdd);
  102. /* Call back after enabling / disabling regulators */
  103. void (*after_set_reg)(struct device *dev, int slot,
  104. int power_on, int vdd);
  105. /* if we have special card, init it using this callback */
  106. void (*init_card)(struct mmc_card *card);
  107. /* return MMC cover switch state, can be NULL if not supported.
  108. *
  109. * possible return values:
  110. * 0 - closed
  111. * 1 - open
  112. */
  113. int (*get_cover_state)(struct device *dev, int slot);
  114. const char *name;
  115. u32 ocr_mask;
  116. /* Card detection IRQs */
  117. int card_detect_irq;
  118. int (*card_detect)(struct device *dev, int slot);
  119. unsigned int ban_openended:1;
  120. } slots[OMAP_MMC_MAX_SLOTS];
  121. };