dma.c 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * the simple DMA Implementation for Blackfin
  3. *
  4. * Copyright 2007-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 *) DMA1_0_NEXT_DESC_PTR,
  13. (struct dma_register *) DMA1_1_NEXT_DESC_PTR,
  14. (struct dma_register *) DMA1_2_NEXT_DESC_PTR,
  15. (struct dma_register *) DMA1_3_NEXT_DESC_PTR,
  16. (struct dma_register *) DMA1_4_NEXT_DESC_PTR,
  17. (struct dma_register *) DMA1_5_NEXT_DESC_PTR,
  18. (struct dma_register *) DMA1_6_NEXT_DESC_PTR,
  19. (struct dma_register *) DMA1_7_NEXT_DESC_PTR,
  20. (struct dma_register *) DMA1_8_NEXT_DESC_PTR,
  21. (struct dma_register *) DMA1_9_NEXT_DESC_PTR,
  22. (struct dma_register *) DMA1_10_NEXT_DESC_PTR,
  23. (struct dma_register *) DMA1_11_NEXT_DESC_PTR,
  24. (struct dma_register *) DMA2_0_NEXT_DESC_PTR,
  25. (struct dma_register *) DMA2_1_NEXT_DESC_PTR,
  26. (struct dma_register *) DMA2_2_NEXT_DESC_PTR,
  27. (struct dma_register *) DMA2_3_NEXT_DESC_PTR,
  28. (struct dma_register *) DMA2_4_NEXT_DESC_PTR,
  29. (struct dma_register *) DMA2_5_NEXT_DESC_PTR,
  30. (struct dma_register *) DMA2_6_NEXT_DESC_PTR,
  31. (struct dma_register *) DMA2_7_NEXT_DESC_PTR,
  32. (struct dma_register *) DMA2_8_NEXT_DESC_PTR,
  33. (struct dma_register *) DMA2_9_NEXT_DESC_PTR,
  34. (struct dma_register *) DMA2_10_NEXT_DESC_PTR,
  35. (struct dma_register *) DMA2_11_NEXT_DESC_PTR,
  36. (struct dma_register *) MDMA_D0_NEXT_DESC_PTR,
  37. (struct dma_register *) MDMA_S0_NEXT_DESC_PTR,
  38. (struct dma_register *) MDMA_D1_NEXT_DESC_PTR,
  39. (struct dma_register *) MDMA_S1_NEXT_DESC_PTR,
  40. (struct dma_register *) MDMA_D2_NEXT_DESC_PTR,
  41. (struct dma_register *) MDMA_S2_NEXT_DESC_PTR,
  42. (struct dma_register *) MDMA_D3_NEXT_DESC_PTR,
  43. (struct dma_register *) MDMA_S3_NEXT_DESC_PTR,
  44. (struct dma_register *) IMDMA_D0_NEXT_DESC_PTR,
  45. (struct dma_register *) IMDMA_S0_NEXT_DESC_PTR,
  46. (struct dma_register *) IMDMA_D1_NEXT_DESC_PTR,
  47. (struct dma_register *) IMDMA_S1_NEXT_DESC_PTR,
  48. };
  49. EXPORT_SYMBOL(dma_io_base_addr);
  50. int channel2irq(unsigned int channel)
  51. {
  52. int ret_irq = -1;
  53. switch (channel) {
  54. case CH_PPI0:
  55. ret_irq = IRQ_PPI0;
  56. break;
  57. case CH_PPI1:
  58. ret_irq = IRQ_PPI1;
  59. break;
  60. case CH_SPORT0_RX:
  61. ret_irq = IRQ_SPORT0_RX;
  62. break;
  63. case CH_SPORT0_TX:
  64. ret_irq = IRQ_SPORT0_TX;
  65. break;
  66. case CH_SPORT1_RX:
  67. ret_irq = IRQ_SPORT1_RX;
  68. break;
  69. case CH_SPORT1_TX:
  70. ret_irq = IRQ_SPORT1_TX;
  71. break;
  72. case CH_SPI:
  73. ret_irq = IRQ_SPI;
  74. break;
  75. case CH_UART_RX:
  76. ret_irq = IRQ_UART_RX;
  77. break;
  78. case CH_UART_TX:
  79. ret_irq = IRQ_UART_TX;
  80. break;
  81. case CH_MEM_STREAM0_SRC:
  82. case CH_MEM_STREAM0_DEST:
  83. ret_irq = IRQ_MEM_DMA0;
  84. break;
  85. case CH_MEM_STREAM1_SRC:
  86. case CH_MEM_STREAM1_DEST:
  87. ret_irq = IRQ_MEM_DMA1;
  88. break;
  89. case CH_MEM_STREAM2_SRC:
  90. case CH_MEM_STREAM2_DEST:
  91. ret_irq = IRQ_MEM_DMA2;
  92. break;
  93. case CH_MEM_STREAM3_SRC:
  94. case CH_MEM_STREAM3_DEST:
  95. ret_irq = IRQ_MEM_DMA3;
  96. break;
  97. case CH_IMEM_STREAM0_SRC:
  98. case CH_IMEM_STREAM0_DEST:
  99. ret_irq = IRQ_IMEM_DMA0;
  100. break;
  101. case CH_IMEM_STREAM1_SRC:
  102. case CH_IMEM_STREAM1_DEST:
  103. ret_irq = IRQ_IMEM_DMA1;
  104. break;
  105. }
  106. return ret_irq;
  107. }