dma.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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_DT_PROP = -1, /* not yet supported, do not use */
  21. DMACH_UART0 = 0,
  22. DMACH_UART0_SRC2,
  23. DMACH_UART1,
  24. DMACH_UART1_SRC2,
  25. DMACH_UART2,
  26. DMACH_UART2_SRC2,
  27. DMACH_UART3,
  28. DMACH_UART3_SRC2,
  29. DMACH_PCM0_TX,
  30. DMACH_PCM0_RX,
  31. DMACH_I2S0_OUT,
  32. DMACH_I2S0_IN,
  33. DMACH_SPI0_TX,
  34. DMACH_SPI0_RX,
  35. DMACH_HSI_I2SV40_TX,
  36. DMACH_HSI_I2SV40_RX,
  37. /* DMA1/SDMA1 */
  38. DMACH_PCM1_TX = 16,
  39. DMACH_PCM1_RX,
  40. DMACH_I2S1_OUT,
  41. DMACH_I2S1_IN,
  42. DMACH_SPI1_TX,
  43. DMACH_SPI1_RX,
  44. DMACH_AC97_PCMOUT,
  45. DMACH_AC97_PCMIN,
  46. DMACH_AC97_MICIN,
  47. DMACH_PWM,
  48. DMACH_IRDA,
  49. DMACH_EXTERNAL,
  50. DMACH_RES1,
  51. DMACH_RES2,
  52. DMACH_SECURITY_RX, /* SDMA1 only */
  53. DMACH_SECURITY_TX, /* SDMA1 only */
  54. DMACH_MAX /* the end */
  55. };
  56. static inline bool samsung_dma_has_circular(void)
  57. {
  58. return true;
  59. }
  60. static inline bool samsung_dma_is_dmadev(void)
  61. {
  62. return false;
  63. }
  64. #define S3C2410_DMAF_CIRCULAR (1 << 0)
  65. #include <plat/dma.h>
  66. #define DMACH_LOW_LEVEL (1<<28) /* use this to specifiy hardware ch no */
  67. struct s3c64xx_dma_buff;
  68. /** s3c64xx_dma_buff - S3C64XX DMA buffer descriptor
  69. * @next: Pointer to next buffer in queue or ring.
  70. * @pw: Client provided identifier
  71. * @lli: Pointer to hardware descriptor this buffer is associated with.
  72. * @lli_dma: Hardare address of the descriptor.
  73. */
  74. struct s3c64xx_dma_buff {
  75. struct s3c64xx_dma_buff *next;
  76. void *pw;
  77. struct pl080s_lli *lli;
  78. dma_addr_t lli_dma;
  79. };
  80. struct s3c64xx_dmac;
  81. struct s3c2410_dma_chan {
  82. unsigned char number; /* number of this dma channel */
  83. unsigned char in_use; /* channel allocated */
  84. unsigned char bit; /* bit for enable/disable/etc */
  85. unsigned char hw_width;
  86. unsigned char peripheral;
  87. unsigned int flags;
  88. enum dma_data_direction source;
  89. dma_addr_t dev_addr;
  90. struct s3c2410_dma_client *client;
  91. struct s3c64xx_dmac *dmac; /* pointer to controller */
  92. void __iomem *regs;
  93. /* cdriver callbacks */
  94. s3c2410_dma_cbfn_t callback_fn; /* buffer done callback */
  95. s3c2410_dma_opfn_t op_fn; /* channel op callback */
  96. /* buffer list and information */
  97. struct s3c64xx_dma_buff *curr; /* current dma buffer */
  98. struct s3c64xx_dma_buff *next; /* next buffer to load */
  99. struct s3c64xx_dma_buff *end; /* end of queue */
  100. /* note, when channel is running in circular mode, curr is the
  101. * first buffer enqueued, end is the last and curr is where the
  102. * last buffer-done event is set-at. The buffers are not freed
  103. * and the last buffer hardware descriptor points back to the
  104. * first.
  105. */
  106. };
  107. #include <plat/dma-core.h>
  108. #endif /* __ASM_ARCH_IRQ_H */