From: Sergei Shtylyov <sshtylyov@mvista.com>
To: Ajay Kumar Gupta <ajay.gupta@ti.com>
Cc: linux-usb@vger.kernel.org, linux-omap@vger.kernel.org,
felipe.balbi@nokia.com
Subject: Re: [PATCH 3/3] musb: AM35x: Workaround for fifo read issue
Date: Tue, 18 May 2010 13:59:45 +0400 [thread overview]
Message-ID: <4BF26511.2060705@ru.mvista.com> (raw)
In-Reply-To: <1274093235-7616-3-git-send-email-ajay.gupta@ti.com>
Hello.
Ajay Kumar Gupta wrote:
> AM35x supports only 32bit read operations so we need to have
> workaround for 8bit and 16bit read operations.
> Signed-off-by: Ajay Kumar Gupta <ajay.gupta@ti.com>
> ---
> Patch created against linus'tree + all musb patches in Greg's queue
> Changes from v2:
> - fixed multipline comment style
> drivers/usb/musb/am3517.c | 31 +++++++++++++++++++++++++++++++
> drivers/usb/musb/musb_core.c | 2 ++
> 2 files changed, 33 insertions(+), 0 deletions(-)
> diff --git a/drivers/usb/musb/am3517.c b/drivers/usb/musb/am3517.c
> index b74e664..c68c784 100644
> --- a/drivers/usb/musb/am3517.c
> +++ b/drivers/usb/musb/am3517.c
> @@ -515,3 +515,34 @@ void musb_platform_restore_context(struct musb_context_registers
> phy_on();
> }
> #endif
> +
> +/* AM35x supports only 32bit read operation */
> +void musb_read_fifo(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)
> +{
> + void __iomem *fifo = hw_ep->fifo;
> + u32 val;
> + int i;
> +
> + /* Read for 32bit-aligned destination address */
> + if ((likely((0x03 & (unsigned long) dst) == 0)) && len >= 4) {
You don't need to put likely() in parens.
> + readsl(fifo, dst, len >> 2);
> + dst += (len & ~0x03);
You don't need parens here as well.
> + len &= 0x03;
> + }
> + /*
> + * Now read the rest 1 to 3 bytes or complete length if
> + * unaligned address.
> + */
> + if (len > 4) {
> + for (i = 0; i < (len >> 2); i++) {
> + val = musb_readl(fifo, 0);
> + memcpy(dst, &val, 4);
Can't you do away with memcpy() here?
> + dst += 4;
> + }
> + len %= 4;
> + }
> + if (len > 0) {
> + val = musb_readl(fifo, 0);
> + memcpy(dst, &val, len);
> + }
> +}
WBR, Sergei
next prev parent reply other threads:[~2010-05-18 10:00 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-17 10:47 [PATCH 1/3 v3] AM35x: Add musb support Ajay Kumar Gupta
[not found] ` <1274093235-7616-1-git-send-email-ajay.gupta-l0cyMroinI0@public.gmane.org>
2010-05-17 10:47 ` [PATCH 2/3 v3] musb: add musb support for AM35x Ajay Kumar Gupta
2010-05-17 10:47 ` [PATCH 3/3] musb: AM35x: Workaround for fifo read issue Ajay Kumar Gupta
2010-05-18 9:59 ` Sergei Shtylyov [this message]
[not found] ` <4BF26511.2060705-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
2010-05-18 10:11 ` Gupta, Ajay Kumar
2010-05-18 10:26 ` Gupta, Ajay Kumar
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=4BF26511.2060705@ru.mvista.com \
--to=sshtylyov@mvista.com \
--cc=ajay.gupta@ti.com \
--cc=felipe.balbi@nokia.com \
--cc=linux-omap@vger.kernel.org \
--cc=linux-usb@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.