|
17 | 17 | #include <linux/clk.h>
|
18 | 18 | #include <linux/init.h>
|
19 | 19 | #include <linux/interrupt.h>
|
| 20 | +#include <linux/dma-mapping.h> |
20 | 21 | #include <linux/dmaengine.h>
|
21 | 22 | #include <linux/module.h>
|
22 | 23 | #include <linux/mod_devicetable.h>
|
|
25 | 26 | #include <linux/platform_device.h>
|
26 | 27 | #include <linux/slab.h>
|
27 | 28 |
|
28 |
| -#include <linux/platform_data/dma-ep93xx.h> |
29 |
| - |
30 | 29 | #include "dmaengine.h"
|
31 | 30 |
|
32 | 31 | /* M2P registers */
|
|
106 | 105 | #define DMA_MAX_CHAN_BYTES 0xffff
|
107 | 106 | #define DMA_MAX_CHAN_DESCRIPTORS 32
|
108 | 107 |
|
| 108 | +/* |
| 109 | + * M2P channels. |
| 110 | + * |
| 111 | + * Note that these values are also directly used for setting the PPALLOC |
| 112 | + * register. |
| 113 | + */ |
| 114 | +#define EP93XX_DMA_I2S1 0 |
| 115 | +#define EP93XX_DMA_I2S2 1 |
| 116 | +#define EP93XX_DMA_AAC1 2 |
| 117 | +#define EP93XX_DMA_AAC2 3 |
| 118 | +#define EP93XX_DMA_AAC3 4 |
| 119 | +#define EP93XX_DMA_I2S3 5 |
| 120 | +#define EP93XX_DMA_UART1 6 |
| 121 | +#define EP93XX_DMA_UART2 7 |
| 122 | +#define EP93XX_DMA_UART3 8 |
| 123 | +#define EP93XX_DMA_IRDA 9 |
| 124 | +/* M2M channels */ |
| 125 | +#define EP93XX_DMA_SSP 10 |
| 126 | +#define EP93XX_DMA_IDE 11 |
| 127 | + |
109 | 128 | enum ep93xx_dma_type {
|
110 | 129 | M2P_DMA,
|
111 | 130 | M2M_DMA,
|
@@ -242,6 +261,31 @@ static struct ep93xx_dma_chan *to_ep93xx_dma_chan(struct dma_chan *chan)
|
242 | 261 | return container_of(chan, struct ep93xx_dma_chan, chan);
|
243 | 262 | }
|
244 | 263 |
|
| 264 | +static inline bool ep93xx_dma_chan_is_m2p(struct dma_chan *chan) |
| 265 | +{ |
| 266 | + if (device_is_compatible(chan->device->dev, "cirrus,ep9301-dma-m2p")) |
| 267 | + return true; |
| 268 | + |
| 269 | + return !strcmp(dev_name(chan->device->dev), "ep93xx-dma-m2p"); |
| 270 | +} |
| 271 | + |
| 272 | +/* |
| 273 | + * ep93xx_dma_chan_direction - returns direction the channel can be used |
| 274 | + * |
| 275 | + * This function can be used in filter functions to find out whether the |
| 276 | + * channel supports given DMA direction. Only M2P channels have such |
| 277 | + * limitation, for M2M channels the direction is configurable. |
| 278 | + */ |
| 279 | +static inline enum dma_transfer_direction |
| 280 | +ep93xx_dma_chan_direction(struct dma_chan *chan) |
| 281 | +{ |
| 282 | + if (!ep93xx_dma_chan_is_m2p(chan)) |
| 283 | + return DMA_TRANS_NONE; |
| 284 | + |
| 285 | + /* even channels are for TX, odd for RX */ |
| 286 | + return (chan->chan_id % 2 == 0) ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM; |
| 287 | +} |
| 288 | + |
245 | 289 | /**
|
246 | 290 | * ep93xx_dma_set_active - set new active descriptor chain
|
247 | 291 | * @edmac: channel
|
|
0 commit comments