mmc.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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 <mach/board.h>
  16. #define OMAP15XX_NR_MMC 1
  17. #define OMAP16XX_NR_MMC 2
  18. #define OMAP1_MMC_SIZE 0x080
  19. #define OMAP1_MMC1_BASE 0xfffb7800
  20. #define OMAP1_MMC2_BASE 0xfffb7c00 /* omap16xx only */
  21. #define OMAP24XX_NR_MMC 2
  22. #define OMAP34XX_NR_MMC 3
  23. #define OMAP2420_MMC_SIZE OMAP1_MMC_SIZE
  24. #define HSMMC_SIZE 0x200
  25. #define OMAP2_MMC1_BASE 0x4809c000
  26. #define OMAP2_MMC2_BASE 0x480b4000
  27. #define OMAP3_MMC3_BASE 0x480ad000
  28. #define HSMMC3 (1 << 2)
  29. #define HSMMC2 (1 << 1)
  30. #define HSMMC1 (1 << 0)
  31. #define OMAP_MMC_MAX_SLOTS 2
  32. struct omap_mmc_platform_data {
  33. /* number of slots per controller */
  34. unsigned nr_slots:2;
  35. /* set if your board has components or wiring that limits the
  36. * maximum frequency on the MMC bus */
  37. unsigned int max_freq;
  38. /* switch the bus to a new slot */
  39. int (* switch_slot)(struct device *dev, int slot);
  40. /* initialize board-specific MMC functionality, can be NULL if
  41. * not supported */
  42. int (* init)(struct device *dev);
  43. void (* cleanup)(struct device *dev);
  44. void (* shutdown)(struct device *dev);
  45. /* To handle board related suspend/resume functionality for MMC */
  46. int (*suspend)(struct device *dev, int slot);
  47. int (*resume)(struct device *dev, int slot);
  48. u64 dma_mask;
  49. struct omap_mmc_slot_data {
  50. /*
  51. * nomux means "standard" muxing is wrong on this board, and
  52. * that board-specific code handled it before common init logic.
  53. */
  54. unsigned nomux:1;
  55. /* switch pin can be for card detect (default) or card cover */
  56. unsigned cover:1;
  57. /* 4 wire signaling is optional, and is only used for SD/SDIO */
  58. unsigned wire4:1;
  59. /* use the internal clock */
  60. unsigned internal_clock:1;
  61. s16 power_pin;
  62. s16 switch_pin;
  63. int (* set_bus_mode)(struct device *dev, int slot, int bus_mode);
  64. int (* set_power)(struct device *dev, int slot, int power_on, int vdd);
  65. int (* get_ro)(struct device *dev, int slot);
  66. /* return MMC cover switch state, can be NULL if not supported.
  67. *
  68. * possible return values:
  69. * 0 - closed
  70. * 1 - open
  71. */
  72. int (* get_cover_state)(struct device *dev, int slot);
  73. const char *name;
  74. u32 ocr_mask;
  75. /* Card detection IRQs */
  76. int card_detect_irq;
  77. int (* card_detect)(int irq);
  78. unsigned int ban_openended:1;
  79. } slots[OMAP_MMC_MAX_SLOTS];
  80. };
  81. /* called from board-specific card detection service routine */
  82. extern void omap_mmc_notify_cover_event(struct device *dev, int slot, int is_closed);
  83. #if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) || \
  84. defined(CONFIG_MMC_OMAP_HS) || defined(CONFIG_MMC_OMAP_HS_MODULE)
  85. void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
  86. int nr_controllers);
  87. void omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
  88. int nr_controllers);
  89. void hsmmc_init(int controller_mask);
  90. int omap_mmc_add(int id, unsigned long base, unsigned long size,
  91. unsigned int irq, struct omap_mmc_platform_data *data);
  92. #else
  93. static inline void omap1_init_mmc(struct omap_mmc_platform_data **mmc_data,
  94. int nr_controllers)
  95. {
  96. }
  97. static inline void omap2_init_mmc(struct omap_mmc_platform_data **mmc_data,
  98. int nr_controllers)
  99. {
  100. }
  101. static inline void hsmmc_init(int controller_mask)
  102. {
  103. }
  104. static inline int omap_mmc_add(int id, unsigned long base, unsigned long size,
  105. unsigned int irq, struct omap_mmc_platform_data *data)
  106. {
  107. return 0;
  108. }
  109. #endif
  110. #endif