sdh.h 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. /*
  2. * SDH Masks
  3. */
  4. #ifndef __BFIN_PERIPHERAL_SDH__
  5. #define __BFIN_PERIPHERAL_SDH__
  6. /* Bit masks for SDH_COMMAND */
  7. #define CMD_IDX 0x3f /* Command Index */
  8. #define CMD_RSP 0x40 /* Response */
  9. #define CMD_L_RSP 0x80 /* Long Response */
  10. #define CMD_INT_E 0x100 /* Command Interrupt */
  11. #define CMD_PEND_E 0x200 /* Command Pending */
  12. #define CMD_E 0x400 /* Command Enable */
  13. #ifdef RSI_BLKSZ
  14. #define CMD_CRC_CHECK_D 0x800 /* CRC Check is disabled */
  15. #define CMD_DATA0_BUSY 0x1000 /* Check Busy State on DATA0 */
  16. #endif
  17. /* Bit masks for SDH_PWR_CTL */
  18. #ifndef RSI_BLKSZ
  19. #define PWR_ON 0x3 /* Power On */
  20. #define SD_CMD_OD 0x40 /* Open Drain Output */
  21. #define ROD_CTL 0x80 /* Rod Control */
  22. #endif
  23. /* Bit masks for SDH_CLK_CTL */
  24. #define CLKDIV 0xff /* MC_CLK Divisor */
  25. #define CLK_E 0x100 /* MC_CLK Bus Clock Enable */
  26. #define PWR_SV_E 0x200 /* Power Save Enable */
  27. #define CLKDIV_BYPASS 0x400 /* Bypass Divisor */
  28. #define BUS_MODE_MASK 0x1800 /* Bus Mode Mask */
  29. #define STD_BUS_1 0x000 /* Standard Bus 1 bit mode */
  30. #define WIDE_BUS_4 0x800 /* Wide Bus 4 bit mode */
  31. #define BYTE_BUS_8 0x1000 /* Byte Bus 8 bit mode */
  32. #ifdef RSI_BLKSZ
  33. #define CARD_TYPE_MASK 0xe000 /* Card type mask */
  34. #define CARD_TYPE_OFFSET 13 /* Card type offset */
  35. #define CARD_TYPE_SDIO 0
  36. #define CARD_TYPE_eMMC 1
  37. #define CARD_TYPE_SD 2
  38. #define CARD_TYPE_CEATA 3
  39. #endif
  40. /* Bit masks for SDH_RESP_CMD */
  41. #define RESP_CMD 0x3f /* Response Command */
  42. /* Bit masks for SDH_DATA_CTL */
  43. #define DTX_E 0x1 /* Data Transfer Enable */
  44. #define DTX_DIR 0x2 /* Data Transfer Direction */
  45. #define DTX_MODE 0x4 /* Data Transfer Mode */
  46. #define DTX_DMA_E 0x8 /* Data Transfer DMA Enable */
  47. #ifndef RSI_BLKSZ
  48. #define DTX_BLK_LGTH 0xf0 /* Data Transfer Block Length */
  49. #else
  50. /* Bit masks for SDH_BLK_SIZE */
  51. #define DTX_BLK_LGTH 0x1fff /* Data Transfer Block Length */
  52. #endif
  53. /* Bit masks for SDH_STATUS */
  54. #define CMD_CRC_FAIL 0x1 /* CMD CRC Fail */
  55. #define DAT_CRC_FAIL 0x2 /* Data CRC Fail */
  56. #define CMD_TIME_OUT 0x4 /* CMD Time Out */
  57. #define DAT_TIME_OUT 0x8 /* Data Time Out */
  58. #define TX_UNDERRUN 0x10 /* Transmit Underrun */
  59. #define RX_OVERRUN 0x20 /* Receive Overrun */
  60. #define CMD_RESP_END 0x40 /* CMD Response End */
  61. #define CMD_SENT 0x80 /* CMD Sent */
  62. #define DAT_END 0x100 /* Data End */
  63. #define START_BIT_ERR 0x200 /* Start Bit Error */
  64. #define DAT_BLK_END 0x400 /* Data Block End */
  65. #define CMD_ACT 0x800 /* CMD Active */
  66. #define TX_ACT 0x1000 /* Transmit Active */
  67. #define RX_ACT 0x2000 /* Receive Active */
  68. #define TX_FIFO_STAT 0x4000 /* Transmit FIFO Status */
  69. #define RX_FIFO_STAT 0x8000 /* Receive FIFO Status */
  70. #define TX_FIFO_FULL 0x10000 /* Transmit FIFO Full */
  71. #define RX_FIFO_FULL 0x20000 /* Receive FIFO Full */
  72. #define TX_FIFO_ZERO 0x40000 /* Transmit FIFO Empty */
  73. #define RX_DAT_ZERO 0x80000 /* Receive FIFO Empty */
  74. #define TX_DAT_RDY 0x100000 /* Transmit Data Available */
  75. #define RX_FIFO_RDY 0x200000 /* Receive Data Available */
  76. /* Bit masks for SDH_STATUS_CLR */
  77. #define CMD_CRC_FAIL_STAT 0x1 /* CMD CRC Fail Status */
  78. #define DAT_CRC_FAIL_STAT 0x2 /* Data CRC Fail Status */
  79. #define CMD_TIMEOUT_STAT 0x4 /* CMD Time Out Status */
  80. #define DAT_TIMEOUT_STAT 0x8 /* Data Time Out status */
  81. #define TX_UNDERRUN_STAT 0x10 /* Transmit Underrun Status */
  82. #define RX_OVERRUN_STAT 0x20 /* Receive Overrun Status */
  83. #define CMD_RESP_END_STAT 0x40 /* CMD Response End Status */
  84. #define CMD_SENT_STAT 0x80 /* CMD Sent Status */
  85. #define DAT_END_STAT 0x100 /* Data End Status */
  86. #define START_BIT_ERR_STAT 0x200 /* Start Bit Error Status */
  87. #define DAT_BLK_END_STAT 0x400 /* Data Block End Status */
  88. /* Bit masks for SDH_MASK0 */
  89. #define CMD_CRC_FAIL_MASK 0x1 /* CMD CRC Fail Mask */
  90. #define DAT_CRC_FAIL_MASK 0x2 /* Data CRC Fail Mask */
  91. #define CMD_TIMEOUT_MASK 0x4 /* CMD Time Out Mask */
  92. #define DAT_TIMEOUT_MASK 0x8 /* Data Time Out Mask */
  93. #define TX_UNDERRUN_MASK 0x10 /* Transmit Underrun Mask */
  94. #define RX_OVERRUN_MASK 0x20 /* Receive Overrun Mask */
  95. #define CMD_RESP_END_MASK 0x40 /* CMD Response End Mask */
  96. #define CMD_SENT_MASK 0x80 /* CMD Sent Mask */
  97. #define DAT_END_MASK 0x100 /* Data End Mask */
  98. #define START_BIT_ERR_MASK 0x200 /* Start Bit Error Mask */
  99. #define DAT_BLK_END_MASK 0x400 /* Data Block End Mask */
  100. #define CMD_ACT_MASK 0x800 /* CMD Active Mask */
  101. #define TX_ACT_MASK 0x1000 /* Transmit Active Mask */
  102. #define RX_ACT_MASK 0x2000 /* Receive Active Mask */
  103. #define TX_FIFO_STAT_MASK 0x4000 /* Transmit FIFO Status Mask */
  104. #define RX_FIFO_STAT_MASK 0x8000 /* Receive FIFO Status Mask */
  105. #define TX_FIFO_FULL_MASK 0x10000 /* Transmit FIFO Full Mask */
  106. #define RX_FIFO_FULL_MASK 0x20000 /* Receive FIFO Full Mask */
  107. #define TX_FIFO_ZERO_MASK 0x40000 /* Transmit FIFO Empty Mask */
  108. #define RX_DAT_ZERO_MASK 0x80000 /* Receive FIFO Empty Mask */
  109. #define TX_DAT_RDY_MASK 0x100000 /* Transmit Data Available Mask */
  110. #define RX_FIFO_RDY_MASK 0x200000 /* Receive Data Available Mask */
  111. /* Bit masks for SDH_FIFO_CNT */
  112. #define FIFO_COUNT 0x7fff /* FIFO Count */
  113. /* Bit masks for SDH_E_STATUS */
  114. #define SDIO_INT_DET 0x2 /* SDIO Int Detected */
  115. #define SD_CARD_DET 0x10 /* SD Card Detect */
  116. #define SD_CARD_BUSYMODE 0x80000000 /* Card is in Busy mode */
  117. #define SD_CARD_SLPMODE 0x40000000 /* Card in Sleep Mode */
  118. #define SD_CARD_READY 0x00020000 /* Card Ready */
  119. /* Bit masks for SDH_E_MASK */
  120. #define SDIO_MSK 0x2 /* Mask SDIO Int Detected */
  121. #define SCD_MSK 0x10 /* Mask Card Detect */
  122. /* Bit masks for SDH_CFG */
  123. #define CLKS_EN 0x1 /* Clocks Enable */
  124. #define SD4E 0x4 /* SDIO 4-Bit Enable */
  125. #define MWE 0x8 /* Moving Window Enable */
  126. #define SD_RST 0x10 /* SDMMC Reset */
  127. #define PUP_SDDAT 0x20 /* Pull-up SD_DAT */
  128. #define PUP_SDDAT3 0x40 /* Pull-up SD_DAT3 */
  129. #ifndef RSI_BLKSZ
  130. #define PD_SDDAT3 0x80 /* Pull-down SD_DAT3 */
  131. #else
  132. #define PWR_ON 0x600 /* Power On */
  133. #define SD_CMD_OD 0x800 /* Open Drain Output */
  134. #define BOOT_EN 0x1000 /* Boot Enable */
  135. #define BOOT_MODE 0x2000 /* Alternate Boot Mode */
  136. #define BOOT_ACK_EN 0x4000 /* Boot ACK is expected */
  137. #endif
  138. /* Bit masks for SDH_RD_WAIT_EN */
  139. #define RWR 0x1 /* Read Wait Request */
  140. #endif