From: Tony Lindgren <tony@atomide.com>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: "Gadiyar, Anand" <gadiyar@ti.com>,
"linux-arm-kernel@lists.arm.linux.org.uk"
<linux-arm-kernel@lists.arm.linux.org.uk>,
"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>
Subject: Re: [PATCH 06/10] ARM: OMAP: Fix DMA CCR programming for request line > 63, v2
Date: Mon, 12 Jan 2009 18:40:45 +0200 [thread overview]
Message-ID: <20090112164044.GQ9373@atomide.com> (raw)
In-Reply-To: <20090112161629.GC6152@n2100.arm.linux.org.uk>
[-- Attachment #1: Type: text/plain, Size: 1843 bytes --]
* Russell King - ARM Linux <linux@arm.linux.org.uk> [090112 18:16]:
> On Mon, Jan 12, 2009 at 06:10:53PM +0200, Tony Lindgren wrote:
> > * Russell King - ARM Linux <linux@arm.linux.org.uk> [090112 18:01]:
> > > On Mon, Jan 12, 2009 at 05:35:28PM +0200, Tony Lindgren wrote:
> > > > Well at least you could remove some parens.
> > > > How about (dma_trigger / 32) << 19 instead?
> > >
> > > Oh, and further to my previous reply there is also the general principle
> > > of writing what you mean. So, if you mean to clear the least significant
> > > 5 bits, write it as a mask with ~0x1f, not as a divide.
> > >
> > > And no, you don't need ~(0x1f) - the parens there are pure noise. ~0x1f
> > > does just as well and isn't in any way confusing to the compiler.
> > > To put it another way, parens around a single value are completely
> > > meaningless.
> >
> > Here's this one with the extra parens removed.
>
> If you're concerned about useless parens, then...
>
> > diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
> > index 692d2b4..660a4eb 100644
> > --- a/arch/arm/plat-omap/dma.c
> > +++ b/arch/arm/plat-omap/dma.c
> > @@ -279,10 +279,7 @@ void omap_set_dma_transfer_params(int lch, int data_type, int elem_count,
> >
> > val = dma_read(CCR(lch));
> > val &= ~(3 << 19);
> > - if (dma_trigger > 63)
> > - val |= 1 << 20;
> > - if (dma_trigger > 31)
> > - val |= 1 << 19;
> > + val |= ((dma_trigger & ~0x1f) << 14);
> >
> > val &= ~(0x1f);
> > val |= (dma_trigger & 0x1f);
>
> should change to:
>
> val = dma_read(CCR(lch));
> val &= ~(3 << 19);
> val |= (dma_trigger & ~0x1f) << 14;
>
> val &= ~0x1f;
> val |= dma_trigger & 0x1f;
How about this? Of course the bits should be defined for
DMA_SYNCHRO_CONTROL_UPPER and DMA_SYNCHRO_CONTROL, but that may not
count as a fix..
Tony
[-- Attachment #2: dma-synchro-v3.patch --]
[-- Type: text/x-diff, Size: 1235 bytes --]
>From 80637cc6235ffcb8cd5ec4dd9a91cbd2b885d71b Mon Sep 17 00:00:00 2001
From: Anand Gadiyar <gadiyar@ti.com>
Date: Mon, 12 Jan 2009 16:01:03 +0200
Subject: [PATCH] ARM: OMAP: Fix DMA CCR programming for request line > 63, v3
Bug in existing code causes synchro control to be set +32 if request
line greater than 63 is used.
Also clean up the function a bit by removing extra parens and
clearing the bits at before write.
Reported by Wenbiao Wang.
Signed-off-by: Anand Gadiyar <gadiyar@ti.com>
Signed-off-by: Tony Lindgren <tony@atomide.com>
diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c
index 692d2b4..e77373c 100644
--- a/arch/arm/plat-omap/dma.c
+++ b/arch/arm/plat-omap/dma.c
@@ -278,14 +278,11 @@ void omap_set_dma_transfer_params(int lch, int data_type, int elem_count,
u32 val;
val = dma_read(CCR(lch));
- val &= ~(3 << 19);
- if (dma_trigger > 63)
- val |= 1 << 20;
- if (dma_trigger > 31)
- val |= 1 << 19;
-
- val &= ~(0x1f);
- val |= (dma_trigger & 0x1f);
+
+ /* DMA_SYNCHRO_CONTROL_UPPER depends on the channel number */
+ val &= ~((3 << 19) | 0x1f);
+ val |= (dma_trigger & ~0x1f) << 14;
+ val |= dma_trigger & 0x1f;
if (sync_mode & OMAP_DMA_SYNC_FRAME)
val |= 1 << 5;
next prev parent reply other threads:[~2009-01-12 16:40 UTC|newest]
Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-01-12 14:37 [PATCH 00/10] Omap fixes for 2.6.29-rc1 Tony Lindgren
2009-01-12 14:38 ` [PATCH 01/10] ARM: OMAP: Fix compile for various McBSP Tony Lindgren
2009-01-12 14:39 ` [PATCH 02/10] ARM: OMAP: Fix compile for palmte Tony Lindgren
2009-01-12 14:41 ` [PATCH 03/10] ARM: OMAP: Fix gpio by switching to generic gpio calls, v2 Tony Lindgren
2009-01-12 14:42 ` [PATCH 04/10] ARM: OMAP: Fix compile for beagle Tony Lindgren
2009-01-12 14:43 ` [PATCH 05/10] ARM: OMAP: Fix gpio.c compile on 15xx with CONFIG_DEBUGFS Tony Lindgren
2009-01-12 14:44 ` [PATCH 06/10] ARM: OMAP: Fix DMA CCR programming for request line > 63 Tony Lindgren
2009-01-12 14:59 ` Gadiyar, Anand
2009-01-12 15:35 ` Tony Lindgren
2009-01-12 15:58 ` Russell King - ARM Linux
2009-01-12 16:01 ` Russell King - ARM Linux
2009-01-12 16:10 ` [PATCH 06/10] ARM: OMAP: Fix DMA CCR programming for request line > 63, v2 Tony Lindgren
2009-01-12 16:16 ` Russell King - ARM Linux
2009-01-12 16:40 ` Tony Lindgren [this message]
2009-01-12 16:42 ` Russell King - ARM Linux
2009-01-15 12:08 ` Tony Lindgren
2009-01-12 14:46 ` [PATCH 07/10] ARM: OMAP: remove duplicated #include's Tony Lindgren
2009-01-12 14:47 ` [PATCH 08/10] ARM: OMAP: Fix OSK ASoC by registering I2C board info for tlvaic23 Tony Lindgren
2009-01-12 14:48 ` [PATCH 09/10] ARM: OMAP: Fix ASoC by enabling writes to XCCR and RCCR McBSP registers Tony Lindgren
2009-01-12 14:50 ` [PATCH 10/10] ARM: OMAP: Remove unused platform devices for old ALSA code Tony Lindgren
2009-01-15 12:11 ` Tony Lindgren
2009-01-15 13:10 ` [PATCH 10/10] ARM: OMAP: Remove unused platform devices, v3 Tony Lindgren
2009-01-15 12:13 ` [PATCH 11/10] ARM: OMAP: Fix compile for h3 MMC Tony Lindgren
2009-01-13 14:35 ` git-pull request for omap-fixes for 2.6.29-rc1 (Re: [PATCH 00/10] Omap fixes for 2.6.29-rc1) Tony Lindgren
2009-01-15 10:37 ` Russell King - ARM Linux
2009-01-15 11:13 ` David Brownell
2009-01-15 11:26 ` Tony Lindgren
2009-01-15 12:40 ` Russell King - ARM Linux
2009-01-15 13:15 ` Felipe Balbi
2009-01-15 13:34 ` Russell King - ARM Linux
2009-01-15 14:49 ` Alan Stern
2009-01-15 15:16 ` Russell King - ARM Linux
2009-01-15 13:37 ` Tony Lindgren
2009-01-15 13:49 ` Russell King - ARM Linux
2009-01-17 14:26 ` Russell King - ARM Linux
2009-01-17 20:47 ` David Brownell
2009-01-18 11:40 ` Tony Lindgren
2009-01-18 11:42 ` Russell King - ARM Linux
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=20090112164044.GQ9373@atomide.com \
--to=tony@atomide.com \
--cc=gadiyar@ti.com \
--cc=linux-arm-kernel@lists.arm.linux.org.uk \
--cc=linux-omap@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
/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