bfin_sdh.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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. /* SDH_PWR_CTL bitmasks */
  25. #define PWR_ON 0x3 /* Power On */
  26. #define SD_CMD_OD (1 << 6) /* Open Drain Output */
  27. #define ROD_CTL (1 << 7) /* Rod Control */
  28. /* SDH_CLK_CTL bitmasks */
  29. #define CLKDIV 0xff /* MC_CLK Divisor */
  30. #define CLK_E (1 << 8) /* MC_CLK Bus Clock Enable */
  31. #define PWR_SV_E (1 << 9) /* Power Save Enable */
  32. #define CLKDIV_BYPASS (1 << 10) /* Bypass Divisor */
  33. #define WIDE_BUS (1 << 11) /* Wide Bus Mode Enable */
  34. /* SDH_RESP_CMD bitmasks */
  35. #define RESP_CMD 0x3f /* Response Command */
  36. /* SDH_DATA_CTL bitmasks */
  37. #define DTX_E (1 << 0) /* Data Transfer Enable */
  38. #define DTX_DIR (1 << 1) /* Data Transfer Direction */
  39. #define DTX_MODE (1 << 2) /* Data Transfer Mode */
  40. #define DTX_DMA_E (1 << 3) /* Data Transfer DMA Enable */
  41. #define DTX_BLK_LGTH (0xf << 4) /* Data Transfer Block Length */
  42. /* SDH_STATUS bitmasks */
  43. #define CMD_CRC_FAIL (1 << 0) /* CMD CRC Fail */
  44. #define DAT_CRC_FAIL (1 << 1) /* Data CRC Fail */
  45. #define CMD_TIME_OUT (1 << 2) /* CMD Time Out */
  46. #define DAT_TIME_OUT (1 << 3) /* Data Time Out */
  47. #define TX_UNDERRUN (1 << 4) /* Transmit Underrun */
  48. #define RX_OVERRUN (1 << 5) /* Receive Overrun */
  49. #define CMD_RESP_END (1 << 6) /* CMD Response End */
  50. #define CMD_SENT (1 << 7) /* CMD Sent */
  51. #define DAT_END (1 << 8) /* Data End */
  52. #define START_BIT_ERR (1 << 9) /* Start Bit Error */
  53. #define DAT_BLK_END (1 << 10) /* Data Block End */
  54. #define CMD_ACT (1 << 11) /* CMD Active */
  55. #define TX_ACT (1 << 12) /* Transmit Active */
  56. #define RX_ACT (1 << 13) /* Receive Active */
  57. #define TX_FIFO_STAT (1 << 14) /* Transmit FIFO Status */
  58. #define RX_FIFO_STAT (1 << 15) /* Receive FIFO Status */
  59. #define TX_FIFO_FULL (1 << 16) /* Transmit FIFO Full */
  60. #define RX_FIFO_FULL (1 << 17) /* Receive FIFO Full */
  61. #define TX_FIFO_ZERO (1 << 18) /* Transmit FIFO Empty */
  62. #define RX_DAT_ZERO (1 << 19) /* Receive FIFO Empty */
  63. #define TX_DAT_RDY (1 << 20) /* Transmit Data Available */
  64. #define RX_FIFO_RDY (1 << 21) /* Receive Data Available */
  65. /* SDH_STATUS_CLR bitmasks */
  66. #define CMD_CRC_FAIL_STAT (1 << 0) /* CMD CRC Fail Status */
  67. #define DAT_CRC_FAIL_STAT (1 << 1) /* Data CRC Fail Status */
  68. #define CMD_TIMEOUT_STAT (1 << 2) /* CMD Time Out Status */
  69. #define DAT_TIMEOUT_STAT (1 << 3) /* Data Time Out status */
  70. #define TX_UNDERRUN_STAT (1 << 4) /* Transmit Underrun Status */
  71. #define RX_OVERRUN_STAT (1 << 5) /* Receive Overrun Status */
  72. #define CMD_RESP_END_STAT (1 << 6) /* CMD Response End Status */
  73. #define CMD_SENT_STAT (1 << 7) /* CMD Sent Status */
  74. #define DAT_END_STAT (1 << 8) /* Data End Status */
  75. #define START_BIT_ERR_STAT (1 << 9) /* Start Bit Error Status */
  76. #define DAT_BLK_END_STAT (1 << 10) /* Data Block End Status */
  77. /* SDH_MASK0 bitmasks */
  78. #define CMD_CRC_FAIL_MASK (1 << 0) /* CMD CRC Fail Mask */
  79. #define DAT_CRC_FAIL_MASK (1 << 1) /* Data CRC Fail Mask */
  80. #define CMD_TIMEOUT_MASK (1 << 2) /* CMD Time Out Mask */
  81. #define DAT_TIMEOUT_MASK (1 << 3) /* Data Time Out Mask */
  82. #define TX_UNDERRUN_MASK (1 << 4) /* Transmit Underrun Mask */
  83. #define RX_OVERRUN_MASK (1 << 5) /* Receive Overrun Mask */
  84. #define CMD_RESP_END_MASK (1 << 6) /* CMD Response End Mask */
  85. #define CMD_SENT_MASK (1 << 7) /* CMD Sent Mask */
  86. #define DAT_END_MASK (1 << 8) /* Data End Mask */
  87. #define START_BIT_ERR_MASK (1 << 9) /* Start Bit Error Mask */
  88. #define DAT_BLK_END_MASK (1 << 10) /* Data Block End Mask */
  89. #define CMD_ACT_MASK (1 << 11) /* CMD Active Mask */
  90. #define TX_ACT_MASK (1 << 12) /* Transmit Active Mask */
  91. #define RX_ACT_MASK (1 << 13) /* Receive Active Mask */
  92. #define TX_FIFO_STAT_MASK (1 << 14) /* Transmit FIFO Status Mask */
  93. #define RX_FIFO_STAT_MASK (1 << 15) /* Receive FIFO Status Mask */
  94. #define TX_FIFO_FULL_MASK (1 << 16) /* Transmit FIFO Full Mask */
  95. #define RX_FIFO_FULL_MASK (1 << 17) /* Receive FIFO Full Mask */
  96. #define TX_FIFO_ZERO_MASK (1 << 18) /* Transmit FIFO Empty Mask */
  97. #define RX_DAT_ZERO_MASK (1 << 19) /* Receive FIFO Empty Mask */
  98. #define TX_DAT_RDY_MASK (1 << 20) /* Transmit Data Available Mask */
  99. #define RX_FIFO_RDY_MASK (1 << 21) /* Receive Data Available Mask */
  100. /* SDH_FIFO_CNT bitmasks */
  101. #define FIFO_COUNT 0x7fff /* FIFO Count */
  102. /* SDH_E_STATUS bitmasks */
  103. #define SDIO_INT_DET (1 << 1) /* SDIO Int Detected */
  104. #define SD_CARD_DET (1 << 4) /* SD Card Detect */
  105. /* SDH_E_MASK bitmasks */
  106. #define SDIO_MSK (1 << 1) /* Mask SDIO Int Detected */
  107. #define SCD_MSK (1 << 6) /* Mask Card Detect */
  108. /* SDH_CFG bitmasks */
  109. #define CLKS_EN (1 << 0) /* Clocks Enable */
  110. #define SD4E (1 << 2) /* SDIO 4-Bit Enable */
  111. #define MWE (1 << 3) /* Moving Window Enable */
  112. #define SD_RST (1 << 4) /* SDMMC Reset */
  113. #define PUP_SDDAT (1 << 5) /* Pull-up SD_DAT */
  114. #define PUP_SDDAT3 (1 << 6) /* Pull-up SD_DAT3 */
  115. #define PD_SDDAT3 (1 << 7) /* Pull-down SD_DAT3 */
  116. /* SDH_RD_WAIT_EN bitmasks */
  117. #define RWR (1 << 0) /* Read Wait Request */
  118. #endif