Re: [PATCH] [v2] watchdog: introduce the ARM64 SBSA watchdog driver

Arnd Bergmann
2015-05-15T09:16:54Z

On Thursday 14 May 2015 18:49:17 Timur Tabi wrote:
> Guenter Roeck wrote:
> >
> > We still don't know if the registers are in host byte order or in little
> > endian
> > order. If registers are in host byte order, there is no need for a
> > conversion.
>
> Well, if I compile and boot a big-endian ARM64 kernel, then I don't
> expect the hardware devices to magically switch all their registers into
> big endian. The devices will remain little-endian.
>
> I presume that this is true on all ARM and ARM64 systems. Switching the
> CPU into big-endian mode (when it normally would run in little-endian)
> does not also switch the hardware registers.
>
> Therefore, if we want to support big-endian kernels on ARM64, then every
> readl/writel in every driver must use cpu_to_le32/etc.
>
> I think this conversation has gone off-track. I don't see how the SBSA
> watchdog device is any different from any other device on an ARM64 platform.
>
> I think it's safe to say that the endian order is not specified
> anywhere, but on my hardware, everything is little-endian.

Then please remove the double-swap. If the device works like any other
device in the system, then the byteswap that is implied by readl/writel
will do the right thing, and swapping twice will break big-endian
kernels.

Arnd