mvsdio.h 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. /*
  2. * Copyright (C) 2008 Marvell Semiconductors, All Rights Reserved.
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License version 2 as
  6. * published by the Free Software Foundation.
  7. */
  8. #ifndef __MVSDIO_H
  9. #define __MVSDIO_H
  10. /*
  11. * Clock rates
  12. */
  13. #define MVSD_CLOCKRATE_MAX 50000000
  14. #define MVSD_BASE_DIV_MAX 0x7ff
  15. /*
  16. * Register offsets
  17. */
  18. #define MVSD_SYS_ADDR_LOW 0x000
  19. #define MVSD_SYS_ADDR_HI 0x004
  20. #define MVSD_BLK_SIZE 0x008
  21. #define MVSD_BLK_COUNT 0x00c
  22. #define MVSD_ARG_LOW 0x010
  23. #define MVSD_ARG_HI 0x014
  24. #define MVSD_XFER_MODE 0x018
  25. #define MVSD_CMD 0x01c
  26. #define MVSD_RSP(i) (0x020 + ((i)<<2))
  27. #define MVSD_RSP0 0x020
  28. #define MVSD_RSP1 0x024
  29. #define MVSD_RSP2 0x028
  30. #define MVSD_RSP3 0x02c
  31. #define MVSD_RSP4 0x030
  32. #define MVSD_RSP5 0x034
  33. #define MVSD_RSP6 0x038
  34. #define MVSD_RSP7 0x03c
  35. #define MVSD_FIFO 0x040
  36. #define MVSD_RSP_CRC7 0x044
  37. #define MVSD_HW_STATE 0x048
  38. #define MVSD_HOST_CTRL 0x050
  39. #define MVSD_BLK_GAP_CTRL 0x054
  40. #define MVSD_CLK_CTRL 0x058
  41. #define MVSD_SW_RESET 0x05c
  42. #define MVSD_NOR_INTR_STATUS 0x060
  43. #define MVSD_ERR_INTR_STATUS 0x064
  44. #define MVSD_NOR_STATUS_EN 0x068
  45. #define MVSD_ERR_STATUS_EN 0x06c
  46. #define MVSD_NOR_INTR_EN 0x070
  47. #define MVSD_ERR_INTR_EN 0x074
  48. #define MVSD_AUTOCMD12_ERR_STATUS 0x078
  49. #define MVSD_CURR_BYTE_LEFT 0x07c
  50. #define MVSD_CURR_BLK_LEFT 0x080
  51. #define MVSD_AUTOCMD12_ARG_LOW 0x084
  52. #define MVSD_AUTOCMD12_ARG_HI 0x088
  53. #define MVSD_AUTOCMD12_CMD 0x08c
  54. #define MVSD_AUTO_RSP(i) (0x090 + ((i)<<2))
  55. #define MVSD_AUTO_RSP0 0x090
  56. #define MVSD_AUTO_RSP1 0x094
  57. #define MVSD_AUTO_RSP2 0x098
  58. #define MVSD_CLK_DIV 0x128
  59. #define MVSD_WINDOW_CTRL(i) (0x108 + ((i) << 3))
  60. #define MVSD_WINDOW_BASE(i) (0x10c + ((i) << 3))
  61. /*
  62. * MVSD_CMD
  63. */
  64. #define MVSD_CMD_RSP_NONE (0 << 0)
  65. #define MVSD_CMD_RSP_136 (1 << 0)
  66. #define MVSD_CMD_RSP_48 (2 << 0)
  67. #define MVSD_CMD_RSP_48BUSY (3 << 0)
  68. #define MVSD_CMD_CHECK_DATACRC16 (1 << 2)
  69. #define MVSD_CMD_CHECK_CMDCRC (1 << 3)
  70. #define MVSD_CMD_INDX_CHECK (1 << 4)
  71. #define MVSD_CMD_DATA_PRESENT (1 << 5)
  72. #define MVSD_UNEXPECTED_RESP (1 << 7)
  73. #define MVSD_CMD_INDEX(x) ((x) << 8)
  74. /*
  75. * MVSD_AUTOCMD12_CMD
  76. */
  77. #define MVSD_AUTOCMD12_BUSY (1 << 0)
  78. #define MVSD_AUTOCMD12_INDX_CHECK (1 << 1)
  79. #define MVSD_AUTOCMD12_INDEX(x) ((x) << 8)
  80. /*
  81. * MVSD_XFER_MODE
  82. */
  83. #define MVSD_XFER_MODE_WR_DATA_START (1 << 0)
  84. #define MVSD_XFER_MODE_HW_WR_DATA_EN (1 << 1)
  85. #define MVSD_XFER_MODE_AUTO_CMD12 (1 << 2)
  86. #define MVSD_XFER_MODE_INT_CHK_EN (1 << 3)
  87. #define MVSD_XFER_MODE_TO_HOST (1 << 4)
  88. #define MVSD_XFER_MODE_STOP_CLK (1 << 5)
  89. #define MVSD_XFER_MODE_PIO (1 << 6)
  90. /*
  91. * MVSD_HOST_CTRL
  92. */
  93. #define MVSD_HOST_CTRL_PUSH_PULL_EN (1 << 0)
  94. #define MVSD_HOST_CTRL_CARD_TYPE_MEM_ONLY (0 << 1)
  95. #define MVSD_HOST_CTRL_CARD_TYPE_IO_ONLY (1 << 1)
  96. #define MVSD_HOST_CTRL_CARD_TYPE_IO_MEM_COMBO (2 << 1)
  97. #define MVSD_HOST_CTRL_CARD_TYPE_IO_MMC (3 << 1)
  98. #define MVSD_HOST_CTRL_CARD_TYPE_MASK (3 << 1)
  99. #define MVSD_HOST_CTRL_BIG_ENDIAN (1 << 3)
  100. #define MVSD_HOST_CTRL_LSB_FIRST (1 << 4)
  101. #define MVSD_HOST_CTRL_DATA_WIDTH_4_BITS (1 << 9)
  102. #define MVSD_HOST_CTRL_HI_SPEED_EN (1 << 10)
  103. #define MVSD_HOST_CTRL_TMOUT_MAX 0xf
  104. #define MVSD_HOST_CTRL_TMOUT_MASK (0xf << 11)
  105. #define MVSD_HOST_CTRL_TMOUT(x) ((x) << 11)
  106. #define MVSD_HOST_CTRL_TMOUT_EN (1 << 15)
  107. /*
  108. * MVSD_SW_RESET
  109. */
  110. #define MVSD_SW_RESET_NOW (1 << 8)
  111. /*
  112. * Normal interrupt status bits
  113. */
  114. #define MVSD_NOR_CMD_DONE (1 << 0)
  115. #define MVSD_NOR_XFER_DONE (1 << 1)
  116. #define MVSD_NOR_BLK_GAP_EVT (1 << 2)
  117. #define MVSD_NOR_DMA_DONE (1 << 3)
  118. #define MVSD_NOR_TX_AVAIL (1 << 4)
  119. #define MVSD_NOR_RX_READY (1 << 5)
  120. #define MVSD_NOR_CARD_INT (1 << 8)
  121. #define MVSD_NOR_READ_WAIT_ON (1 << 9)
  122. #define MVSD_NOR_RX_FIFO_8W (1 << 10)
  123. #define MVSD_NOR_TX_FIFO_8W (1 << 11)
  124. #define MVSD_NOR_SUSPEND_ON (1 << 12)
  125. #define MVSD_NOR_AUTOCMD12_DONE (1 << 13)
  126. #define MVSD_NOR_UNEXP_RSP (1 << 14)
  127. #define MVSD_NOR_ERROR (1 << 15)
  128. /*
  129. * Error status bits
  130. */
  131. #define MVSD_ERR_CMD_TIMEOUT (1 << 0)
  132. #define MVSD_ERR_CMD_CRC (1 << 1)
  133. #define MVSD_ERR_CMD_ENDBIT (1 << 2)
  134. #define MVSD_ERR_CMD_INDEX (1 << 3)
  135. #define MVSD_ERR_DATA_TIMEOUT (1 << 4)
  136. #define MVSD_ERR_DATA_CRC (1 << 5)
  137. #define MVSD_ERR_DATA_ENDBIT (1 << 6)
  138. #define MVSD_ERR_AUTOCMD12 (1 << 8)
  139. #define MVSD_ERR_CMD_STARTBIT (1 << 9)
  140. #define MVSD_ERR_XFER_SIZE (1 << 10)
  141. #define MVSD_ERR_RESP_T_BIT (1 << 11)
  142. #define MVSD_ERR_CRC_ENDBIT (1 << 12)
  143. #define MVSD_ERR_CRC_STARTBIT (1 << 13)
  144. #define MVSD_ERR_CRC_STATUS (1 << 14)
  145. /*
  146. * CMD12 error status bits
  147. */
  148. #define MVSD_AUTOCMD12_ERR_NOTEXE (1 << 0)
  149. #define MVSD_AUTOCMD12_ERR_TIMEOUT (1 << 1)
  150. #define MVSD_AUTOCMD12_ERR_CRC (1 << 2)
  151. #define MVSD_AUTOCMD12_ERR_ENDBIT (1 << 3)
  152. #define MVSD_AUTOCMD12_ERR_INDEX (1 << 4)
  153. #define MVSD_AUTOCMD12_ERR_RESP_T_BIT (1 << 5)
  154. #define MVSD_AUTOCMD12_ERR_RESP_STARTBIT (1 << 6)
  155. #endif