dma.c 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. /*
  2. * the simple DMA Implementation for Blackfin
  3. *
  4. * Copyright 2007-2009 Analog Devices Inc.
  5. *
  6. * Licensed under the GPL-2 or later.
  7. */
  8. #include <linux/module.h>
  9. #include <asm/blackfin.h>
  10. #include <asm/dma.h>
  11. struct dma_register * const dma_io_base_addr[MAX_DMA_CHANNELS] = {
  12. (struct dma_register *) DMA0_NEXT_DESC_PTR,
  13. (struct dma_register *) DMA1_NEXT_DESC_PTR,
  14. (struct dma_register *) DMA2_NEXT_DESC_PTR,
  15. (struct dma_register *) DMA3_NEXT_DESC_PTR,
  16. (struct dma_register *) DMA4_NEXT_DESC_PTR,
  17. (struct dma_register *) DMA5_NEXT_DESC_PTR,
  18. (struct dma_register *) DMA6_NEXT_DESC_PTR,
  19. (struct dma_register *) DMA7_NEXT_DESC_PTR,
  20. (struct dma_register *) DMA8_NEXT_DESC_PTR,
  21. (struct dma_register *) DMA9_NEXT_DESC_PTR,
  22. (struct dma_register *) DMA10_NEXT_DESC_PTR,
  23. (struct dma_register *) DMA11_NEXT_DESC_PTR,
  24. (struct dma_register *) DMA12_NEXT_DESC_PTR,
  25. (struct dma_register *) DMA13_NEXT_DESC_PTR,
  26. (struct dma_register *) DMA14_NEXT_DESC_PTR,
  27. (struct dma_register *) DMA15_NEXT_DESC_PTR,
  28. (struct dma_register *) DMA16_NEXT_DESC_PTR,
  29. (struct dma_register *) DMA17_NEXT_DESC_PTR,
  30. (struct dma_register *) DMA18_NEXT_DESC_PTR,
  31. (struct dma_register *) DMA19_NEXT_DESC_PTR,
  32. (struct dma_register *) DMA20_NEXT_DESC_PTR,
  33. (struct dma_register *) MDMA0_SRC_CRC0_NEXT_DESC_PTR,
  34. (struct dma_register *) MDMA0_DEST_CRC0_NEXT_DESC_PTR,
  35. (struct dma_register *) MDMA1_SRC_CRC1_NEXT_DESC_PTR,
  36. (struct dma_register *) MDMA1_DEST_CRC1_NEXT_DESC_PTR,
  37. (struct dma_register *) MDMA2_SRC_NEXT_DESC_PTR,
  38. (struct dma_register *) MDMA2_DEST_NEXT_DESC_PTR,
  39. (struct dma_register *) MDMA3_SRC_NEXT_DESC_PTR,
  40. (struct dma_register *) MDMA3_DEST_NEXT_DESC_PTR,
  41. (struct dma_register *) DMA29_NEXT_DESC_PTR,
  42. (struct dma_register *) DMA30_NEXT_DESC_PTR,
  43. (struct dma_register *) DMA31_NEXT_DESC_PTR,
  44. (struct dma_register *) DMA32_NEXT_DESC_PTR,
  45. (struct dma_register *) DMA33_NEXT_DESC_PTR,
  46. (struct dma_register *) DMA34_NEXT_DESC_PTR,
  47. (struct dma_register *) DMA35_NEXT_DESC_PTR,
  48. (struct dma_register *) DMA36_NEXT_DESC_PTR,
  49. (struct dma_register *) DMA37_NEXT_DESC_PTR,
  50. (struct dma_register *) DMA38_NEXT_DESC_PTR,
  51. (struct dma_register *) DMA39_NEXT_DESC_PTR,
  52. (struct dma_register *) DMA40_NEXT_DESC_PTR,
  53. (struct dma_register *) DMA41_NEXT_DESC_PTR,
  54. (struct dma_register *) DMA42_NEXT_DESC_PTR,
  55. (struct dma_register *) DMA43_NEXT_DESC_PTR,
  56. (struct dma_register *) DMA44_NEXT_DESC_PTR,
  57. (struct dma_register *) DMA45_NEXT_DESC_PTR,
  58. (struct dma_register *) DMA46_NEXT_DESC_PTR,
  59. };
  60. EXPORT_SYMBOL(dma_io_base_addr);
  61. int channel2irq(unsigned int channel)
  62. {
  63. int ret_irq = -1;
  64. switch (channel) {
  65. case CH_SPORT0_RX:
  66. ret_irq = IRQ_SPORT0_RX;
  67. break;
  68. case CH_SPORT0_TX:
  69. ret_irq = IRQ_SPORT0_TX;
  70. break;
  71. case CH_SPORT1_RX:
  72. ret_irq = IRQ_SPORT1_RX;
  73. break;
  74. case CH_SPORT1_TX:
  75. ret_irq = IRQ_SPORT1_TX;
  76. break;
  77. case CH_SPORT2_RX:
  78. ret_irq = IRQ_SPORT2_RX;
  79. break;
  80. case CH_SPORT2_TX:
  81. ret_irq = IRQ_SPORT2_TX;
  82. break;
  83. case CH_SPI0_TX:
  84. ret_irq = IRQ_SPI0_TX;
  85. break;
  86. case CH_SPI0_RX:
  87. ret_irq = IRQ_SPI0_RX;
  88. break;
  89. case CH_SPI1_TX:
  90. ret_irq = IRQ_SPI1_TX;
  91. break;
  92. case CH_SPI1_RX:
  93. ret_irq = IRQ_SPI1_RX;
  94. break;
  95. case CH_RSI:
  96. ret_irq = IRQ_RSI;
  97. break;
  98. case CH_SDU:
  99. ret_irq = IRQ_SDU;
  100. break;
  101. case CH_LP0:
  102. ret_irq = IRQ_LP0;
  103. break;
  104. case CH_LP1:
  105. ret_irq = IRQ_LP1;
  106. break;
  107. case CH_LP2:
  108. ret_irq = IRQ_LP2;
  109. break;
  110. case CH_LP3:
  111. ret_irq = IRQ_LP3;
  112. break;
  113. case CH_UART0_RX:
  114. ret_irq = IRQ_UART0_RX;
  115. break;
  116. case CH_UART0_TX:
  117. ret_irq = IRQ_UART0_TX;
  118. break;
  119. case CH_UART1_RX:
  120. ret_irq = IRQ_UART1_RX;
  121. break;
  122. case CH_UART1_TX:
  123. ret_irq = IRQ_UART1_TX;
  124. break;
  125. case CH_EPPI0_CH0:
  126. ret_irq = IRQ_EPPI0_CH0;
  127. break;
  128. case CH_EPPI0_CH1:
  129. ret_irq = IRQ_EPPI0_CH1;
  130. break;
  131. case CH_EPPI1_CH0:
  132. ret_irq = IRQ_EPPI1_CH0;
  133. break;
  134. case CH_EPPI1_CH1:
  135. ret_irq = IRQ_EPPI1_CH1;
  136. break;
  137. case CH_EPPI2_CH0:
  138. ret_irq = IRQ_EPPI2_CH0;
  139. break;
  140. case CH_EPPI2_CH1:
  141. ret_irq = IRQ_EPPI2_CH1;
  142. break;
  143. case CH_PIXC_CH0:
  144. ret_irq = IRQ_PIXC_CH0;
  145. break;
  146. case CH_PIXC_CH1:
  147. ret_irq = IRQ_PIXC_CH1;
  148. break;
  149. case CH_PIXC_CH2:
  150. ret_irq = IRQ_PIXC_CH2;
  151. break;
  152. case CH_PVP_CPDOB:
  153. ret_irq = IRQ_PVP_CPDOB;
  154. break;
  155. case CH_PVP_CPDOC:
  156. ret_irq = IRQ_PVP_CPDOC;
  157. break;
  158. case CH_PVP_CPSTAT:
  159. ret_irq = IRQ_PVP_CPSTAT;
  160. break;
  161. case CH_PVP_CPCI:
  162. ret_irq = IRQ_PVP_CPCI;
  163. break;
  164. case CH_PVP_MPDO:
  165. ret_irq = IRQ_PVP_MPDO;
  166. break;
  167. case CH_PVP_MPDI:
  168. ret_irq = IRQ_PVP_MPDI;
  169. break;
  170. case CH_PVP_MPSTAT:
  171. ret_irq = IRQ_PVP_MPSTAT;
  172. break;
  173. case CH_PVP_MPCI:
  174. ret_irq = IRQ_PVP_MPCI;
  175. break;
  176. case CH_PVP_CPDOA:
  177. ret_irq = IRQ_PVP_CPDOA;
  178. break;
  179. case CH_MEM_STREAM0_SRC:
  180. case CH_MEM_STREAM0_DEST:
  181. ret_irq = IRQ_MDMAS0;
  182. break;
  183. case CH_MEM_STREAM1_SRC:
  184. case CH_MEM_STREAM1_DEST:
  185. ret_irq = IRQ_MDMAS1;
  186. break;
  187. case CH_MEM_STREAM2_SRC:
  188. case CH_MEM_STREAM2_DEST:
  189. ret_irq = IRQ_MDMAS2;
  190. break;
  191. case CH_MEM_STREAM3_SRC:
  192. case CH_MEM_STREAM3_DEST:
  193. ret_irq = IRQ_MDMAS3;
  194. break;
  195. }
  196. return ret_irq;
  197. }