au1xmmc.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. #ifndef _AU1XMMC_H_
  2. #define _AU1XMMC_H_
  3. /* Hardware definitions */
  4. #define AU1XMMC_DESCRIPTOR_COUNT 1
  5. #define AU1XMMC_DESCRIPTOR_SIZE 2048
  6. #define AU1XMMC_OCR ( MMC_VDD_27_28 | MMC_VDD_28_29 | MMC_VDD_29_30 | \
  7. MMC_VDD_30_31 | MMC_VDD_31_32 | MMC_VDD_32_33 | \
  8. MMC_VDD_33_34 | MMC_VDD_34_35 | MMC_VDD_35_36)
  9. /* Easy access macros */
  10. #define HOST_STATUS(h) ((h)->iobase + SD_STATUS)
  11. #define HOST_CONFIG(h) ((h)->iobase + SD_CONFIG)
  12. #define HOST_ENABLE(h) ((h)->iobase + SD_ENABLE)
  13. #define HOST_TXPORT(h) ((h)->iobase + SD_TXPORT)
  14. #define HOST_RXPORT(h) ((h)->iobase + SD_RXPORT)
  15. #define HOST_CMDARG(h) ((h)->iobase + SD_CMDARG)
  16. #define HOST_BLKSIZE(h) ((h)->iobase + SD_BLKSIZE)
  17. #define HOST_CMD(h) ((h)->iobase + SD_CMD)
  18. #define HOST_CONFIG2(h) ((h)->iobase + SD_CONFIG2)
  19. #define HOST_TIMEOUT(h) ((h)->iobase + SD_TIMEOUT)
  20. #define HOST_DEBUG(h) ((h)->iobase + SD_DEBUG)
  21. #define DMA_CHANNEL(h) \
  22. ( ((h)->flags & HOST_F_XMIT) ? (h)->tx_chan : (h)->rx_chan)
  23. /* This gives us a hard value for the stop command that we can write directly
  24. * to the command register
  25. */
  26. #define STOP_CMD (SD_CMD_RT_1B|SD_CMD_CT_7|(0xC << SD_CMD_CI_SHIFT)|SD_CMD_GO)
  27. /* This is the set of interrupts that we configure by default */
  28. #if 0
  29. #define AU1XMMC_INTERRUPTS (SD_CONFIG_SC | SD_CONFIG_DT | SD_CONFIG_DD | \
  30. SD_CONFIG_RAT | SD_CONFIG_CR | SD_CONFIG_I)
  31. #endif
  32. #define AU1XMMC_INTERRUPTS (SD_CONFIG_SC | SD_CONFIG_DT | \
  33. SD_CONFIG_RAT | SD_CONFIG_CR | SD_CONFIG_I)
  34. /* The poll event (looking for insert/remove events runs twice a second */
  35. #define AU1XMMC_DETECT_TIMEOUT (HZ/2)
  36. struct au1xmmc_host {
  37. struct mmc_host *mmc;
  38. struct mmc_request *mrq;
  39. u32 id;
  40. u32 flags;
  41. u32 iobase;
  42. u32 clock;
  43. u32 bus_width;
  44. u32 power_mode;
  45. int status;
  46. struct {
  47. int len;
  48. int dir;
  49. } dma;
  50. struct {
  51. int index;
  52. int offset;
  53. int len;
  54. } pio;
  55. u32 tx_chan;
  56. u32 rx_chan;
  57. struct timer_list timer;
  58. struct tasklet_struct finish_task;
  59. struct tasklet_struct data_task;
  60. spinlock_t lock;
  61. };
  62. /* Status flags used by the host structure */
  63. #define HOST_F_XMIT 0x0001
  64. #define HOST_F_RECV 0x0002
  65. #define HOST_F_DMA 0x0010
  66. #define HOST_F_ACTIVE 0x0100
  67. #define HOST_F_STOP 0x1000
  68. #define HOST_S_IDLE 0x0001
  69. #define HOST_S_CMD 0x0002
  70. #define HOST_S_DATA 0x0003
  71. #define HOST_S_STOP 0x0004
  72. #endif