From: Arnd Bergmann <arnd@arndb.de>
To: Mark Brown <broonie@kernel.org>
Cc: Johannes Berg <johannes@sipsolutions.net>,
Simon Arlott <simon@fire.lp0.eu>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Revert "regmap-mmio: Use native endianness for read/write"
Date: Tue, 26 Jan 2016 00:01:25 +0100 [thread overview]
Message-ID: <15472016.EVMMrUafC6@wuerfel> (raw)
In-Reply-To: <20160125224710.GX6588@sirena.org.uk>
On Monday 25 January 2016 22:47:10 Mark Brown wrote:
> On Mon, Jan 25, 2016 at 11:24:44PM +0100, Arnd Bergmann wrote:
> > On Monday 25 January 2016 23:07:55 Johannes Berg wrote:
> > > Consequently, this commit broke my HummingBoard i.MX6 in big
> > > endian mode since it would now try to talk to the little
> > > endian hardware with a big endian CPU without conversion.
>
> What I'd expect to be happening here is that either the driver or the
> DT should be specifying the endianness of the hardware. If the device
> is always a given endianness then I'd expect that to turn up in the
> driver rather than the DT.
>
> > > What the patch really would have to do is introduce some kind
> > > of "device-endian" readl/writel, that takes the endianness of
> > > the device as an argument. That seems a bit overkill though,
> > > and would likely not generate any better code than the double
> > > byte-swaps that MIPS is getting now.
>
> The problem here is that regmap already has that functionality (it needs
> it for non-MMIO buses anyway) and so it knows what's going on really
> wants the I/O accessors to get out of the way.
I think we need to at least document the default behavior for
syscon (without changing behavior on ARM), and allow the DT to
specify cpu-endian as an override (or make MIPS default to that,
but that would be rather inconsistent and a pain to document
in the syscon binding).
> > This means that the devices are in fact CPU-endian, and we need
> > some way for Linux to represent this. The patch to
> > drivers/base/regmap/regmap-mmio.c is clearly wrong, as we
> > must never use __raw_*() accessors in an architecture independent
> > driver (for a number of reasons), but we still need a fix for
> > MIPS so it can specify a way to do the double-swap without
> > faking the endianess of the registers.
>
> I can't identify *anything* which says we shouldn't use the __raw
> accessors in architecture neutral code with the possible exception of
> the __. Seriously, how is anyone supposed to use this stuff if we have
> hidden assumptions like this?
I thought everyone knew by now.
> > Also, defaulting syscon to "native-endian" when nothing else is
> > specified sounds like a bad idea, but we may already be stuck there
> > with the precedent in existing bindings after 6a55244e897d
> > ("regmap: mmio: request native endian formatting"), we'll have
> > to think about that some more.
>
> Yeah, the native endian formatting is causing a lot of trouble. The
> MIPS folks really should also have come and talked to me rather than
> writing such obvious nonsense in the DT in the first place.
They should also have talked to me as the syscon maintainer...
Arnd
next prev parent reply other threads:[~2016-01-25 23:01 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-25 22:07 [PATCH] Revert "regmap-mmio: Use native endianness for read/write" Johannes Berg
2016-01-25 22:24 ` Arnd Bergmann
2016-01-25 22:34 ` Johannes Berg
2016-01-25 23:52 ` Mark Brown
2016-01-26 8:25 ` Johannes Berg
2016-01-26 9:09 ` Arnd Bergmann
2016-01-26 9:24 ` Johannes Berg
2016-01-26 11:36 ` Mark Brown
2016-01-26 13:16 ` Arnd Bergmann
2016-01-26 13:20 ` Johannes Berg
2016-01-26 15:23 ` Mark Brown
2016-01-26 21:29 ` Mark Brown
2016-01-26 20:05 ` Mark Brown
2016-01-26 13:07 ` Arnd Bergmann
2016-01-26 11:31 ` Mark Brown
2016-01-25 22:47 ` Mark Brown
2016-01-25 23:01 ` Arnd Bergmann [this message]
2016-01-26 11:31 ` Mark Brown
2016-01-25 22:56 ` Mark Brown
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=15472016.EVMMrUafC6@wuerfel \
--to=arnd@arndb.de \
--cc=broonie@kernel.org \
--cc=johannes@sipsolutions.net \
--cc=linux-kernel@vger.kernel.org \
--cc=simon@fire.lp0.eu \
/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.