diff options
author | Rabin Vincent <rabin.vincent@stericsson.com> | 2011-01-25 05:18:33 -0500 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-01-31 01:27:21 -0500 |
commit | 7ad74a7cf6f6355fd3f4c15afe63460fc4ec3f57 (patch) | |
tree | 788adafd7e00d0ed23fac0e00416d973e2caab52 /drivers/dma | |
parent | 6045f0bb2818393a44e835454db96709cb5b3d80 (diff) |
dma40: fix DMA_SG capability and channels
The DMA_SG cap is enabled on the wrong channel, and the pointers are repeatedly
set incorrectly. Fix it and combine the ops settings to a common function.
Acked-by: Per Forlin <per.forlin@stericsson.com>
Acked-by: Jonas Aaberg <jonas.aberg@stericsson.com>
Signed-off-by: Rabin Vincent <rabin.vincent@stericsson.com>
Signed-off-by: Linus Walleij <linus.walleij@stericsson.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/dma')
-rw-r--r-- | drivers/dma/ste_dma40.c | 71 |
1 files changed, 34 insertions, 37 deletions
diff --git a/drivers/dma/ste_dma40.c b/drivers/dma/ste_dma40.c index b8cce85a9558..929fd8f45a2d 100644 --- a/drivers/dma/ste_dma40.c +++ b/drivers/dma/ste_dma40.c | |||
@@ -2238,6 +2238,32 @@ static void __init d40_chan_init(struct d40_base *base, struct dma_device *dma, | |||
2238 | } | 2238 | } |
2239 | } | 2239 | } |
2240 | 2240 | ||
2241 | static void d40_ops_init(struct d40_base *base, struct dma_device *dev) | ||
2242 | { | ||
2243 | if (dma_has_cap(DMA_SLAVE, dev->cap_mask)) | ||
2244 | dev->device_prep_slave_sg = d40_prep_slave_sg; | ||
2245 | |||
2246 | if (dma_has_cap(DMA_MEMCPY, dev->cap_mask)) { | ||
2247 | dev->device_prep_dma_memcpy = d40_prep_memcpy; | ||
2248 | |||
2249 | /* | ||
2250 | * This controller can only access address at even | ||
2251 | * 32bit boundaries, i.e. 2^2 | ||
2252 | */ | ||
2253 | dev->copy_align = 2; | ||
2254 | } | ||
2255 | |||
2256 | if (dma_has_cap(DMA_SG, dev->cap_mask)) | ||
2257 | dev->device_prep_dma_sg = d40_prep_memcpy_sg; | ||
2258 | |||
2259 | dev->device_alloc_chan_resources = d40_alloc_chan_resources; | ||
2260 | dev->device_free_chan_resources = d40_free_chan_resources; | ||
2261 | dev->device_issue_pending = d40_issue_pending; | ||
2262 | dev->device_tx_status = d40_tx_status; | ||
2263 | dev->device_control = d40_control; | ||
2264 | dev->dev = base->dev; | ||
2265 | } | ||
2266 | |||
2241 | static int __init d40_dmaengine_init(struct d40_base *base, | 2267 | static int __init d40_dmaengine_init(struct d40_base *base, |
2242 | int num_reserved_chans) | 2268 | int num_reserved_chans) |
2243 | { | 2269 | { |
@@ -2249,15 +2275,7 @@ static int __init d40_dmaengine_init(struct d40_base *base, | |||
2249 | dma_cap_zero(base->dma_slave.cap_mask); | 2275 | dma_cap_zero(base->dma_slave.cap_mask); |
2250 | dma_cap_set(DMA_SLAVE, base->dma_slave.cap_mask); | 2276 | dma_cap_set(DMA_SLAVE, base->dma_slave.cap_mask); |
2251 | 2277 | ||
2252 | base->dma_slave.device_alloc_chan_resources = d40_alloc_chan_resources; | 2278 | d40_ops_init(base, &base->dma_slave); |
2253 | base->dma_slave.device_free_chan_resources = d40_free_chan_resources; | ||
2254 | base->dma_slave.device_prep_dma_memcpy = d40_prep_memcpy; | ||
2255 | base->dma_slave.device_prep_dma_sg = d40_prep_memcpy_sg; | ||
2256 | base->dma_slave.device_prep_slave_sg = d40_prep_slave_sg; | ||
2257 | base->dma_slave.device_tx_status = d40_tx_status; | ||
2258 | base->dma_slave.device_issue_pending = d40_issue_pending; | ||
2259 | base->dma_slave.device_control = d40_control; | ||
2260 | base->dma_slave.dev = base->dev; | ||
2261 | 2279 | ||
2262 | err = dma_async_device_register(&base->dma_slave); | 2280 | err = dma_async_device_register(&base->dma_slave); |
2263 | 2281 | ||
@@ -2271,22 +2289,9 @@ static int __init d40_dmaengine_init(struct d40_base *base, | |||
2271 | 2289 | ||
2272 | dma_cap_zero(base->dma_memcpy.cap_mask); | 2290 | dma_cap_zero(base->dma_memcpy.cap_mask); |
2273 | dma_cap_set(DMA_MEMCPY, base->dma_memcpy.cap_mask); | 2291 | dma_cap_set(DMA_MEMCPY, base->dma_memcpy.cap_mask); |
2274 | dma_cap_set(DMA_SG, base->dma_slave.cap_mask); | 2292 | dma_cap_set(DMA_SG, base->dma_memcpy.cap_mask); |
2275 | 2293 | ||
2276 | base->dma_memcpy.device_alloc_chan_resources = d40_alloc_chan_resources; | 2294 | d40_ops_init(base, &base->dma_memcpy); |
2277 | base->dma_memcpy.device_free_chan_resources = d40_free_chan_resources; | ||
2278 | base->dma_memcpy.device_prep_dma_memcpy = d40_prep_memcpy; | ||
2279 | base->dma_slave.device_prep_dma_sg = d40_prep_memcpy_sg; | ||
2280 | base->dma_memcpy.device_prep_slave_sg = d40_prep_slave_sg; | ||
2281 | base->dma_memcpy.device_tx_status = d40_tx_status; | ||
2282 | base->dma_memcpy.device_issue_pending = d40_issue_pending; | ||
2283 | base->dma_memcpy.device_control = d40_control; | ||
2284 | base->dma_memcpy.dev = base->dev; | ||
2285 | /* | ||
2286 | * This controller can only access address at even | ||
2287 | * 32bit boundaries, i.e. 2^2 | ||
2288 | */ | ||
2289 | base->dma_memcpy.copy_align = 2; | ||
2290 | 2295 | ||
2291 | err = dma_async_device_register(&base->dma_memcpy); | 2296 | err = dma_async_device_register(&base->dma_memcpy); |
2292 | 2297 | ||
@@ -2302,18 +2307,10 @@ static int __init d40_dmaengine_init(struct d40_base *base, | |||
2302 | dma_cap_zero(base->dma_both.cap_mask); | 2307 | dma_cap_zero(base->dma_both.cap_mask); |
2303 | dma_cap_set(DMA_SLAVE, base->dma_both.cap_mask); | 2308 | dma_cap_set(DMA_SLAVE, base->dma_both.cap_mask); |
2304 | dma_cap_set(DMA_MEMCPY, base->dma_both.cap_mask); | 2309 | dma_cap_set(DMA_MEMCPY, base->dma_both.cap_mask); |
2305 | dma_cap_set(DMA_SG, base->dma_slave.cap_mask); | 2310 | dma_cap_set(DMA_SG, base->dma_both.cap_mask); |
2306 | 2311 | ||
2307 | base->dma_both.device_alloc_chan_resources = d40_alloc_chan_resources; | 2312 | d40_ops_init(base, &base->dma_both); |
2308 | base->dma_both.device_free_chan_resources = d40_free_chan_resources; | 2313 | |
2309 | base->dma_both.device_prep_dma_memcpy = d40_prep_memcpy; | ||
2310 | base->dma_slave.device_prep_dma_sg = d40_prep_memcpy_sg; | ||
2311 | base->dma_both.device_prep_slave_sg = d40_prep_slave_sg; | ||
2312 | base->dma_both.device_tx_status = d40_tx_status; | ||
2313 | base->dma_both.device_issue_pending = d40_issue_pending; | ||
2314 | base->dma_both.device_control = d40_control; | ||
2315 | base->dma_both.dev = base->dev; | ||
2316 | base->dma_both.copy_align = 2; | ||
2317 | err = dma_async_device_register(&base->dma_both); | 2314 | err = dma_async_device_register(&base->dma_both); |
2318 | 2315 | ||
2319 | if (err) { | 2316 | if (err) { |