1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
From nobody Mon Sep 17 00:00:00 2001
From: Haavard Skinnemoen <hskinnemoen@atmel.com>
Date: Sun, 14 Jan 2007 19:07:06 +0100
Subject: [DW DMAC] Add nr_blocks field to struct dma_request_sg
Allow drivers to specify how many blocks to transfer in a sg request.
The number of blocks will no longer be automatically calculated based
on the scatterlist because this doesn't always correspond with the
desired amount of data to be transferred.
Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
---
arch/avr32/drivers/dw-dmac.c | 13 ++++++-------
include/asm-avr32/dma-controller.h | 1 +
2 files changed, 7 insertions(+), 7 deletions(-)
Index: linux-2.6.18-avr32/include/asm-avr32/dma-controller.h
===================================================================
--- linux-2.6.18-avr32.orig/include/asm-avr32/dma-controller.h 2007-01-15 15:34:32.000000000 +0100
+++ linux-2.6.18-avr32/include/asm-avr32/dma-controller.h 2007-01-15 15:34:50.000000000 +0100
@@ -36,6 +36,7 @@ struct dma_request_sg {
int nr_sg;
struct scatterlist *sg;
unsigned long block_size;
+ unsigned int nr_blocks;
dma_addr_t data_reg;
unsigned short periph_id;
Index: linux-2.6.18-avr32/arch/avr32/drivers/dw-dmac.c
===================================================================
--- linux-2.6.18-avr32.orig/arch/avr32/drivers/dw-dmac.c 2007-01-15 15:35:00.000000000 +0100
+++ linux-2.6.18-avr32/arch/avr32/drivers/dw-dmac.c 2007-01-15 15:35:03.000000000 +0100
@@ -176,7 +176,8 @@ static int dmac_prepare_request_sg(struc
struct dw_dma_channel *chan;
unsigned long ctlhi, ctllo, cfghi, cfglo;
unsigned long block_size;
- int ret, i, nr_blocks, direction;
+ unsigned int nr_blocks;
+ int ret, i, direction;
unsigned long flags;
spin_lock_irqsave(&dmac->lock, flags);
@@ -215,12 +216,9 @@ static int dmac_prepare_request_sg(struc
* Each block will get its own Linked List Item (LLI) below.
*/
block_size = req->block_size;
- pr_debug("block_size = %lu, nr_sg = %u\n", block_size, req->nr_sg);
- for (i = 0, nr_blocks = 0; i < req->nr_sg; i++) {
- pr_debug("sg[i].length = %u\n", req->sg[i].length);
- BUG_ON(req->sg[i].length % block_size);
- nr_blocks += req->sg[i].length / block_size;
- }
+ nr_blocks = req->nr_blocks;
+ pr_debug("block_size %lu, nr_blocks %u nr_sg = %u\n",
+ block_size, nr_blocks, req->nr_sg);
BUG_ON(nr_blocks == 0);
chan->nr_blocks = nr_blocks;
@@ -269,6 +267,7 @@ static int dmac_prepare_request_sg(struc
}
dmac_chan_writel_lo(dmac, req->req.channel, CTL, ctllo);
dmac_chan_writel_hi(dmac, req->req.channel, CTL, ctlhi);
+ pr_debug("ctl hi:lo 0x%lx:%lx\n", ctlhi, ctllo);
} else {
struct dw_dma_lli *lli, *lli_prev = NULL;
int j = 0, offset = 0;
|