bfin_sdh.h 7.2 KB

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