dma.c 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. /*
  2. * 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 *) MDMA_D0_NEXT_DESC_PTR,
  21. (struct dma_register *) MDMA_S0_NEXT_DESC_PTR,
  22. (struct dma_register *) MDMA_D1_NEXT_DESC_PTR,
  23. (struct dma_register *) MDMA_S1_NEXT_DESC_PTR,
  24. };
  25. EXPORT_SYMBOL(dma_io_base_addr);
  26. int channel2irq(unsigned int channel)
  27. {
  28. int ret_irq = -1;
  29. switch (channel) {
  30. case CH_PPI:
  31. ret_irq = IRQ_PPI;
  32. break;
  33. case CH_SPORT0_RX:
  34. ret_irq = IRQ_SPORT0_RX;
  35. break;
  36. case CH_SPORT0_TX:
  37. ret_irq = IRQ_SPORT0_TX;
  38. break;
  39. case CH_SPORT1_RX:
  40. ret_irq = IRQ_SPORT1_RX;
  41. break;
  42. case CH_SPORT1_TX:
  43. ret_irq = IRQ_SPORT1_TX;
  44. break;
  45. case CH_SPI:
  46. ret_irq = IRQ_SPI;
  47. break;
  48. case CH_UART0_RX:
  49. ret_irq = IRQ_UART0_RX;
  50. break;
  51. case CH_UART0_TX:
  52. ret_irq = IRQ_UART0_TX;
  53. break;
  54. case CH_MEM_STREAM0_SRC:
  55. case CH_MEM_STREAM0_DEST:
  56. ret_irq = IRQ_MEM_DMA0;
  57. break;
  58. case CH_MEM_STREAM1_SRC:
  59. case CH_MEM_STREAM1_DEST:
  60. ret_irq = IRQ_MEM_DMA1;
  61. break;
  62. }
  63. return ret_irq;
  64. }