mmc.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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. #ifndef __OMAP2_MMC_H
  11. #define __OMAP2_MMC_H
  12. #include <linux/types.h>
  13. #include <linux/device.h>
  14. #include <linux/mmc/host.h>
  15. #include <plat/board.h>
  16. #include <plat/omap_hwmod.h>
  17. #define OMAP15XX_NR_MMC 1
  18. #define OMAP16XX_NR_MMC 2
  19. #define OMAP1_MMC_SIZE 0x080
  20. #define OMAP1_MMC1_BASE 0xfffb7800
  21. #define OMAP1_MMC2_BASE 0xfffb7c00 /* omap16xx only */
  22. #define OMAP24XX_NR_MMC 2
  23. #define OMAP2420_MMC_SIZE OMAP1_MMC_SIZE
  24. #define OMAP2_MMC1_BASE 0x4809c000
  25. #define OMAP4_MMC_REG_OFFSET 0x100
  26. #define OMAP_MMC_MAX_SLOTS 2
  27. /*
  28. * struct omap_mmc_dev_attr.flags possibilities
  29. *
  30. * OMAP_HSMMC_SUPPORTS_DUAL_VOLT: Some HSMMC controller instances can
  31. * operate with either 1.8Vdc or 3.0Vdc card voltages; this flag
  32. * should be set if this is the case. See for example Section 22.5.3
  33. * "MMC/SD/SDIO1 Bus Voltage Selection" of the OMAP34xx Multimedia
  34. * Device Silicon Revision 3.1.x Revision ZR (July 2011) (SWPU223R).
  35. *
  36. * OMAP_HSMMC_BROKEN_MULTIBLOCK_READ: Multiple-block read transfers
  37. * don't work correctly on some MMC controller instances on some
  38. * OMAP3 SoCs; this flag should be set if this is the case. See
  39. * for example Advisory 2.1.1.128 "MMC: Multiple Block Read
  40. * Operation Issue" in _OMAP3530/3525/3515/3503 Silicon Errata_
  41. * Revision F (October 2010) (SPRZ278F).
  42. */
  43. #define OMAP_HSMMC_SUPPORTS_DUAL_VOLT BIT(0)
  44. #define OMAP_HSMMC_BROKEN_MULTIBLOCK_READ BIT(1)
  45. struct omap_mmc_dev_attr {
  46. u8 flags;
  47. };
  48. struct omap_mmc_platform_data {
  49. /* back-link to device */
  50. struct device *dev;
  51. /* number of slots per controller */
  52. unsigned nr_slots:2;
  53. /* set if your board has components or wiring that limits the
  54. * maximum frequency on the MMC bus */
  55. unsigned int max_freq;
  56. /* switch the bus to a new slot */
  57. int (*switch_slot)(struct device *dev, int slot);
  58. /* initialize board-specific MMC functionality, can be NULL if
  59. * not supported */
  60. int (*init)(struct device *dev);
  61. void (*cleanup)(struct device *dev);
  62. void (*shutdown)(struct device *dev);
  63. /* To handle board related suspend/resume functionality for MMC */
  64. int (*suspend)(struct device *dev, int slot);
  65. int (*resume)(struct device *dev, int slot);
  66. /* Return context loss count due to PM states changing */
  67. int (*get_context_loss_count)(struct device *dev);
  68. /* Integrating attributes from the omap_hwmod layer */
  69. u8 controller_flags;
  70. /* Register offset deviation */
  71. u16 reg_offset;
  72. struct omap_mmc_slot_data {
  73. /*
  74. * 4/8 wires and any additional host capabilities
  75. * need to OR'd all capabilities (ref. linux/mmc/host.h)
  76. */
  77. u8 wires; /* Used for the MMC driver on omap1 and 2420 */
  78. u32 caps; /* Used for the MMC driver on 2430 and later */
  79. u32 pm_caps; /* PM capabilities of the mmc */
  80. /*
  81. * nomux means "standard" muxing is wrong on this board, and
  82. * that board-specific code handled it before common init logic.
  83. */
  84. unsigned nomux:1;
  85. /* switch pin can be for card detect (default) or card cover */
  86. unsigned cover:1;
  87. /* use the internal clock */
  88. unsigned internal_clock:1;
  89. /* nonremovable e.g. eMMC */
  90. unsigned nonremovable:1;
  91. /* Try to sleep or power off when possible */
  92. unsigned power_saving:1;
  93. /* If using power_saving and the MMC power is not to go off */
  94. unsigned no_off:1;
  95. /* eMMC does not handle power off when not in sleep state */
  96. unsigned no_regulator_off_init:1;
  97. /* Regulator off remapped to sleep */
  98. unsigned vcc_aux_disable_is_sleep:1;
  99. /* we can put the features above into this variable */
  100. #define HSMMC_HAS_PBIAS (1 << 0)
  101. #define HSMMC_HAS_UPDATED_RESET (1 << 1)
  102. unsigned features;
  103. int switch_pin; /* gpio (card detect) */
  104. int gpio_wp; /* gpio (write protect) */
  105. int (*set_bus_mode)(struct device *dev, int slot, int bus_mode);
  106. int (*set_power)(struct device *dev, int slot,
  107. int power_on, int vdd);
  108. int (*get_ro)(struct device *dev, int slot);
  109. void (*remux)(struct device *dev, int slot, int power_on);
  110. /* Call back before enabling / disabling regulators */
  111. void (*before_set_reg)(struct device *dev, int slot,
  112. int power_on, int vdd);
  113. /* Call back after enabling / disabling regulators */
  114. void (*after_set_reg)(struct device *dev, int slot,
  115. int power_on, int vdd);
  116. /* if we have special card, init it using this callback */
  117. void (*init_card)(struct mmc_card *card);
  118. /* return MMC cover switch state, can be NULL if not supported.
  119. *
  120. * possible return values:
  121. * 0 - closed
  122. * 1 - open
  123. */
  124. int (*get_cover_state)(struct device *dev, int slot);
  125. const char *name;
  126. u32 ocr_mask;
  127. /* Card detection IRQs */
  128. int card_detect_irq;
  129. int (*card_detect)(struct device *dev, int slot);
  130. unsigned int ban_openended:1;
  131. } slots[OMAP_MMC_MAX_SLOTS];
  132. };
  133. /* called from board-specific card detection service routine */
  134. extern void omap_mmc_notify_cover_event(struct device *dev, int slot,
  135. int is_closed);
  136. #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
  137. void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
  138. int nr_controllers);
  139. void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data);
  140. #else
  141. static inline void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
  142. int nr_controllers)
  143. {
  144. }
  145. static inline void omap242x_init_mmc(struct omap_mmc_platform_data **mmc_data)
  146. {
  147. }
  148. #endif
  149. extern int omap_msdi_reset(struct omap_hwmod *oh);
  150. #endif