dma.c 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /*
  2. * the simple DMA Implementation for Blackfin
  3. *
  4. * Copyright 2008 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 *) MDMA_D0_NEXT_DESC_PTR,
  33. (struct dma_register *) MDMA_S0_NEXT_DESC_PTR,
  34. (struct dma_register *) MDMA_D1_NEXT_DESC_PTR,
  35. (struct dma_register *) MDMA_S1_NEXT_DESC_PTR,
  36. (struct dma_register *) MDMA_D2_NEXT_DESC_PTR,
  37. (struct dma_register *) MDMA_S2_NEXT_DESC_PTR,
  38. (struct dma_register *) MDMA_D3_NEXT_DESC_PTR,
  39. (struct dma_register *) MDMA_S3_NEXT_DESC_PTR,
  40. };
  41. EXPORT_SYMBOL(dma_io_base_addr);
  42. int channel2irq(unsigned int channel)
  43. {
  44. int ret_irq = -1;
  45. switch (channel) {
  46. case CH_PPI:
  47. ret_irq = IRQ_PPI;
  48. break;
  49. case CH_UART0_RX:
  50. ret_irq = IRQ_UART0_RX;
  51. break;
  52. case CH_UART0_TX:
  53. ret_irq = IRQ_UART0_TX;
  54. break;
  55. case CH_UART1_RX:
  56. ret_irq = IRQ_UART1_RX;
  57. break;
  58. case CH_UART1_TX:
  59. ret_irq = IRQ_UART1_TX;
  60. break;
  61. case CH_UART2_RX:
  62. ret_irq = IRQ_UART2_RX;
  63. break;
  64. case CH_UART2_TX:
  65. ret_irq = IRQ_UART2_TX;
  66. break;
  67. case CH_SPORT0_RX:
  68. ret_irq = IRQ_SPORT0_RX;
  69. break;
  70. case CH_SPORT0_TX:
  71. ret_irq = IRQ_SPORT0_TX;
  72. break;
  73. case CH_SPORT1_RX:
  74. ret_irq = IRQ_SPORT1_RX;
  75. break;
  76. case CH_SPORT1_TX:
  77. ret_irq = IRQ_SPORT1_TX;
  78. break;
  79. case CH_SPORT2_RX:
  80. ret_irq = IRQ_SPORT2_RX;
  81. break;
  82. case CH_SPORT2_TX:
  83. ret_irq = IRQ_SPORT2_TX;
  84. break;
  85. case CH_SPORT3_RX:
  86. ret_irq = IRQ_SPORT3_RX;
  87. break;
  88. case CH_SPORT3_TX:
  89. ret_irq = IRQ_SPORT3_TX;
  90. break;
  91. case CH_SPI0:
  92. ret_irq = IRQ_SPI0;
  93. break;
  94. case CH_SPI1:
  95. ret_irq = IRQ_SPI1;
  96. break;
  97. case CH_SPI2:
  98. ret_irq = IRQ_SPI2;
  99. break;
  100. case CH_MEM_STREAM0_SRC:
  101. case CH_MEM_STREAM0_DEST:
  102. ret_irq = IRQ_MEM0_DMA0;
  103. break;
  104. case CH_MEM_STREAM1_SRC:
  105. case CH_MEM_STREAM1_DEST:
  106. ret_irq = IRQ_MEM0_DMA1;
  107. break;
  108. case CH_MEM_STREAM2_SRC:
  109. case CH_MEM_STREAM2_DEST:
  110. ret_irq = IRQ_MEM1_DMA0;
  111. break;
  112. case CH_MEM_STREAM3_SRC:
  113. case CH_MEM_STREAM3_DEST:
  114. ret_irq = IRQ_MEM1_DMA1;
  115. break;
  116. }
  117. return ret_irq;
  118. }