au1100_mmc.h 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. /*
  2. * BRIEF MODULE DESCRIPTION
  3. * Defines for using the MMC/SD controllers on the
  4. * Alchemy Au1100 mips processor.
  5. *
  6. * Copyright (c) 2003 Embedded Edge, LLC.
  7. * Author: Embedded Edge, LLC.
  8. * dan@embeddededge.com or tim@embeddededge.com
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the
  12. * Free Software Foundation; either version 2 of the License, or (at your
  13. * option) any later version.
  14. *
  15. * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
  16. * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  17. * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
  18. * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  19. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  20. * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  21. * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
  22. * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  23. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  24. * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  25. *
  26. * You should have received a copy of the GNU General Public License along
  27. * with this program; if not, write to the Free Software Foundation, Inc.,
  28. * 675 Mass Ave, Cambridge, MA 02139, USA.
  29. *
  30. */
  31. /*
  32. * AU1100 MMC/SD definitions.
  33. *
  34. * From "AMD Alchemy Solutions Au1100 Processor Data Book - Preliminary"
  35. * June, 2003
  36. */
  37. #ifndef __ASM_AU1100_MMC_H
  38. #define __ASM_AU1100_MMC_H
  39. #include <linux/leds.h>
  40. struct au1xmmc_platform_data {
  41. int(*cd_setup)(void *mmc_host, int on);
  42. int(*card_inserted)(void *mmc_host);
  43. int(*card_readonly)(void *mmc_host);
  44. void(*set_power)(void *mmc_host, int state);
  45. struct led_classdev *led;
  46. };
  47. #define SD0_BASE 0xB0600000
  48. #define SD1_BASE 0xB0680000
  49. /*
  50. * Register offsets.
  51. */
  52. #define SD_TXPORT (0x0000)
  53. #define SD_RXPORT (0x0004)
  54. #define SD_CONFIG (0x0008)
  55. #define SD_ENABLE (0x000C)
  56. #define SD_CONFIG2 (0x0010)
  57. #define SD_BLKSIZE (0x0014)
  58. #define SD_STATUS (0x0018)
  59. #define SD_DEBUG (0x001C)
  60. #define SD_CMD (0x0020)
  61. #define SD_CMDARG (0x0024)
  62. #define SD_RESP3 (0x0028)
  63. #define SD_RESP2 (0x002C)
  64. #define SD_RESP1 (0x0030)
  65. #define SD_RESP0 (0x0034)
  66. #define SD_TIMEOUT (0x0038)
  67. /*
  68. * SD_TXPORT bit definitions.
  69. */
  70. #define SD_TXPORT_TXD (0x000000ff)
  71. /*
  72. * SD_RXPORT bit definitions.
  73. */
  74. #define SD_RXPORT_RXD (0x000000ff)
  75. /*
  76. * SD_CONFIG bit definitions.
  77. */
  78. #define SD_CONFIG_DIV (0x000001ff)
  79. #define SD_CONFIG_DE (0x00000200)
  80. #define SD_CONFIG_NE (0x00000400)
  81. #define SD_CONFIG_TU (0x00000800)
  82. #define SD_CONFIG_TO (0x00001000)
  83. #define SD_CONFIG_RU (0x00002000)
  84. #define SD_CONFIG_RO (0x00004000)
  85. #define SD_CONFIG_I (0x00008000)
  86. #define SD_CONFIG_CR (0x00010000)
  87. #define SD_CONFIG_RAT (0x00020000)
  88. #define SD_CONFIG_DD (0x00040000)
  89. #define SD_CONFIG_DT (0x00080000)
  90. #define SD_CONFIG_SC (0x00100000)
  91. #define SD_CONFIG_RC (0x00200000)
  92. #define SD_CONFIG_WC (0x00400000)
  93. #define SD_CONFIG_xxx (0x00800000)
  94. #define SD_CONFIG_TH (0x01000000)
  95. #define SD_CONFIG_TE (0x02000000)
  96. #define SD_CONFIG_TA (0x04000000)
  97. #define SD_CONFIG_RH (0x08000000)
  98. #define SD_CONFIG_RA (0x10000000)
  99. #define SD_CONFIG_RF (0x20000000)
  100. #define SD_CONFIG_CD (0x40000000)
  101. #define SD_CONFIG_SI (0x80000000)
  102. /*
  103. * SD_ENABLE bit definitions.
  104. */
  105. #define SD_ENABLE_CE (0x00000001)
  106. #define SD_ENABLE_R (0x00000002)
  107. /*
  108. * SD_CONFIG2 bit definitions.
  109. */
  110. #define SD_CONFIG2_EN (0x00000001)
  111. #define SD_CONFIG2_FF (0x00000002)
  112. #define SD_CONFIG2_xx1 (0x00000004)
  113. #define SD_CONFIG2_DF (0x00000008)
  114. #define SD_CONFIG2_DC (0x00000010)
  115. #define SD_CONFIG2_xx2 (0x000000e0)
  116. #define SD_CONFIG2_WB (0x00000100)
  117. #define SD_CONFIG2_RW (0x00000200)
  118. /*
  119. * SD_BLKSIZE bit definitions.
  120. */
  121. #define SD_BLKSIZE_BS (0x000007ff)
  122. #define SD_BLKSIZE_BS_SHIFT (0)
  123. #define SD_BLKSIZE_BC (0x01ff0000)
  124. #define SD_BLKSIZE_BC_SHIFT (16)
  125. /*
  126. * SD_STATUS bit definitions.
  127. */
  128. #define SD_STATUS_DCRCW (0x00000007)
  129. #define SD_STATUS_xx1 (0x00000008)
  130. #define SD_STATUS_CB (0x00000010)
  131. #define SD_STATUS_DB (0x00000020)
  132. #define SD_STATUS_CF (0x00000040)
  133. #define SD_STATUS_D3 (0x00000080)
  134. #define SD_STATUS_xx2 (0x00000300)
  135. #define SD_STATUS_NE (0x00000400)
  136. #define SD_STATUS_TU (0x00000800)
  137. #define SD_STATUS_TO (0x00001000)
  138. #define SD_STATUS_RU (0x00002000)
  139. #define SD_STATUS_RO (0x00004000)
  140. #define SD_STATUS_I (0x00008000)
  141. #define SD_STATUS_CR (0x00010000)
  142. #define SD_STATUS_RAT (0x00020000)
  143. #define SD_STATUS_DD (0x00040000)
  144. #define SD_STATUS_DT (0x00080000)
  145. #define SD_STATUS_SC (0x00100000)
  146. #define SD_STATUS_RC (0x00200000)
  147. #define SD_STATUS_WC (0x00400000)
  148. #define SD_STATUS_xx3 (0x00800000)
  149. #define SD_STATUS_TH (0x01000000)
  150. #define SD_STATUS_TE (0x02000000)
  151. #define SD_STATUS_TA (0x04000000)
  152. #define SD_STATUS_RH (0x08000000)
  153. #define SD_STATUS_RA (0x10000000)
  154. #define SD_STATUS_RF (0x20000000)
  155. #define SD_STATUS_CD (0x40000000)
  156. #define SD_STATUS_SI (0x80000000)
  157. /*
  158. * SD_CMD bit definitions.
  159. */
  160. #define SD_CMD_GO (0x00000001)
  161. #define SD_CMD_RY (0x00000002)
  162. #define SD_CMD_xx1 (0x0000000c)
  163. #define SD_CMD_CT_MASK (0x000000f0)
  164. #define SD_CMD_CT_0 (0x00000000)
  165. #define SD_CMD_CT_1 (0x00000010)
  166. #define SD_CMD_CT_2 (0x00000020)
  167. #define SD_CMD_CT_3 (0x00000030)
  168. #define SD_CMD_CT_4 (0x00000040)
  169. #define SD_CMD_CT_5 (0x00000050)
  170. #define SD_CMD_CT_6 (0x00000060)
  171. #define SD_CMD_CT_7 (0x00000070)
  172. #define SD_CMD_CI (0x0000ff00)
  173. #define SD_CMD_CI_SHIFT (8)
  174. #define SD_CMD_RT_MASK (0x00ff0000)
  175. #define SD_CMD_RT_0 (0x00000000)
  176. #define SD_CMD_RT_1 (0x00010000)
  177. #define SD_CMD_RT_2 (0x00020000)
  178. #define SD_CMD_RT_3 (0x00030000)
  179. #define SD_CMD_RT_4 (0x00040000)
  180. #define SD_CMD_RT_5 (0x00050000)
  181. #define SD_CMD_RT_6 (0x00060000)
  182. #define SD_CMD_RT_1B (0x00810000)
  183. #endif /* __ASM_AU1100_MMC_H */