From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
To: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Cc: Felipe Balbi <balbi-l0cyMroinI0@public.gmane.org>,
Kishon Vijay Abraham I <kishon-l0cyMroinI0@public.gmane.org>,
Maxime Ripard
<maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>,
Chen-Yu Tsai <wens-jdAy2FN1RRM@public.gmane.org>,
Roman Byshko <rbyshko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
devicetree <devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: [PATCH 05/15] musb: Do not use musb_read[b|w] / _write[b|w] wrappers in generic fifo functions
Date: Tue, 10 Mar 2015 09:50:44 +0100 [thread overview]
Message-ID: <11429972.krcjty7oKd@wuerfel> (raw)
In-Reply-To: <54FEA09A.6040401-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
On Tuesday 10 March 2015 08:43:22 Hans de Goede wrote:
> On 09-03-15 22:50, Arnd Bergmann wrote:
> > On Monday 09 March 2015 21:40:18 Hans de Goede wrote:
> >> The generic fifo functions already use non wrapped accesses in various
> >> cases through the iowrite#_rep functions, and all platforms which override
> >> the default musb_read[b|w] / _write[b|w] functions also provide their own
> >> fifo access functions, so we can safely drop the unnecessary indirection
> >> from the fifo access functions.
> >>
> >> Signed-off-by: Hans de Goede <hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
> >>
> >
> > The patch looks reasonably, but the description seem misleading.
> > I believe the real reason why it's ok to use __raw_writew for the
> > FIFO is that a FIFO by definition is using CPU endian access for
> > copying byte streams from memory, which is unlike any other MMIO
> > register that requires fixed-endian accessors.
>
> I'm not sure that that is the case here, this fifo allows reading
> 4 bytes at a time using 32 bit word access, so endianness may come
> into play. This patch is safe however since all existing users of
> the generic fifo_read / write helpers which this patch touches, are
> also using the generic musb_read[b|w] / _write[b|w] functions which
> are just __raw_foo wrappers, so there is no functional change, which
> is what the commit message tries to say.
This probably means that the generic musb helpers are not safe to use
on big-endian ARM systems (but may work on MIPS). The only one currently
not using the generic helpers is blackfin, which is fixed to little
endian.
> Note that sunxi needs this function because of the register address
> translation the sunxi_musb_readb / writeb wrappers are doing which
> does not know how to deal with fifo data, and besides that it should
> make the generic read / write fifo helpers somewhat faster by removing
> an indirect function call.
Your sunxi_musb_readw/writew functions however also are endian-safe
and seem to get this part right, unlike all other platforms that use
the generic __raw_*() accessors. With this patch applied, it should
actually work fine, and it would work on other platforms as well
if we change all __raw_*() calls outside of musb_default_write_fifo()
and musb_default_read_fifo() to use *_relaxed() instead.
Arnd
next prev parent reply other threads:[~2015-03-10 8:50 UTC|newest]
Thread overview: 44+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-09 20:40 [PATCH 00/15] musb: Add support for the Allwinner sunxi musb controller Hans de Goede
[not found] ` <1425933628-9672-1-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-09 20:40 ` [PATCH 01/15] ARM: sunxi: Add register bit definitions for SRAM mapping syscon Hans de Goede
2015-03-09 20:40 ` [PATCH 02/15] phy-sun4i-usb: Add a helper function to update the iscr register Hans de Goede
[not found] ` <1425933628-9672-3-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-09 21:47 ` Arnd Bergmann
2015-03-10 8:04 ` Hans de Goede
[not found] ` <54FEA59B.7020400-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-10 8:57 ` Arnd Bergmann
2015-03-10 10:13 ` Hans de Goede
[not found] ` <54FEC3DD.10108-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-10 10:53 ` Kishon Vijay Abraham I
[not found] ` <54FECD30.6080106-l0cyMroinI0@public.gmane.org>
2015-03-10 11:03 ` Hans de Goede
[not found] ` <54FECF9F.7020606-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-11 9:13 ` Kishon Vijay Abraham I
[not found] ` <55000749.9040606-l0cyMroinI0@public.gmane.org>
2015-03-11 11:39 ` Hans de Goede
[not found] ` <55002970.8090206-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-11 12:50 ` Kishon Vijay Abraham I
[not found] ` <55003A15.2070900-l0cyMroinI0@public.gmane.org>
2015-03-11 13:03 ` Hans de Goede
[not found] ` <55003D2B.60502-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-11 13:07 ` Kishon Vijay Abraham I
[not found] ` <55003E0D.9040509-l0cyMroinI0@public.gmane.org>
2015-03-11 14:44 ` Hans de Goede
2015-03-09 20:40 ` [PATCH 03/15] musb: Make musb_write_rxfun* and musb_write_rxhub* work like their tx versions Hans de Goede
2015-03-09 20:40 ` [PATCH 04/15] musb: Make busctl_offset an io-op rather then a define Hans de Goede
2015-03-09 20:40 ` [PATCH 05/15] musb: Do not use musb_read[b|w] / _write[b|w] wrappers in generic fifo functions Hans de Goede
[not found] ` <1425933628-9672-6-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-09 21:50 ` Arnd Bergmann
2015-03-10 7:43 ` Hans de Goede
[not found] ` <54FEA09A.6040401-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-10 8:50 ` Arnd Bergmann [this message]
2015-03-10 8:56 ` Hans de Goede
[not found] ` <54FEB1D4.3080700-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-10 13:43 ` Arnd Bergmann
2015-03-09 20:40 ` [PATCH 06/15] musb: Fix platform code being unable to override ep access ops Hans de Goede
2015-03-09 20:40 ` [PATCH 07/15] musb: Add support for the Allwinner sunxi musb controller Hans de Goede
2015-03-09 20:40 ` [PATCH 08/15] ARM: dts: sunxi: Add syscon node for controlling SRAM mapping Hans de Goede
2015-03-09 20:40 ` [PATCH 09/15] ARM: dts: sun4i: Add USB Dual Role Controller Hans de Goede
[not found] ` <1425933628-9672-10-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-09 23:31 ` Julian Calaby
[not found] ` <CAGRGNgVsf05rtLC2+yOPrbrPV-ceQzPC=ZX1zX+hfNxdC7OX-A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-10 9:10 ` Hans de Goede
2015-03-09 20:40 ` [PATCH 10/15] ARM: dts: sun5i: " Hans de Goede
2015-03-09 20:40 ` [PATCH 11/15] ARM: dts: sun7i: " Hans de Goede
2015-03-09 20:40 ` [PATCH 12/15] ARM: dts: sun4i: Enable USB DRC on Chuwi V7 CW0825 Hans de Goede
[not found] ` <1425933628-9672-13-git-send-email-hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-10 15:07 ` Maxime Ripard
2015-03-10 15:23 ` Hans de Goede
[not found] ` <54FF0C5D.3090706-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2015-03-10 18:17 ` Maxime Ripard
2015-03-09 20:40 ` [PATCH 13/15] ARM: dts: sun5i: Enable USB DRC on UTOO P66 Hans de Goede
2015-03-09 20:40 ` [PATCH 14/15] ARM: dts: sun7i: Enable USB DRC on Cubietruck Hans de Goede
2015-03-09 20:40 ` [PATCH 15/15] ARM: dts: sun7i: Enable USB DRC on A20-OLinuxIno-Lime Hans de Goede
2015-03-09 21:44 ` [PATCH 00/15] musb: Add support for the Allwinner sunxi musb controller Arnd Bergmann
2015-03-10 1:46 ` Chen-Yu Tsai
[not found] ` <CAGb2v67GkL9Mdr98Chf6MhMff7CO8OGgfF2kaB3Xcnz=SkMG3w-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2015-03-10 7:38 ` Hans de Goede
2015-03-10 8:31 ` Arnd Bergmann
2015-03-10 17:41 ` Maxime Ripard
2015-03-10 22:35 ` Hans de Goede
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=11429972.krcjty7oKd@wuerfel \
--to=arnd-r2ngtmty4d4@public.gmane.org \
--cc=balbi-l0cyMroinI0@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=hdegoede-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
--cc=kishon-l0cyMroinI0@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-sunxi-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
--cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=maxime.ripard-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org \
--cc=rbyshko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=wens-jdAy2FN1RRM@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