diff options
author | Mika Westerberg <mika.westerberg@iki.fi> | 2011-05-29 06:10:02 -0400 |
---|---|---|
committer | Grant Likely <grant.likely@secretlab.ca> | 2011-06-08 17:10:44 -0400 |
commit | 760ee1c4aafac8fcaf3be5ff2b19c5485c5886e1 (patch) | |
tree | fc8408001ecba7a7b575f8fa839fcc6989f852bb /arch | |
parent | b6336ca2982ccac98d9d017426c53ff1e13c017f (diff) |
dmaengine: add ep93xx DMA support
The ep93xx DMA controller has 10 independent memory to peripheral (M2P)
channels, and 2 dedicated memory to memory (M2M) channels. M2M channels can
also be used by SPI and IDE to perform DMA transfers to/from their memory
mapped FIFOs.
This driver supports both M2P and M2M channels with DMA_SLAVE, DMA_CYCLIC and
DMA_MEMCPY (M2M only) capabilities.
Signed-off-by: Mika Westerberg <mika.westerberg@iki.fi>
Signed-off-by: Ryan Mallon <rmallon@gmail.com>
Acked-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Acked-by: Vinod Koul <vinod.koul@intel.com>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-ep93xx/include/mach/dma.h | 87 |
1 files changed, 87 insertions, 0 deletions
diff --git a/arch/arm/mach-ep93xx/include/mach/dma.h b/arch/arm/mach-ep93xx/include/mach/dma.h index 5e31b2b25da..6e7049a796a 100644 --- a/arch/arm/mach-ep93xx/include/mach/dma.h +++ b/arch/arm/mach-ep93xx/include/mach/dma.h | |||
@@ -15,6 +15,8 @@ | |||
15 | 15 | ||
16 | #include <linux/list.h> | 16 | #include <linux/list.h> |
17 | #include <linux/types.h> | 17 | #include <linux/types.h> |
18 | #include <linux/dmaengine.h> | ||
19 | #include <linux/dma-mapping.h> | ||
18 | 20 | ||
19 | /** | 21 | /** |
20 | * struct ep93xx_dma_buffer - Information about a buffer to be transferred | 22 | * struct ep93xx_dma_buffer - Information about a buffer to be transferred |
@@ -146,4 +148,89 @@ void ep93xx_dma_m2p_submit_recursive(struct ep93xx_dma_m2p_client *m2p, | |||
146 | */ | 148 | */ |
147 | void ep93xx_dma_m2p_flush(struct ep93xx_dma_m2p_client *m2p); | 149 | void ep93xx_dma_m2p_flush(struct ep93xx_dma_m2p_client *m2p); |
148 | 150 | ||
151 | /* | ||
152 | * M2P channels. | ||
153 | * | ||
154 | * Note that these values are also directly used for setting the PPALLOC | ||
155 | * register. | ||
156 | */ | ||
157 | #define EP93XX_DMA_I2S1 0 | ||
158 | #define EP93XX_DMA_I2S2 1 | ||
159 | #define EP93XX_DMA_AAC1 2 | ||
160 | #define EP93XX_DMA_AAC2 3 | ||
161 | #define EP93XX_DMA_AAC3 4 | ||
162 | #define EP93XX_DMA_I2S3 5 | ||
163 | #define EP93XX_DMA_UART1 6 | ||
164 | #define EP93XX_DMA_UART2 7 | ||
165 | #define EP93XX_DMA_UART3 8 | ||
166 | #define EP93XX_DMA_IRDA 9 | ||
167 | /* M2M channels */ | ||
168 | #define EP93XX_DMA_SSP 10 | ||
169 | #define EP93XX_DMA_IDE 11 | ||
170 | |||
171 | /** | ||
172 | * struct ep93xx_dma_data - configuration data for the EP93xx dmaengine | ||
173 | * @port: peripheral which is requesting the channel | ||
174 | * @direction: TX/RX channel | ||
175 | * @name: optional name for the channel, this is displayed in /proc/interrupts | ||
176 | * | ||
177 | * This information is passed as private channel parameter in a filter | ||
178 | * function. Note that this is only needed for slave/cyclic channels. For | ||
179 | * memcpy channels %NULL data should be passed. | ||
180 | */ | ||
181 | struct ep93xx_dma_data { | ||
182 | int port; | ||
183 | enum dma_data_direction direction; | ||
184 | const char *name; | ||
185 | }; | ||
186 | |||
187 | /** | ||
188 | * struct ep93xx_dma_chan_data - platform specific data for a DMA channel | ||
189 | * @name: name of the channel, used for getting the right clock for the channel | ||
190 | * @base: mapped registers | ||
191 | * @irq: interrupt number used by this channel | ||
192 | */ | ||
193 | struct ep93xx_dma_chan_data { | ||
194 | const char *name; | ||
195 | void __iomem *base; | ||
196 | int irq; | ||
197 | }; | ||
198 | |||
199 | /** | ||
200 | * struct ep93xx_dma_platform_data - platform data for the dmaengine driver | ||
201 | * @channels: array of channels which are passed to the driver | ||
202 | * @num_channels: number of channels in the array | ||
203 | * | ||
204 | * This structure is passed to the DMA engine driver via platform data. For | ||
205 | * M2P channels, contract is that even channels are for TX and odd for RX. | ||
206 | * There is no requirement for the M2M channels. | ||
207 | */ | ||
208 | struct ep93xx_dma_platform_data { | ||
209 | struct ep93xx_dma_chan_data *channels; | ||
210 | size_t num_channels; | ||
211 | }; | ||
212 | |||
213 | static inline bool ep93xx_dma_chan_is_m2p(struct dma_chan *chan) | ||
214 | { | ||
215 | return !strcmp(dev_name(chan->device->dev), "ep93xx-dma-m2p"); | ||
216 | } | ||
217 | |||
218 | /** | ||
219 | * ep93xx_dma_chan_direction - returns direction the channel can be used | ||
220 | * @chan: channel | ||
221 | * | ||
222 | * This function can be used in filter functions to find out whether the | ||
223 | * channel supports given DMA direction. Only M2P channels have such | ||
224 | * limitation, for M2M channels the direction is configurable. | ||
225 | */ | ||
226 | static inline enum dma_data_direction | ||
227 | ep93xx_dma_chan_direction(struct dma_chan *chan) | ||
228 | { | ||
229 | if (!ep93xx_dma_chan_is_m2p(chan)) | ||
230 | return DMA_NONE; | ||
231 | |||
232 | /* even channels are for TX, odd for RX */ | ||
233 | return (chan->chan_id % 2 == 0) ? DMA_TO_DEVICE : DMA_FROM_DEVICE; | ||
234 | } | ||
235 | |||
149 | #endif /* __ASM_ARCH_DMA_H */ | 236 | #endif /* __ASM_ARCH_DMA_H */ |