realtek: Fix rtl930x speed status accessor
[openwrt/staging/aparcar.git] / target / linux / realtek / files-5.10 / drivers / net / ethernet / rtl838x_eth.h
index 5db5f545b9a8537ee747abd700e5022c33b21c53..d00d11d0c823f9069ec888693ad0957e228f8837 100644 (file)
@@ -348,11 +348,11 @@ inline u32 rtl839x_get_mac_link_spd_sts(int port)
 
 inline u32 rtl930x_get_mac_link_spd_sts(int port)
 {
-       int r = RTL930X_MAC_LINK_SPD_STS + ((port / 10) << 2);
+       int r = RTL930X_MAC_LINK_SPD_STS + ((port >> 3) << 2);
        u32 speed = sw_r32(r);
 
-       speed >>= (port % 10) * 3;
-       return (speed & 0x7);
+       speed >>= (port % 8) << 2;
+       return (speed & 0xf);
 }
 
 inline u32 rtl931x_get_mac_link_spd_sts(int port)