aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRussell King <rmk+kernel@arm.linux.org.uk>2013-11-02 14:51:53 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2014-04-03 19:27:56 -0400
commit2f0d13bdf6440906bb52fe94681ce7927145f4d7 (patch)
tree6048da12ca54c4086d9ca0bffda4de6bbf319acc
parent3997cab391b38e126f217e36ad7bdc9672c9fb4d (diff)
dmaengine: omap-dma: consolidate setup of CSDP
Consolidate the setup of the channel source destination parameters register. This way, we calculate the required CSDP value when we setup a transfer descriptor, and only write it to the device registers once when we start the descriptor. Acked-by: Tony Lindgren <tony@atomide.com> Acked-by: Vinod Koul <vinod.koul@intel.com> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
-rw-r--r--drivers/dma/omap-dma.c64
1 files changed, 28 insertions, 36 deletions
diff --git a/drivers/dma/omap-dma.c b/drivers/dma/omap-dma.c
index 323eae2c9d08..ec7cc10d4594 100644
--- a/drivers/dma/omap-dma.c
+++ b/drivers/dma/omap-dma.c
@@ -60,8 +60,8 @@ struct omap_desc {
60 uint8_t es; /* OMAP_DMA_DATA_TYPE_xxx */ 60 uint8_t es; /* OMAP_DMA_DATA_TYPE_xxx */
61 uint8_t sync_mode; /* OMAP_DMA_SYNC_xxx */ 61 uint8_t sync_mode; /* OMAP_DMA_SYNC_xxx */
62 uint8_t sync_type; /* OMAP_DMA_xxx_SYNC* */ 62 uint8_t sync_type; /* OMAP_DMA_xxx_SYNC* */
63 uint8_t periph_port; /* Peripheral port */
64 uint16_t cicr; /* CICR value */ 63 uint16_t cicr; /* CICR value */
64 uint32_t csdp; /* CSDP value */
65 65
66 unsigned sglen; 66 unsigned sglen;
67 struct omap_sg sg[0]; 67 struct omap_sg sg[0];
@@ -240,14 +240,6 @@ static void omap_dma_start_desc(struct omap_chan *c)
240 c->sgidx = 0; 240 c->sgidx = 0;
241 241
242 if (d->dir == DMA_DEV_TO_MEM) { 242 if (d->dir == DMA_DEV_TO_MEM) {
243 if (dma_omap1()) {
244 val = c->plat->dma_read(CSDP, c->dma_ch);
245 val &= ~(0x1f << 9 | 0x1f << 2);
246 val |= OMAP_DMA_PORT_EMIFF << 9;
247 val |= d->periph_port << 2;
248 c->plat->dma_write(val, CSDP, c->dma_ch);
249 }
250
251 val = c->plat->dma_read(CCR, c->dma_ch); 243 val = c->plat->dma_read(CCR, c->dma_ch);
252 val &= ~(0x03 << 14 | 0x03 << 12); 244 val &= ~(0x03 << 14 | 0x03 << 12);
253 val |= OMAP_DMA_AMODE_POST_INC << 14; 245 val |= OMAP_DMA_AMODE_POST_INC << 14;
@@ -258,14 +250,6 @@ static void omap_dma_start_desc(struct omap_chan *c)
258 c->plat->dma_write(0, CSEI, c->dma_ch); 250 c->plat->dma_write(0, CSEI, c->dma_ch);
259 c->plat->dma_write(d->fi, CSFI, c->dma_ch); 251 c->plat->dma_write(d->fi, CSFI, c->dma_ch);
260 } else { 252 } else {
261 if (dma_omap1()) {
262 val = c->plat->dma_read(CSDP, c->dma_ch);
263 val &= ~(0x1f << 9 | 0x1f << 2);
264 val |= d->periph_port << 9;
265 val |= OMAP_DMA_PORT_EMIFF << 2;
266 c->plat->dma_write(val, CSDP, c->dma_ch);
267 }
268
269 val = c->plat->dma_read(CCR, c->dma_ch); 253 val = c->plat->dma_read(CCR, c->dma_ch);
270 val &= ~(0x03 << 12 | 0x03 << 14); 254 val &= ~(0x03 << 12 | 0x03 << 14);
271 val |= OMAP_DMA_AMODE_CONSTANT << 14; 255 val |= OMAP_DMA_AMODE_CONSTANT << 14;
@@ -277,10 +261,7 @@ static void omap_dma_start_desc(struct omap_chan *c)
277 c->plat->dma_write(d->fi, CDFI, c->dma_ch); 261 c->plat->dma_write(d->fi, CDFI, c->dma_ch);
278 } 262 }
279 263
280 val = c->plat->dma_read(CSDP, c->dma_ch); 264 c->plat->dma_write(d->csdp, CSDP, c->dma_ch);
281 val &= ~0x03;
282 val |= d->es;
283 c->plat->dma_write(val, CSDP, c->dma_ch);
284 265
285 if (dma_omap1()) { 266 if (dma_omap1()) {
286 val = c->plat->dma_read(CCR, c->dma_ch); 267 val = c->plat->dma_read(CCR, c->dma_ch);
@@ -602,13 +583,21 @@ static struct dma_async_tx_descriptor *omap_dma_prep_slave_sg(
602 d->es = es; 583 d->es = es;
603 d->sync_mode = OMAP_DMA_SYNC_FRAME; 584 d->sync_mode = OMAP_DMA_SYNC_FRAME;
604 d->sync_type = sync_type; 585 d->sync_type = sync_type;
605 d->periph_port = OMAP_DMA_PORT_TIPB;
606 d->cicr = OMAP_DMA_DROP_IRQ | OMAP_DMA_BLOCK_IRQ; 586 d->cicr = OMAP_DMA_DROP_IRQ | OMAP_DMA_BLOCK_IRQ;
587 d->csdp = es;
607 588
608 if (dma_omap1()) 589 if (dma_omap1()) {
609 d->cicr |= OMAP1_DMA_TOUT_IRQ; 590 d->cicr |= OMAP1_DMA_TOUT_IRQ;
610 else 591
592 if (dir == DMA_DEV_TO_MEM)
593 d->csdp |= OMAP_DMA_PORT_EMIFF << 9 |
594 OMAP_DMA_PORT_TIPB << 2;
595 else
596 d->csdp |= OMAP_DMA_PORT_TIPB << 9 |
597 OMAP_DMA_PORT_EMIFF << 2;
598 } else {
611 d->cicr |= OMAP2_DMA_MISALIGNED_ERR_IRQ | OMAP2_DMA_TRANS_ERR_IRQ; 599 d->cicr |= OMAP2_DMA_MISALIGNED_ERR_IRQ | OMAP2_DMA_TRANS_ERR_IRQ;
600 }
612 601
613 /* 602 /*
614 * Build our scatterlist entries: each contains the address, 603 * Build our scatterlist entries: each contains the address,
@@ -690,7 +679,6 @@ static struct dma_async_tx_descriptor *omap_dma_prep_dma_cyclic(
690 else 679 else
691 d->sync_mode = OMAP_DMA_SYNC_ELEMENT; 680 d->sync_mode = OMAP_DMA_SYNC_ELEMENT;
692 d->sync_type = sync_type; 681 d->sync_type = sync_type;
693 d->periph_port = OMAP_DMA_PORT_MPUI;
694 d->sg[0].addr = buf_addr; 682 d->sg[0].addr = buf_addr;
695 d->sg[0].en = period_len / es_bytes[es]; 683 d->sg[0].en = period_len / es_bytes[es];
696 d->sg[0].fn = buf_len / period_len; 684 d->sg[0].fn = buf_len / period_len;
@@ -699,11 +687,24 @@ static struct dma_async_tx_descriptor *omap_dma_prep_dma_cyclic(
699 if (flags & DMA_PREP_INTERRUPT) 687 if (flags & DMA_PREP_INTERRUPT)
700 d->cicr |= OMAP_DMA_FRAME_IRQ; 688 d->cicr |= OMAP_DMA_FRAME_IRQ;
701 689
702 if (dma_omap1()) 690 d->csdp = es;
691
692 if (dma_omap1()) {
703 d->cicr |= OMAP1_DMA_TOUT_IRQ; 693 d->cicr |= OMAP1_DMA_TOUT_IRQ;
704 else 694
695 if (dir == DMA_DEV_TO_MEM)
696 d->csdp |= OMAP_DMA_PORT_EMIFF << 9 |
697 OMAP_DMA_PORT_MPUI << 2;
698 else
699 d->csdp |= OMAP_DMA_PORT_MPUI << 9 |
700 OMAP_DMA_PORT_EMIFF << 2;
701 } else {
705 d->cicr |= OMAP2_DMA_MISALIGNED_ERR_IRQ | OMAP2_DMA_TRANS_ERR_IRQ; 702 d->cicr |= OMAP2_DMA_MISALIGNED_ERR_IRQ | OMAP2_DMA_TRANS_ERR_IRQ;
706 703
704 /* src and dst burst mode 16 */
705 d->csdp |= 3 << 14 | 3 << 7;
706 }
707
707 if (!c->cyclic) { 708 if (!c->cyclic) {
708 c->cyclic = true; 709 c->cyclic = true;
709 710
@@ -716,15 +717,6 @@ static struct dma_async_tx_descriptor *omap_dma_prep_dma_cyclic(
716 } 717 }
717 } 718 }
718 719
719 if (dma_omap2plus()) {
720 uint32_t val;
721
722 val = c->plat->dma_read(CSDP, c->dma_ch);
723 val |= 0x03 << 7; /* src burst mode 16 */
724 val |= 0x03 << 14; /* dst burst mode 16 */
725 c->plat->dma_write(val, CSDP, c->dma_ch);
726 }
727
728 return vchan_tx_prep(&c->vc, &d->vd, flags); 720 return vchan_tx_prep(&c->vc, &d->vd, flags);
729} 721}
730 722