From: Russell King <rmk+kernel@armlinux.org.uk>
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 7/8] ARM: riscpc: dma: improve address/length writing
Date: Mon, 20 May 2019 15:47:24 +0100 [thread overview]
Message-ID: <E1hSjZU-0000YU-Oa@rmk-PC.armlinux.org.uk> (raw)
In-Reply-To: <20190520144615.gzrztyhoncyfc5xr@shell.armlinux.org.uk>
Rearrange writing the DMA addresses to generate more efficient code.
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
---
arch/arm/mach-rpc/dma.c | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/arch/arm/mach-rpc/dma.c b/arch/arm/mach-rpc/dma.c
index e2b9c95d853b..6140472d148e 100644
--- a/arch/arm/mach-rpc/dma.c
+++ b/arch/arm/mach-rpc/dma.c
@@ -100,7 +100,7 @@ static irqreturn_t iomd_dma_handle(int irq, void *dev_id)
struct iomd_dma *idma = dev_id;
unsigned long base = idma->base;
unsigned int state = idma->state;
- unsigned int status;
+ unsigned int status, cur, end;
do {
status = iomd_readb(base + ST);
@@ -110,21 +110,17 @@ static irqreturn_t iomd_dma_handle(int irq, void *dev_id)
if ((state ^ status) & DMA_ST_AB)
iomd_get_next_sg(idma);
- switch (status & (DMA_ST_OFL | DMA_ST_AB)) {
- case DMA_ST_OFL: /* OIA */
- case DMA_ST_AB: /* .IB */
- iomd_writel(idma->cur_addr, base + CURA);
- iomd_writel(idma->cur_len, base + ENDA);
- state = DMA_ST_AB;
- break;
-
- 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;
+ // This efficiently implements state = OFL != AB ? AB : 0
+ state = ((status >> 2) ^ status) & DMA_ST_AB;
+ if (state) {
+ cur = CURA;
+ end = ENDA;
+ } else {
+ cur = CURB;
+ end = ENDB;
}
+ iomd_writel(idma->cur_addr, base + cur);
+ iomd_writel(idma->cur_len, base + end);
if (status & DMA_ST_OFL &&
idma->cur_len == (DMA_END_S|DMA_END_L))
--
2.7.4
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2019-05-20 14:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-20 14:46 [PATCH 0/8] Resurect RiscPC support Russell King - ARM Linux admin
2019-05-20 14:46 ` [PATCH 1/8] ARM: riscpc: replace gettimeoffset() with clocksource Russell King
2019-05-20 14:46 ` [PATCH 2/8] ARM: riscpc: fix lack of keyboard interrupts after irq conversion Russell King
2019-05-20 14:47 ` [PATCH 3/8] ARM: riscpc: fix ecard printing Russell King
2019-05-20 14:47 ` [PATCH 4/8] ARM: riscpc: fix DMA Russell King
2019-05-20 14:47 ` [PATCH 5/8] ARM: riscpc: dma: eliminate "cur_sg" scatterlist usage Russell King
2019-05-20 14:47 ` [PATCH 6/8] ARM: riscpc: dma: make state a local variable Russell King
2019-05-20 14:47 ` Russell King [this message]
2019-05-20 14:47 ` [PATCH 8/8] ARM: riscpc: dma: use __iomem pointers for writing DMA Russell King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=E1hSjZU-0000YU-Oa@rmk-PC.armlinux.org.uk \
--to=rmk+kernel@armlinux.org.uk \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).