From: Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
To: Sergei Shtylyov
<sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
Cc: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>,
linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
Bin Liu <binmlist-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
Brian Hutchinson
<b.hutchman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
George Cherian <george.cherian-l0cyMroinI0@public.gmane.org>
Subject: Re: [PATCH] usb: musb: Fix fifo reads for dm816x with musb_dsps
Date: Thu, 19 Mar 2015 08:45:44 -0700 [thread overview]
Message-ID: <20150319154543.GC31346@atomide.com> (raw)
In-Reply-To: <550ACF61.5000909-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
* Sergei Shtylyov <sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org> [150319 06:30]:
> On 3/19/2015 1:48 AM, Tony Lindgren wrote:
>
> >Looks like dm81xx can only do 32-bit fifo reads like am35x. Let's set
> >up musb-dsps with a custom read_fifo function based on the compatible
> >flag.
...
> >--- a/drivers/usb/musb/musb_dsps.c
> >+++ b/drivers/usb/musb/musb_dsps.c
> >+/* Similar to am35x, dm81xx support only 32-bit read operation */
> >+static void dsps_read_fifo32(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) {
> >+ readsl(fifo, dst, len >> 2);
> >+ dst += len & ~0x03;
> >+ len &= 0x03;
> >+ }
> >+ /*
> >+ * Now read the remaining 1 to 3 byte or complete length if
> >+ * unaligned address.
> >+ */
>
> This comment seems misplaced, it belongs before the next *if*.
>
> >+ if (len > 4) {
> >+ for (i = 0; i < (len >> 2); i++) {
> >+ *(u32 *)dst = musb_readl(fifo, 0);
> >+ dst += 4;
> >+ }
>
> Not sure how this is different to using readsl().
>
> >+ len &= 0x03;
> >+ }
> >+ if (len > 0) {
> >+ val = musb_readl(fifo, 0);
> >+ memcpy(dst, &val, len);
> >+ }
> >+}
Indeed, thanks for looking at it. That function in the TI kernel probably
had something else for the 32-bit aligned case that got swapped to use
readsl().
Looks like the following works just fine for me with a USB Ethernet
and variable size ping test:
static void dsps_read_fifo32(struct musb_hw_ep *hw_ep, u16 len, u8 *dst)
{
void __iomem *fifo = hw_ep->fifo;
if (len >= 4) {
readsl(fifo, dst, len >> 2);
dst += len & ~0x03;
len &= 0x03;
}
/* Read any remaining 1 to 3 bytes */
if (len > 0) {
u32 val = musb_readl(fifo, 0);
memcpy(dst, &val, len);
}
}
Regards,
Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2015-03-19 15:45 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-18 22:48 [PATCH] usb: musb: Fix fifo reads for dm816x with musb_dsps Tony Lindgren
2015-03-19 13:30 ` Sergei Shtylyov
[not found] ` <550ACF61.5000909-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2015-03-19 15:45 ` Tony Lindgren [this message]
2015-03-19 17:49 ` Sergei Shtylyov
[not found] ` <550B0C3C.3080107-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.org>
2015-03-19 17:55 ` Tony Lindgren
2015-03-19 18:11 ` Sergei Shtylyov
[not found] ` <1426718882-27187-1-git-send-email-tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2015-04-01 21:35 ` Andrew Morton
2015-04-01 21:44 ` 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=20150319154543.GC31346@atomide.com \
--to=tony-4v6ys6ai5vpbdgjk7y7tuq@public.gmane.org \
--cc=b.hutchman-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=balbi-l0cyMroinI0@public.gmane.org \
--cc=binmlist-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=george.cherian-l0cyMroinI0@public.gmane.org \
--cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=sergei.shtylyov-M4DtvfQ/ZS1MRgGoP+s0PdBPR1lH4CV8@public.gmane.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).