Re: [PATCH v2] net: fec: make driver endian-safe

2016-01-25 Thread David Miller
From: Johannes Berg Date: Sun, 24 Jan 2016 16:52:37 +0100 > The driver treats the device descriptors as CPU-endian, which appears > to be correct with the default endianness on both ARM (typically LE) > and PowerPC (typically BE) SoCs, indicating that the hardware

Re: [PATCH v2] net: fec: make driver endian-safe

2016-01-24 Thread Greg Ungerer
Hi Johannes, On 25/01/16 01:52, Johannes Berg wrote: > The driver treats the device descriptors as CPU-endian, which appears > to be correct with the default endianness on both ARM (typically LE) > and PowerPC (typically BE) SoCs, indicating that the hardware block > is generated differently. Add

Re: [PATCH v2] net: fec: make driver endian-safe

2016-01-24 Thread Johannes Berg
On Mon, 2016-01-25 at 10:52 +1000, Greg Ungerer wrote: >  > I tested this on a ColdFire (5208) target that uses this driver. > Simple testing showed it working with no problems. The ColdFire > SoC processors use a version of the FEC hardware module, and they > always run big-endian. > Great,

[PATCH v2] net: fec: make driver endian-safe

2016-01-24 Thread Johannes Berg
The driver treats the device descriptors as CPU-endian, which appears to be correct with the default endianness on both ARM (typically LE) and PowerPC (typically BE) SoCs, indicating that the hardware block is generated differently. Add endianness annotations and byteswaps as necessary. It's not

Re: [PATCH v2] net: fec: make driver endian-safe

2016-01-24 Thread Arnd Bergmann
On Sunday 24 January 2016 16:52:37 Johannes Berg wrote: > It's not clear that the ifdef there really is correct and shouldn't > just be #ifdef CONFIG_ARM, but I also can't test on anything but the > i.MX6 HummingBoard where this gets it working with a BE kernel. > > Signed-off-by: Johannes Berg

Re: [PATCH v2] net: fec: make driver endian-safe

2016-01-24 Thread Johannes Berg
On Sun, 2016-01-24 at 17:49 +0100, Arnd Bergmann wrote: > I'd argue that the "(CONFIG_ARCH_MXC) || defined(CONFIG_SOC_IMX28)" > is definitely wrong, because if we ever get another ARM platform > that uses this driver, it may or may not work depending on whether > the ARCH_MXC is also set, and

[PATCH] net: fec: make driver endian-safe

2016-01-23 Thread Johannes Berg
The driver treats the device descriptors as CPU-endian, which is probably right on both ARM (little-endian) and PowerPC (big-endian) but wrong on big-endian ARM. Add the correct annotations and byteswaps. This gets it working on i.MX6 hummingboard booted in big-endian mode. Signed-off-by:

Re: net: fec: make driver endian-safe

2016-01-23 Thread Johannes Berg
On Sat, 2016-01-23 at 23:09 +0100, Johannes Berg wrote: >  > +/* buffer endianness appears to be a mess ... ARM is usually LE but > can be BE */ > +#if defined(CONFIG_ARM) && defined(CONFIG_CPU_BIG_ENDIAN) Just realized that this is, of course, completely wrong. If the ARM CPU is little endian,