dma.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /* linux/arch/arm/mach-s3c6400/include/mach/dma.h
  2. *
  3. * Copyright 2008 Openmoko, Inc.
  4. * Copyright 2008 Simtec Electronics
  5. * Ben Dooks <ben@simtec.co.uk>
  6. * http://armlinux.simtec.co.uk/
  7. *
  8. * S3C6400 - DMA support
  9. */
  10. #ifndef __ASM_ARCH_DMA_H
  11. #define __ASM_ARCH_DMA_H __FILE__
  12. #define S3C_DMA_CHANNELS (16)
  13. /* see mach-s3c2410/dma.h for notes on dma channel numbers */
  14. /* Note, for the S3C64XX architecture we keep the DMACH_
  15. * defines in the order they are allocated to [S]DMA0/[S]DMA1
  16. * so that is easy to do DHACH_ -> DMA controller conversion
  17. */
  18. enum dma_ch {
  19. /* DMA0/SDMA0 */
  20. DMACH_UART0 = 0,
  21. DMACH_UART0_SRC2,
  22. DMACH_UART1,
  23. DMACH_UART1_SRC2,
  24. DMACH_UART2,
  25. DMACH_UART2_SRC2,
  26. DMACH_UART3,
  27. DMACH_UART3_SRC2,
  28. DMACH_PCM0_TX,
  29. DMACH_PCM0_RX,
  30. DMACH_I2S0_OUT,
  31. DMACH_I2S0_IN,
  32. DMACH_SPI0_TX,
  33. DMACH_SPI0_RX,
  34. DMACH_HSI_I2SV40_TX,
  35. DMACH_HSI_I2SV40_RX,
  36. /* DMA1/SDMA1 */
  37. DMACH_PCM1_TX = 16,
  38. DMACH_PCM1_RX,
  39. DMACH_I2S1_OUT,
  40. DMACH_I2S1_IN,
  41. DMACH_SPI1_TX,
  42. DMACH_SPI1_RX,
  43. DMACH_AC97_PCMOUT,
  44. DMACH_AC97_PCMIN,
  45. DMACH_AC97_MICIN,
  46. DMACH_PWM,
  47. DMACH_IRDA,
  48. DMACH_EXTERNAL,
  49. DMACH_RES1,
  50. DMACH_RES2,
  51. DMACH_SECURITY_RX, /* SDMA1 only */
  52. DMACH_SECURITY_TX, /* SDMA1 only */
  53. DMACH_MAX /* the end */
  54. };
  55. static __inline__ bool s3c_dma_has_circular(void)
  56. {
  57. return true;
  58. }
  59. #define S3C2410_DMAF_CIRCULAR (1 << 0)
  60. #include <plat/dma.h>
  61. #define DMACH_LOW_LEVEL (1<<28) /* use this to specifiy hardware ch no */
  62. struct s3c64xx_dma_buff;
  63. /** s3c64xx_dma_buff - S3C64XX DMA buffer descriptor
  64. * @next: Pointer to next buffer in queue or ring.
  65. * @pw: Client provided identifier
  66. * @lli: Pointer to hardware descriptor this buffer is associated with.
  67. * @lli_dma: Hardare address of the descriptor.
  68. */
  69. struct s3c64xx_dma_buff {
  70. struct s3c64xx_dma_buff *next;
  71. void *pw;
  72. struct pl080s_lli *lli;
  73. dma_addr_t lli_dma;
  74. };
  75. struct s3c64xx_dmac;
  76. struct s3c2410_dma_chan {
  77. unsigned char number; /* number of this dma channel */
  78. unsigned char in_use; /* channel allocated */
  79. unsigned char bit; /* bit for enable/disable/etc */
  80. unsigned char hw_width;
  81. unsigned char peripheral;
  82. unsigned int flags;
  83. enum s3c2410_dmasrc source;
  84. dma_addr_t dev_addr;
  85. struct s3c2410_dma_client *client;
  86. struct s3c64xx_dmac *dmac; /* pointer to controller */
  87. void __iomem *regs;
  88. /* cdriver callbacks */
  89. s3c2410_dma_cbfn_t callback_fn; /* buffer done callback */
  90. s3c2410_dma_opfn_t op_fn; /* channel op callback */
  91. /* buffer list and information */
  92. struct s3c64xx_dma_buff *curr; /* current dma buffer */
  93. struct s3c64xx_dma_buff *next; /* next buffer to load */
  94. struct s3c64xx_dma_buff *end; /* end of queue */
  95. /* note, when channel is running in circular mode, curr is the
  96. * first buffer enqueued, end is the last and curr is where the
  97. * last buffer-done event is set-at. The buffers are not freed
  98. * and the last buffer hardware descriptor points back to the
  99. * first.
  100. */
  101. };
  102. #include <plat/dma-core.h>
  103. #endif /* __ASM_ARCH_IRQ_H */