bfin_dma.h 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. /*
  2. * bfin_dma.h - Blackfin DMA defines/structures/etc...
  3. *
  4. * Copyright 2004-2010 Analog Devices Inc.
  5. *
  6. * Licensed under the GPL-2 or later.
  7. */
  8. #ifndef __ASM_BFIN_DMA_H__
  9. #define __ASM_BFIN_DMA_H__
  10. #include <linux/types.h>
  11. /* DMA_CONFIG Masks */
  12. #define DMAEN 0x0001 /* DMA Channel Enable */
  13. #define WNR 0x0002 /* Channel Direction (W/R*) */
  14. #define WDSIZE_8 0x0000 /* Transfer Word Size = 8 */
  15. #define PSIZE_8 0x00000000 /* Transfer Word Size = 16 */
  16. #ifdef CONFIG_BF60x
  17. #define PSIZE_16 0x00000010 /* Transfer Word Size = 16 */
  18. #define PSIZE_32 0x00000020 /* Transfer Word Size = 32 */
  19. #define PSIZE_64 0x00000030 /* Transfer Word Size = 32 */
  20. #define WDSIZE_16 0x00000100 /* Transfer Word Size = 16 */
  21. #define WDSIZE_32 0x00000200 /* Transfer Word Size = 32 */
  22. #define WDSIZE_64 0x00000300 /* Transfer Word Size = 32 */
  23. #define WDSIZE_128 0x00000400 /* Transfer Word Size = 32 */
  24. #define WDSIZE_256 0x00000500 /* Transfer Word Size = 32 */
  25. #define DMA2D 0x04000000 /* DMA Mode (2D/1D*) */
  26. #define RESTART 0x00000004 /* DMA Buffer Clear SYNC */
  27. #define DI_EN_X 0x00100000 /* Data Interrupt Enable in X count */
  28. #define DI_EN_Y 0x00200000 /* Data Interrupt Enable in Y count */
  29. #define DI_EN_P 0x00300000 /* Data Interrupt Enable in Peripheral */
  30. #define DI_EN DI_EN_X /* Data Interrupt Enable */
  31. #define NDSIZE_0 0x00000000 /* Next Descriptor Size = 1 */
  32. #define NDSIZE_1 0x00010000 /* Next Descriptor Size = 2 */
  33. #define NDSIZE_2 0x00020000 /* Next Descriptor Size = 3 */
  34. #define NDSIZE_3 0x00030000 /* Next Descriptor Size = 4 */
  35. #define NDSIZE_4 0x00040000 /* Next Descriptor Size = 5 */
  36. #define NDSIZE_5 0x00050000 /* Next Descriptor Size = 6 */
  37. #define NDSIZE_6 0x00060000 /* Next Descriptor Size = 7 */
  38. #define NDSIZE 0x00070000 /* Next Descriptor Size */
  39. #define NDSIZE_OFFSET 16 /* Next Descriptor Size Offset */
  40. #define DMAFLOW_LIST 0x00004000 /* Descriptor List Mode */
  41. #define DMAFLOW_LARGE DMAFLOW_LIST
  42. #define DMAFLOW_ARRAY 0x00005000 /* Descriptor Array Mode */
  43. #define DMAFLOW_LIST_DEMAND 0x00006000 /* Descriptor Demand List Mode */
  44. #define DMAFLOW_ARRAY_DEMAND 0x00007000 /* Descriptor Demand Array Mode */
  45. #define DMA_RUN_DFETCH 0x00000100 /* DMA Channel Running Indicator (DFETCH) */
  46. #define DMA_RUN 0x00000200 /* DMA Channel Running Indicator */
  47. #define DMA_RUN_WAIT_TRIG 0x00000300 /* DMA Channel Running Indicator (WAIT TRIG) */
  48. #define DMA_RUN_WAIT_ACK 0x00000400 /* DMA Channel Running Indicator (WAIT ACK) */
  49. #else
  50. #define PSIZE_16 0x0000 /* Transfer Word Size = 16 */
  51. #define PSIZE_32 0x0000 /* Transfer Word Size = 32 */
  52. #define WDSIZE_16 0x0004 /* Transfer Word Size = 16 */
  53. #define WDSIZE_32 0x0008 /* Transfer Word Size = 32 */
  54. #define DMA2D 0x0010 /* DMA Mode (2D/1D*) */
  55. #define RESTART 0x0020 /* DMA Buffer Clear */
  56. #define DI_SEL 0x0040 /* Data Interrupt Timing Select */
  57. #define DI_EN 0x0080 /* Data Interrupt Enable */
  58. #define DI_EN_X 0x00C0 /* Data Interrupt Enable in X count*/
  59. #define DI_EN_Y 0x0080 /* Data Interrupt Enable in Y count*/
  60. #define NDSIZE_0 0x0000 /* Next Descriptor Size = 0 (Stop/Autobuffer) */
  61. #define NDSIZE_1 0x0100 /* Next Descriptor Size = 1 */
  62. #define NDSIZE_2 0x0200 /* Next Descriptor Size = 2 */
  63. #define NDSIZE_3 0x0300 /* Next Descriptor Size = 3 */
  64. #define NDSIZE_4 0x0400 /* Next Descriptor Size = 4 */
  65. #define NDSIZE_5 0x0500 /* Next Descriptor Size = 5 */
  66. #define NDSIZE_6 0x0600 /* Next Descriptor Size = 6 */
  67. #define NDSIZE_7 0x0700 /* Next Descriptor Size = 7 */
  68. #define NDSIZE_8 0x0800 /* Next Descriptor Size = 8 */
  69. #define NDSIZE_9 0x0900 /* Next Descriptor Size = 9 */
  70. #define NDSIZE 0x0f00 /* Next Descriptor Size */
  71. #define NDSIZE_OFFSET 8 /* Next Descriptor Size Offset */
  72. #define DMAFLOW_ARRAY 0x4000 /* Descriptor Array Mode */
  73. #define DMAFLOW_SMALL 0x6000 /* Small Model Descriptor List Mode */
  74. #define DMAFLOW_LARGE 0x7000 /* Large Model Descriptor List Mode */
  75. #define DFETCH 0x0004 /* DMA Descriptor Fetch Indicator */
  76. #define DMA_RUN 0x0008 /* DMA Channel Running Indicator */
  77. #endif
  78. #define DMAFLOW 0x7000 /* Flow Control */
  79. #define DMAFLOW_STOP 0x0000 /* Stop Mode */
  80. #define DMAFLOW_AUTO 0x1000 /* Autobuffer Mode */
  81. /* DMA_IRQ_STATUS Masks */
  82. #define DMA_DONE 0x0001 /* DMA Completion Interrupt Status */
  83. #define DMA_ERR 0x0002 /* DMA Error Interrupt Status */
  84. #ifdef CONFIG_BF60x
  85. #define DMA_PIRQ 0x0004 /* DMA Peripheral Error Interrupt Status */
  86. #else
  87. #define DMA_PIRQ 0
  88. #endif
  89. /*
  90. * All Blackfin system MMRs are padded to 32bits even if the register
  91. * itself is only 16bits. So use a helper macro to streamline this.
  92. */
  93. #define __BFP(m) u16 m; u16 __pad_##m
  94. /*
  95. * bfin dma registers layout
  96. */
  97. struct bfin_dma_regs {
  98. u32 next_desc_ptr;
  99. u32 start_addr;
  100. #ifdef CONFIG_BF60x
  101. u32 cfg;
  102. u32 x_count;
  103. u32 x_modify;
  104. u32 y_count;
  105. u32 y_modify;
  106. u32 pad1;
  107. u32 pad2;
  108. u32 curr_desc_ptr;
  109. u32 prev_desc_ptr;
  110. u32 curr_addr;
  111. u32 irq_status;
  112. u32 curr_x_count;
  113. u32 curr_y_count;
  114. u32 pad3;
  115. u32 bw_limit_count;
  116. u32 curr_bw_limit_count;
  117. u32 bw_monitor_count;
  118. u32 curr_bw_monitor_count;
  119. #else
  120. __BFP(config);
  121. u32 __pad0;
  122. __BFP(x_count);
  123. __BFP(x_modify);
  124. __BFP(y_count);
  125. __BFP(y_modify);
  126. u32 curr_desc_ptr;
  127. u32 curr_addr;
  128. __BFP(irq_status);
  129. __BFP(peripheral_map);
  130. __BFP(curr_x_count);
  131. u32 __pad1;
  132. __BFP(curr_y_count);
  133. u32 __pad2;
  134. #endif
  135. };
  136. #ifndef CONFIG_BF60x
  137. /*
  138. * bfin handshake mdma registers layout
  139. */
  140. struct bfin_hmdma_regs {
  141. __BFP(control);
  142. __BFP(ecinit);
  143. __BFP(bcinit);
  144. __BFP(ecurgent);
  145. __BFP(ecoverflow);
  146. __BFP(ecount);
  147. __BFP(bcount);
  148. };
  149. #endif
  150. #undef __BFP
  151. #endif