dma-ep93xx.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #ifndef __ASM_ARCH_DMA_H
  2. #define __ASM_ARCH_DMA_H
  3. #include <linux/types.h>
  4. #include <linux/dmaengine.h>
  5. #include <linux/dma-mapping.h>
  6. /*
  7. * M2P channels.
  8. *
  9. * Note that these values are also directly used for setting the PPALLOC
  10. * register.
  11. */
  12. #define EP93XX_DMA_I2S1 0
  13. #define EP93XX_DMA_I2S2 1
  14. #define EP93XX_DMA_AAC1 2
  15. #define EP93XX_DMA_AAC2 3
  16. #define EP93XX_DMA_AAC3 4
  17. #define EP93XX_DMA_I2S3 5
  18. #define EP93XX_DMA_UART1 6
  19. #define EP93XX_DMA_UART2 7
  20. #define EP93XX_DMA_UART3 8
  21. #define EP93XX_DMA_IRDA 9
  22. /* M2M channels */
  23. #define EP93XX_DMA_SSP 10
  24. #define EP93XX_DMA_IDE 11
  25. /**
  26. * struct ep93xx_dma_data - configuration data for the EP93xx dmaengine
  27. * @port: peripheral which is requesting the channel
  28. * @direction: TX/RX channel
  29. * @name: optional name for the channel, this is displayed in /proc/interrupts
  30. *
  31. * This information is passed as private channel parameter in a filter
  32. * function. Note that this is only needed for slave/cyclic channels. For
  33. * memcpy channels %NULL data should be passed.
  34. */
  35. struct ep93xx_dma_data {
  36. int port;
  37. enum dma_transfer_direction direction;
  38. const char *name;
  39. };
  40. /**
  41. * struct ep93xx_dma_chan_data - platform specific data for a DMA channel
  42. * @name: name of the channel, used for getting the right clock for the channel
  43. * @base: mapped registers
  44. * @irq: interrupt number used by this channel
  45. */
  46. struct ep93xx_dma_chan_data {
  47. const char *name;
  48. void __iomem *base;
  49. int irq;
  50. };
  51. /**
  52. * struct ep93xx_dma_platform_data - platform data for the dmaengine driver
  53. * @channels: array of channels which are passed to the driver
  54. * @num_channels: number of channels in the array
  55. *
  56. * This structure is passed to the DMA engine driver via platform data. For
  57. * M2P channels, contract is that even channels are for TX and odd for RX.
  58. * There is no requirement for the M2M channels.
  59. */
  60. struct ep93xx_dma_platform_data {
  61. struct ep93xx_dma_chan_data *channels;
  62. size_t num_channels;
  63. };
  64. static inline bool ep93xx_dma_chan_is_m2p(struct dma_chan *chan)
  65. {
  66. return !strcmp(dev_name(chan->device->dev), "ep93xx-dma-m2p");
  67. }
  68. /**
  69. * ep93xx_dma_chan_direction - returns direction the channel can be used
  70. * @chan: channel
  71. *
  72. * This function can be used in filter functions to find out whether the
  73. * channel supports given DMA direction. Only M2P channels have such
  74. * limitation, for M2M channels the direction is configurable.
  75. */
  76. static inline enum dma_transfer_direction
  77. ep93xx_dma_chan_direction(struct dma_chan *chan)
  78. {
  79. if (!ep93xx_dma_chan_is_m2p(chan))
  80. return DMA_NONE;
  81. /* even channels are for TX, odd for RX */
  82. return (chan->chan_id % 2 == 0) ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM;
  83. }
  84. #endif /* __ASM_ARCH_DMA_H */