public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov@mvista.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] usb: musb: only write CLRDATATOG when appropriate
Date: Tue, 10 Aug 2010 14:26:28 +0400	[thread overview]
Message-ID: <4C612954.2060207@mvista.com> (raw)
In-Reply-To: <1281380304-23544-1-git-send-email-vapier@gentoo.org>

Hello.

Mike Frysinger wrote:

> From: Bryan Wu <bryan.wu@analog.com>

> This is a change similar to what is already in the Linux driver.  We
> should only program the CLRDATATOG bit when the current mode indicates
> that it is needed.

> Signed-off-by: Bryan Wu <bryan.wu@analog.com>
> Signed-off-by: Cliff Cai <cliff.cai@analog.com>
> Signed-off-by: Mike Frysinger <vapier@gentoo.org>
> ---
> Note: can someone give this a spin on a non-Blackfin platform to make
>       sure this doesn't break things ?

>  drivers/usb/musb/musb_hcd.c |   23 ++++++++++++++++-------
>  1 files changed, 16 insertions(+), 7 deletions(-)

> diff --git a/drivers/usb/musb/musb_hcd.c b/drivers/usb/musb/musb_hcd.c
> index dd2aa7f..dd66275 100644
> --- a/drivers/usb/musb/musb_hcd.c
> +++ b/drivers/usb/musb/musb_hcd.c
> @@ -144,19 +144,28 @@ static void write_toggle(struct usb_device *dev, u8 ep, u8 dir_out)
>  	u16 csr;
>  
>  	if (dir_out) {
> -		if (!toggle)
> -			writew(MUSB_TXCSR_CLRDATATOG, &musbr->txcsr);
> -		else {
> -			csr = readw(&musbr->txcsr);
> +		csr = readw(&musbr->txcsr);
> +		if (!toggle) {
> +			if (csr & MUSB_TXCSR_MODE)
> +				csr = MUSB_TXCSR_CLRDATATOG;
> +			else
> +				csr = 0;
> +			writew(csr, &musbr->txcsr);
> +		} else {
>  			csr |= MUSB_TXCSR_H_WR_DATATOGGLE;
>  			writew(csr, &musbr->txcsr);
>  			csr |= (toggle << MUSB_TXCSR_H_DATATOGGLE_SHIFT);
>  			writew(csr, &musbr->txcsr);
>  		}
>  	} else {
> -		if (!toggle)
> -			writew(MUSB_RXCSR_CLRDATATOG, &musbr->rxcsr);
> -		else {
> +		if (!toggle) {
> +			csr = readw(&musbr->txcsr);
> +			if (csr & MUSB_TXCSR_MODE)
> +				csr = MUSB_RXCSR_CLRDATATOG;

    Clearing RXCSR when FIFO is in TX mode?

> +			else
> +				csr = 0;
> +			writew(csr, &musbr->rxcsr);
> +		} else {
>  			csr = readw(&musbr->rxcsr);
>  			csr |= MUSB_RXCSR_H_WR_DATATOGGLE;
>  			writew(csr, &musbr->rxcsr);

WBR, Sergei

  reply	other threads:[~2010-08-10 10:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-09 18:58 [U-Boot] [PATCH] usb: musb: only write CLRDATATOG when appropriate Mike Frysinger
2010-08-10 10:26 ` Sergei Shtylyov [this message]
2010-08-10 20:37   ` Mike Frysinger
2010-08-12 18:04     ` Remy Bohmer
2010-08-12 19:43       ` Mike Frysinger
2010-08-13 10:25       ` Sergei Shtylyov
2010-10-11  8:47         ` Mike Frysinger
2010-10-13 10:12           ` Remy Bohmer
2010-08-12 18:08 ` Remy Bohmer
2010-08-12 19:42   ` Mike Frysinger

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=4C612954.2060207@mvista.com \
    --to=sshtylyov@mvista.com \
    --cc=u-boot@lists.denx.de \
    /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