Re: [PATCH] Revert "regmap-mmio: Use native endianness for read/write"

From: Mark Brown
Date: Tue Jan 26 2016 - 06:31:26 EST


On Tue, Jan 26, 2016 at 10:09:35AM +0100, Arnd Bergmann wrote:

> * On 32-bit architectures, you generally cannot do 64-bit atomic I/O
> operations, and we have two implementations that do it nonatomically,
> depending on how a device is wired to the bus, see
> include/linux/io-64-nonatomic-{hi-lo,lo-hi}.h.
> I think we should just not go there for regmap unless we absolutely
> have to.

That's fine, we don't support 64 bit MMIO regmaps on 32 bit systems
anyway (they're ifdefed out and will generate an error if you try to use
them). If someone wants that functionality they can sort it out.

> However, we have some freedom at the regmap-mmio level, which we can
> sanitize in 4.6 if we want to make it more consistent with the rest
> of regmap. We have around 50 callers of {devm_,}regmap_init_mmio()
> and almost all of them do not specify endianess but expect little-endian
> behavior. We can change all existing instances to set REGMAP_ENDIAN_NATIVE
> explicitly and change regmap_init_mmio() to return an error if the
> caller does not specify a particular endianess (big, little, native).

As far as I can tell almost all the users actually want little endian
(everyone except these MIPS users) so if we're going to go through and
change all the users we should be going for that. Given that things
just won't work if they have the wrong endianness I'm reasonably
comfortable with keeping a default in the core - so long as the core is
explicit about what it's doing so unlikely to get confused I think we
are reasonably safe.

> This is a tradeoff between interface simplicity (defaulting to LE is
> convenient for most people) and consistency (all other regmap interfaces
> default to native if I understood Mark right).

All other regmaps default to either native or big endian (native for
things with explicit read and write operations, big for byte stream
buses).

Attachment: signature.asc
Description: PGP signature