From: Peter Ujfalusi <peter.ujfalusi@nokia.com>
To: ext Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
Cc: Jarkko Nikula <jhnikula@gmail.com>,
Tony Lindgren <tony@atomide.com>,
"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>
Subject: Re: [PATCH v9 4/4] OMAP: McBSP: Use cache when modifying individual register bits
Date: Mon, 18 Jan 2010 10:05:12 +0200 [thread overview]
Message-ID: <201001181005.12307.peter.ujfalusi@nokia.com> (raw)
In-Reply-To: <4B509B1F.2000302@tis.icnet.pl>
Hello Janusz,
On Friday 15 January 2010 18:43:11 ext Janusz Krzysztofik wrote:
> >> --- git/arch/arm/plat-omap/mcbsp.c.orig 2010-01-14 00:36:14.000000000
> >> +0100 +++ git/arch/arm/plat-omap/mcbsp.c 2010-01-14 02:05:23.000000000
> >> +0100 @@ -114,7 +114,8 @@ static irqreturn_t omap_mcbsp_tx_irq_han
> >> dev_err(mcbsp_tx->dev, "TX Frame Sync Error! : 0x%x\n",
> >> irqst_spcr2);
> >> /* Writing zero to XSYNC_ERR clears the IRQ */
> >> - MCBSP_WRITE(mcbsp_tx, SPCR2, irqst_spcr2 & ~(XSYNC_ERR));
> >> + MCBSP_WRITE(mcbsp_tx, SPCR2,
> >> + MCBSP_READ_CACHE(mcbsp_tx, SPCR2) & ~(XSYNC_ERR));
> >
> > The reg_cache will never have the XSYNC_ERR, or any other flags set,
> > since these flags has never written to the reg_cache.
> > So it is kind of not necessary to clear the flag, which is actually
> > always 0.
>
> Agree.
>
> > Another thing is that as far as I understand the reason behind of this
> > series is that you have a problem, that you can not trust on the values
> > that you read from the McBSP registers, if this is true, than the problem
> > can occur when the above path has been taken:
> >
> > ...
> > irqst_spcr2 = MCBSP_READ(mcbsp_tx, SPCR2);
> > ...
> > if (irqst_spcr2 & XSYNC_ERR) {
> >
> > But since you read from McBSP registers much rarely, than probably the
> > corruption is not that visible?
>
> Sure no software solution can correct my hardware issue in case of
> register bits manintained by the hardware itself. Well, maybe software
> that limits heat dissipation by lowering overal power consumption could
> do to some extent ;).
>
> What I'm going to address here is only a case when writing back possibly
> corrupted bits can be avoided if correct values are well known and
> can be determined without reading them back from the register itself.
Yeah, this is also my understanding, but I just did not found the right words ;)
>
> > Anyway, clearing the status/error flags are not necessary, since the
> > reg_cache will never got these bits set, you could just write back the
> > SPCR2/SPCR1 register content from the cache as it is...
> >
> >> } else {
> >> complete(&mcbsp_tx->tx_irq_completion);
> >> }
> >> @@ -134,7 +135,8 @@ static irqreturn_t omap_mcbsp_rx_irq_han
> >> dev_err(mcbsp_rx->dev, "RX Frame Sync Error! : 0x%x\n",
> >> irqst_spcr1);
> >> /* Writing zero to RSYNC_ERR clears the IRQ */
> >> - MCBSP_WRITE(mcbsp_rx, SPCR1, irqst_spcr1 & ~(RSYNC_ERR));
> >> + MCBSP_WRITE(mcbsp_rx, SPCR1,
> >> + MCBSP_READ_CACHE(mcbsp_rx, SPCR1) & ~(RSYNC_ERR));
> >
> > Same here.
> >
> > ...
> >
> >> @@ -653,7 +657,7 @@ int omap_mcbsp_pollwrite(unsigned int id
> >> if (MCBSP_READ(mcbsp, SPCR2) & XSYNC_ERR) {
> >> /* clear error */
> >> MCBSP_WRITE(mcbsp, SPCR2,
> >> - MCBSP_READ(mcbsp, SPCR2) & (~XSYNC_ERR));
> >> + MCBSP_READ_CACHE(mcbsp, SPCR2) & (~XSYNC_ERR));
> >
> > Well, I think here also, the reg_cache does not have the XSYNC_ERR set,
> > it is only set in the McBSP register.
> >
> >> /* resend */
> >> return -1;
> >> } else {
> >> @@ -662,10 +666,12 @@ int omap_mcbsp_pollwrite(unsigned int id
> >> while (!(MCBSP_READ(mcbsp, SPCR2) & XRDY)) {
> >> if (attemps++ > 1000) {
> >> MCBSP_WRITE(mcbsp, SPCR2,
> >> - MCBSP_READ(mcbsp, SPCR2) & (~XRST));
> >> + MCBSP_READ_CACHE(mcbsp, SPCR2) &
> >> + (~XRST));
> >
> > Also here, the XRST will surely not set in the cached SPCR2...
> >
> > This applies fro all other cases regarding to status/error bits in McBSP.
>
> OK, I can try to identify all those cases.
>
> What about introducing this simplification in a separate followup patch,
> quoting your rationale in its changelog? I can try to prepare one if you
> agree.
I think it is OK to have a followup patch addressing these.
Just mention in a comment, that you are writing the cached value back to the
register, which does not have these status flags set, thus clearing the reason
in McBSP.
Jarkko: What do you think?
Otherwise, I think this set is good to go.
>
> Thanks,
> Janusz
>
--
Péter
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2010-01-18 8:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-01-14 15:58 [PATCH v9 0/4] OMAP: McBSP: Use register cache Janusz Krzysztofik
2010-01-14 16:03 ` [PATCH v9 1/4] OMAP: McBSP: Use macros for all register read/write operations Janusz Krzysztofik
2010-01-14 16:07 ` [PATCH v9 2/4] OMAP: McBSP: Modify macros/functions API for easy cache access Janusz Krzysztofik
2010-01-14 16:11 ` [PATCH v9 3/4] OMAP: McBSP: Introduce caching in register write operations Janusz Krzysztofik
2010-01-14 16:13 ` [PATCH v9 4/4] OMAP: McBSP: Use cache when modifying individual register bits Janusz Krzysztofik
2010-01-15 9:11 ` Peter Ujfalusi
2010-01-15 16:43 ` Janusz Krzysztofik
2010-01-18 8:05 ` Peter Ujfalusi [this message]
2010-01-18 11:13 ` Jarkko Nikula
2010-01-15 7:42 ` [PATCH v9 0/4] OMAP: McBSP: Use register cache Jarkko Nikula
2010-01-18 8:07 ` Peter Ujfalusi
2010-02-03 19:49 ` Tony Lindgren
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=201001181005.12307.peter.ujfalusi@nokia.com \
--to=peter.ujfalusi@nokia.com \
--cc=jhnikula@gmail.com \
--cc=jkrzyszt@tis.icnet.pl \
--cc=linux-omap@vger.kernel.org \
--cc=tony@atomide.com \
/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