diff options
author | Russell King - ARM Linux <linux@arm.linux.org.uk> | 2011-01-03 17:39:33 -0500 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2011-01-04 22:16:12 -0500 |
commit | 4983a04fd2562986360b646b378f267308bc22c0 (patch) | |
tree | 365b9fcfe69547f27dc1593565a07ad0465bf37c /drivers/dma | |
parent | 19524d77ec34faf58d313ba34fb755ef6e159216 (diff) |
ARM: PL08x: move ccfg into txd structure
The ccfg register is used to configure the channel parameters - the type
and direction of transfer, the flow control signal and IRQ mask enables.
The type and direction of transfer is known in the relevent prep_*
function where a txd is created. The IRQ mask enables are always set,
and the flow control signals are always set when we start processing a
txd according to phychan->signal.
If we store the ccfg value in the txd structure, we can avoid modifying
platform data - and even having it in platform data at all.
So, remove it from platform data too.
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Acked-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/amba-pl08x.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/drivers/dma/amba-pl08x.c b/drivers/dma/amba-pl08x.c index a1a18bde6b7f..75f9e2d4b032 100644 --- a/drivers/dma/amba-pl08x.c +++ b/drivers/dma/amba-pl08x.c | |||
@@ -194,15 +194,11 @@ static void pl08x_start_txd(struct pl08x_dma_chan *plchan, | |||
194 | struct pl08x_driver_data *pl08x = plchan->host; | 194 | struct pl08x_driver_data *pl08x = plchan->host; |
195 | struct pl08x_phy_chan *phychan = plchan->phychan; | 195 | struct pl08x_phy_chan *phychan = plchan->phychan; |
196 | struct pl08x_lli *lli = &txd->llis_va[0]; | 196 | struct pl08x_lli *lli = &txd->llis_va[0]; |
197 | u32 val, ccfg; | 197 | u32 val, ccfg = txd->ccfg; |
198 | 198 | ||
199 | plchan->at = txd; | 199 | plchan->at = txd; |
200 | 200 | ||
201 | /* Assign the signal to the proper control registers */ | 201 | /* Assign the flow control signal to this channel */ |
202 | ccfg = plchan->cd->ccfg; | ||
203 | ccfg &= ~(PL080_CONFIG_SRC_SEL_MASK | PL080_CONFIG_DST_SEL_MASK); | ||
204 | |||
205 | /* If it wasn't set from AMBA, ignore it */ | ||
206 | if (txd->direction == DMA_TO_DEVICE) | 202 | if (txd->direction == DMA_TO_DEVICE) |
207 | /* Select signal as destination */ | 203 | /* Select signal as destination */ |
208 | ccfg |= phychan->signal << PL080_CONFIG_DST_SEL_SHIFT; | 204 | ccfg |= phychan->signal << PL080_CONFIG_DST_SEL_SHIFT; |
@@ -210,9 +206,6 @@ static void pl08x_start_txd(struct pl08x_dma_chan *plchan, | |||
210 | /* Select signal as source */ | 206 | /* Select signal as source */ |
211 | ccfg |= phychan->signal << PL080_CONFIG_SRC_SEL_SHIFT; | 207 | ccfg |= phychan->signal << PL080_CONFIG_SRC_SEL_SHIFT; |
212 | 208 | ||
213 | /* Always enable error and terminal interrupts */ | ||
214 | ccfg |= PL080_CONFIG_ERR_IRQ_MASK | PL080_CONFIG_TC_IRQ_MASK; | ||
215 | |||
216 | /* Wait for channel inactive */ | 209 | /* Wait for channel inactive */ |
217 | while (pl08x_phy_channel_busy(phychan)) | 210 | while (pl08x_phy_channel_busy(phychan)) |
218 | cpu_relax(); | 211 | cpu_relax(); |
@@ -1161,8 +1154,6 @@ static void dma_set_runtime_config(struct dma_chan *chan, | |||
1161 | enum dma_slave_buswidth addr_width; | 1154 | enum dma_slave_buswidth addr_width; |
1162 | u32 maxburst; | 1155 | u32 maxburst; |
1163 | u32 cctl = 0; | 1156 | u32 cctl = 0; |
1164 | /* Mask out all except src and dst channel */ | ||
1165 | u32 ccfg = cd->ccfg & 0x000003DEU; | ||
1166 | int i; | 1157 | int i; |
1167 | 1158 | ||
1168 | /* Transfer direction */ | 1159 | /* Transfer direction */ |
@@ -1170,13 +1161,11 @@ static void dma_set_runtime_config(struct dma_chan *chan, | |||
1170 | if (config->direction == DMA_TO_DEVICE) { | 1161 | if (config->direction == DMA_TO_DEVICE) { |
1171 | plchan->runtime_addr = config->dst_addr; | 1162 | plchan->runtime_addr = config->dst_addr; |
1172 | cctl |= PL080_CONTROL_SRC_INCR; | 1163 | cctl |= PL080_CONTROL_SRC_INCR; |
1173 | ccfg |= PL080_FLOW_MEM2PER << PL080_CONFIG_FLOW_CONTROL_SHIFT; | ||
1174 | addr_width = config->dst_addr_width; | 1164 | addr_width = config->dst_addr_width; |
1175 | maxburst = config->dst_maxburst; | 1165 | maxburst = config->dst_maxburst; |
1176 | } else if (config->direction == DMA_FROM_DEVICE) { | 1166 | } else if (config->direction == DMA_FROM_DEVICE) { |
1177 | plchan->runtime_addr = config->src_addr; | 1167 | plchan->runtime_addr = config->src_addr; |
1178 | cctl |= PL080_CONTROL_DST_INCR; | 1168 | cctl |= PL080_CONTROL_DST_INCR; |
1179 | ccfg |= PL080_FLOW_PER2MEM << PL080_CONFIG_FLOW_CONTROL_SHIFT; | ||
1180 | addr_width = config->src_addr_width; | 1169 | addr_width = config->src_addr_width; |
1181 | maxburst = config->src_maxburst; | 1170 | maxburst = config->src_maxburst; |
1182 | } else { | 1171 | } else { |
@@ -1226,16 +1215,15 @@ static void dma_set_runtime_config(struct dma_chan *chan, | |||
1226 | 1215 | ||
1227 | /* Modify the default channel data to fit PrimeCell request */ | 1216 | /* Modify the default channel data to fit PrimeCell request */ |
1228 | cd->cctl = cctl; | 1217 | cd->cctl = cctl; |
1229 | cd->ccfg = ccfg; | ||
1230 | 1218 | ||
1231 | dev_dbg(&pl08x->adev->dev, | 1219 | dev_dbg(&pl08x->adev->dev, |
1232 | "configured channel %s (%s) for %s, data width %d, " | 1220 | "configured channel %s (%s) for %s, data width %d, " |
1233 | "maxburst %d words, LE, CCTL=0x%08x, CCFG=0x%08x\n", | 1221 | "maxburst %d words, LE, CCTL=0x%08x\n", |
1234 | dma_chan_name(chan), plchan->name, | 1222 | dma_chan_name(chan), plchan->name, |
1235 | (config->direction == DMA_FROM_DEVICE) ? "RX" : "TX", | 1223 | (config->direction == DMA_FROM_DEVICE) ? "RX" : "TX", |
1236 | addr_width, | 1224 | addr_width, |
1237 | maxburst, | 1225 | maxburst, |
1238 | cctl, ccfg); | 1226 | cctl); |
1239 | } | 1227 | } |
1240 | 1228 | ||
1241 | /* | 1229 | /* |
@@ -1340,6 +1328,10 @@ static struct pl08x_txd *pl08x_get_txd(struct pl08x_dma_chan *plchan) | |||
1340 | dma_async_tx_descriptor_init(&txd->tx, &plchan->chan); | 1328 | dma_async_tx_descriptor_init(&txd->tx, &plchan->chan); |
1341 | txd->tx.tx_submit = pl08x_tx_submit; | 1329 | txd->tx.tx_submit = pl08x_tx_submit; |
1342 | INIT_LIST_HEAD(&txd->node); | 1330 | INIT_LIST_HEAD(&txd->node); |
1331 | |||
1332 | /* Always enable error and terminal interrupts */ | ||
1333 | txd->ccfg = PL080_CONFIG_ERR_IRQ_MASK | | ||
1334 | PL080_CONFIG_TC_IRQ_MASK; | ||
1343 | } | 1335 | } |
1344 | return txd; | 1336 | return txd; |
1345 | } | 1337 | } |
@@ -1369,6 +1361,8 @@ static struct dma_async_tx_descriptor *pl08x_prep_dma_memcpy( | |||
1369 | 1361 | ||
1370 | /* Set platform data for m2m */ | 1362 | /* Set platform data for m2m */ |
1371 | txd->cd = &pl08x->pd->memcpy_channel; | 1363 | txd->cd = &pl08x->pd->memcpy_channel; |
1364 | txd->ccfg |= PL080_FLOW_MEM2MEM << PL080_CONFIG_FLOW_CONTROL_SHIFT; | ||
1365 | |||
1372 | /* Both to be incremented or the code will break */ | 1366 | /* Both to be incremented or the code will break */ |
1373 | txd->cd->cctl |= PL080_CONTROL_SRC_INCR | PL080_CONTROL_DST_INCR; | 1367 | txd->cd->cctl |= PL080_CONTROL_SRC_INCR | PL080_CONTROL_DST_INCR; |
1374 | txd->len = len; | 1368 | txd->len = len; |
@@ -1424,12 +1418,14 @@ static struct dma_async_tx_descriptor *pl08x_prep_slave_sg( | |||
1424 | */ | 1418 | */ |
1425 | txd->direction = direction; | 1419 | txd->direction = direction; |
1426 | if (direction == DMA_TO_DEVICE) { | 1420 | if (direction == DMA_TO_DEVICE) { |
1421 | txd->ccfg |= PL080_FLOW_MEM2PER << PL080_CONFIG_FLOW_CONTROL_SHIFT; | ||
1427 | txd->srcbus.addr = sgl->dma_address; | 1422 | txd->srcbus.addr = sgl->dma_address; |
1428 | if (plchan->runtime_addr) | 1423 | if (plchan->runtime_addr) |
1429 | txd->dstbus.addr = plchan->runtime_addr; | 1424 | txd->dstbus.addr = plchan->runtime_addr; |
1430 | else | 1425 | else |
1431 | txd->dstbus.addr = plchan->cd->addr; | 1426 | txd->dstbus.addr = plchan->cd->addr; |
1432 | } else if (direction == DMA_FROM_DEVICE) { | 1427 | } else if (direction == DMA_FROM_DEVICE) { |
1428 | txd->ccfg |= PL080_FLOW_PER2MEM << PL080_CONFIG_FLOW_CONTROL_SHIFT; | ||
1433 | if (plchan->runtime_addr) | 1429 | if (plchan->runtime_addr) |
1434 | txd->srcbus.addr = plchan->runtime_addr; | 1430 | txd->srcbus.addr = plchan->runtime_addr; |
1435 | else | 1431 | else |