Commit e659587c authored by Russell King's avatar Russell King

ARM: riscpc: dma: improve address/length writing

Rearrange writing the DMA addresses to generate more efficient code.
Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
parent 39694ed0
...@@ -100,7 +100,7 @@ static irqreturn_t iomd_dma_handle(int irq, void *dev_id) ...@@ -100,7 +100,7 @@ static irqreturn_t iomd_dma_handle(int irq, void *dev_id)
struct iomd_dma *idma = dev_id; struct iomd_dma *idma = dev_id;
unsigned long base = idma->base; unsigned long base = idma->base;
unsigned int state = idma->state; unsigned int state = idma->state;
unsigned int status; unsigned int status, cur, end;
do { do {
status = iomd_readb(base + ST); status = iomd_readb(base + ST);
...@@ -110,21 +110,17 @@ static irqreturn_t iomd_dma_handle(int irq, void *dev_id) ...@@ -110,21 +110,17 @@ static irqreturn_t iomd_dma_handle(int irq, void *dev_id)
if ((state ^ status) & DMA_ST_AB) if ((state ^ status) & DMA_ST_AB)
iomd_get_next_sg(idma); iomd_get_next_sg(idma);
switch (status & (DMA_ST_OFL | DMA_ST_AB)) { // This efficiently implements state = OFL != AB ? AB : 0
case DMA_ST_OFL: /* OIA */ state = ((status >> 2) ^ status) & DMA_ST_AB;
case DMA_ST_AB: /* .IB */ if (state) {
iomd_writel(idma->cur_addr, base + CURA); cur = CURA;
iomd_writel(idma->cur_len, base + ENDA); end = ENDA;
state = DMA_ST_AB; } else {
break; cur = CURB;
end = ENDB;
case DMA_ST_OFL | DMA_ST_AB: /* OIB */
case 0: /* .IA */
iomd_writel(idma->cur_addr, base + CURB);
iomd_writel(idma->cur_len, base + ENDB);
state = 0;
break;
} }
iomd_writel(idma->cur_addr, base + cur);
iomd_writel(idma->cur_len, base + end);
if (status & DMA_ST_OFL && if (status & DMA_ST_OFL &&
idma->cur_len == (DMA_END_S|DMA_END_L)) idma->cur_len == (DMA_END_S|DMA_END_L))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment