From: Benjamin Herrenschmidt <benh@au1.ibm.com>
To: Arnd Bergmann <arnd@arndb.de>,
linuxppc-dev@lists.ozlabs.org, linux-mips@linux-mips.org
Cc: Christian Lamparter <chunkeey@googlemail.com>,
linux-usb@vger.kernel.org, johnyoun@synopsys.com,
gregkh@linuxfoundation.org, a.seppala@gmail.com,
linux-kernel@vger.kernel.org
Subject: Re: usb: dwc2: regression on MyBook Live Duo / Canyonlands since 4.3.0-rc4
Date: Tue, 10 May 2016 00:02:08 +1000 [thread overview]
Message-ID: <1462802528.20290.104.camel@au1.ibm.com> (raw)
In-Reply-To: <4162108.qmr2GZCaDN@wuerfel>
On Mon, 2016-05-09 at 12:36 +0200, Arnd Bergmann wrote:
>
> I think we can simply make this set of accessors architecture-
> dependent
> (MIPS vs. the rest of the world) to revert ARM and PowerPC back to
> the working version.
Or use writel_be which mips seems to support...
Really, make it a BE vs. LE device test is a much better solution.
For now, since dwc2_readl() and writel don't take the device as an
argument, you can make it a function of a compile time #define, or
maybe a driver global, but the right way is really something like
if (device_is_be())
return readl_be(...)
else
return readl(...)
With the device_is_be() being temporarily set to true for MIPS for
example, and later, a second pass, add the device argument and make it
a device-flag initialized from the probe routine, possibly from the DT.
Cheers,
Ben.
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
> index 3c58d633ce80..1f8ed149a40f 100644
> --- a/drivers/usb/dwc2/core.h
> +++ b/drivers/usb/dwc2/core.h
> @@ -64,12 +64,24 @@
> DWC2_TRACE_SCHEDULER_VB(pr_fmt("%s: SCH: " fmt),
> \
> dev_name(hsotg->dev), ##__VA_ARGS__)
>
> +
> +#ifdef CONFIG_MIPS
> +/*
> + * There are some MIPS machines that can run in either big-endian
> + * or little-endian mode and that use the dwc2 register without
> + * a byteswap in both ways.
> + * Unlike other architectures, MIPS does not require a barrier
> + * before the __raw_writel() to synchronize with DMA but does
> + * require the barrier after the writel() to serialize a series
> + * of writes. This set of operations was added specifically for
> + * MIPS and should only be used there.
> + */
> static inline u32 dwc2_readl(const void __iomem *addr)
> {
> u32 value = __raw_readl(addr);
>
> - /* In order to preserve endianness __raw_* operation is
> used. Therefore
> - * a barrier is needed to ensure IO access is not re-ordered
> across
> + /* in order to preserve endianness __raw_* operation is
> used. therefore
> + * a barrier is needed to ensure io access is not re-ordered
> across
> * reads or writes
> */
> mb();
> @@ -81,15 +93,32 @@ static inline void dwc2_writel(u32 value, void
> __iomem *addr)
> __raw_writel(value, addr);
>
> /*
> - * In order to preserve endianness __raw_* operation is
> used. Therefore
> - * a barrier is needed to ensure IO access is not re-ordered
> across
> + * in order to preserve endianness __raw_* operation is
> used. therefore
> + * a barrier is needed to ensure io access is not re-ordered
> across
> * reads or writes
> */
> mb();
> -#ifdef DWC2_LOG_WRITES
> - pr_info("INFO:: wrote %08x to %p\n", value, addr);
> +#ifdef dwc2_log_writes
> + pr_info("info:: wrote %08x to %p\n", value, addr);
> #endif
> }
> +#else
> +/* Normal architectures just use readl/write */
> +static inline u32 dwc2_readl(const void __iomem *addr)
> +{
> + u32 value = readl(addr);
> + return value;
> +}
> +
> +static inline void dwc2_writel(u32 value, void __iomem *addr)
> +{
> + writel(value, addr);
> +
> +#ifdef dwc2_log_writes
> + pr_info("info:: wrote %08x to %p\n", value, addr);
> +#endif
> +}
> +#endif
>
> /* Maximum number of Endpoints/HostChannels */
> #define MAX_EPS_CHANNELS 16
next prev parent reply other threads:[~2016-05-09 14:03 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <4231696.iL6nGs74X8@debian64>
[not found] ` <1462704055.20290.93.camel@au1.ibm.com>
2016-05-08 11:44 ` Christian Lamparter
2016-05-09 0:23 ` Benjamin Herrenschmidt
2016-05-09 10:36 ` Arnd Bergmann
2016-05-09 10:39 ` Felipe Balbi
2016-05-09 15:08 ` Arnd Bergmann
2016-05-09 19:06 ` Christian Lamparter
2016-05-09 20:10 ` Arnd Bergmann
2016-05-09 22:43 ` Benjamin Herrenschmidt
2016-05-09 22:37 ` Benjamin Herrenschmidt
2016-05-10 7:23 ` Arnd Bergmann
2016-05-12 9:58 ` Christian Lamparter
2016-05-12 11:55 ` Arnd Bergmann
2016-05-12 13:30 ` Christian Lamparter
2016-05-12 18:40 ` John Youn
2016-05-12 20:39 ` Christian Lamparter
2016-05-12 20:50 ` Arnd Bergmann
2016-05-12 20:55 ` John Youn
2016-05-14 13:11 ` Christian Lamparter
2016-05-14 19:45 ` Arnd Bergmann
2016-05-17 23:50 ` John Youn
2016-05-18 19:14 ` Christian Lamparter
2016-05-18 21:09 ` Arnd Bergmann
2016-05-19 0:36 ` John Youn
2016-05-12 22:17 ` Benjamin Herrenschmidt
2016-05-09 22:33 ` Benjamin Herrenschmidt
2016-05-09 14:02 ` Benjamin Herrenschmidt [this message]
2016-05-09 20:22 ` John Youn
2016-05-09 20:38 ` Arnd Bergmann
2016-05-09 21:11 ` John Youn
2016-05-09 21:30 ` Arnd Bergmann
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=1462802528.20290.104.camel@au1.ibm.com \
--to=benh@au1.ibm.com \
--cc=a.seppala@gmail.com \
--cc=arnd@arndb.de \
--cc=chunkeey@googlemail.com \
--cc=gregkh@linuxfoundation.org \
--cc=johnyoun@synopsys.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=linux-usb@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.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
all inboxes | Powered by JetHome®