dma.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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 samsung_dma_has_circular(void)
  56. {
  57. return true;
  58. }
  59. static inline bool samsung_dma_is_dmadev(void)
  60. {
  61. return false;
  62. }
  63. #define S3C2410_DMAF_CIRCULAR (1 << 0)
  64. #include <plat/dma.h>
  65. #define DMACH_LOW_LEVEL (1<<28) /* use this to specifiy hardware ch no */
  66. struct s3c64xx_dma_buff;
  67. /** s3c64xx_dma_buff - S3C64XX DMA buffer descriptor
  68. * @next: Pointer to next buffer in queue or ring.
  69. * @pw: Client provided identifier
  70. * @lli: Pointer to hardware descriptor this buffer is associated with.
  71. * @lli_dma: Hardare address of the descriptor.
  72. */
  73. struct s3c64xx_dma_buff {
  74. struct s3c64xx_dma_buff *next;
  75. void *pw;
  76. struct pl080s_lli *lli;
  77. dma_addr_t lli_dma;
  78. };
  79. struct s3c64xx_dmac;
  80. struct s3c2410_dma_chan {
  81. unsigned char number; /* number of this dma channel */
  82. unsigned char in_use; /* channel allocated */
  83. unsigned char bit; /* bit for enable/disable/etc */
  84. unsigned char hw_width;
  85. unsigned char peripheral;
  86. unsigned int flags;
  87. enum dma_data_direction source;
  88. dma_addr_t dev_addr;
  89. struct s3c2410_dma_client *client;
  90. struct s3c64xx_dmac *dmac; /* pointer to controller */
  91. void __iomem *regs;
  92. /* cdriver callbacks */
  93. s3c2410_dma_cbfn_t callback_fn; /* buffer done callback */
  94. s3c2410_dma_opfn_t op_fn; /* channel op callback */
  95. /* buffer list and information */
  96. struct s3c64xx_dma_buff *curr; /* current dma buffer */
  97. struct s3c64xx_dma_buff *next; /* next buffer to load */
  98. struct s3c64xx_dma_buff *end; /* end of queue */
  99. /* note, when channel is running in circular mode, curr is the
  100. * first buffer enqueued, end is the last and curr is where the
  101. * last buffer-done event is set-at. The buffers are not freed
  102. * and the last buffer hardware descriptor points back to the
  103. * first.
  104. */
  105. };
  106. #include <plat/dma-core.h>
  107. #endif /* __ASM_ARCH_IRQ_H */