]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
net: ks8851-ml: Fix 16-bit data access
authorMarek Vasut <marex@denx.de>
Sat, 15 Feb 2020 16:54:18 +0000 (17:54 +0100)
committerDavid S. Miller <davem@davemloft.net>
Mon, 17 Feb 2020 03:41:09 +0000 (19:41 -0800)
The packet data written to and read from Micrel KSZ8851-16MLLI must be
byte-swapped in 16-bit mode, add this byte-swapping.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: David S. Miller <davem@davemloft.net>
Cc: Lukas Wunner <lukas@wunner.de>
Cc: Petr Stetiar <ynezz@true.cz>
Cc: YueHaibing <yuehaibing@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/micrel/ks8851_mll.c

index e2fb20154511e562e7b4c1607b8a57b2d365757a..5ae206ae5d2b34fbd71db62262dd396cdc3af784 100644 (file)
@@ -197,7 +197,7 @@ static inline void ks_inblk(struct ks_net *ks, u16 *wptr, u32 len)
 {
        len >>= 1;
        while (len--)
-               *wptr++ = (u16)ioread16(ks->hw_addr);
+               *wptr++ = be16_to_cpu(ioread16(ks->hw_addr));
 }
 
 /**
@@ -211,7 +211,7 @@ static inline void ks_outblk(struct ks_net *ks, u16 *wptr, u32 len)
 {
        len >>= 1;
        while (len--)
-               iowrite16(*wptr++, ks->hw_addr);
+               iowrite16(cpu_to_be16(*wptr++), ks->hw_addr);
 }
 
 static void ks_disable_int(struct ks_net *ks)