[openwrt/openwrt] realtek: Fix rtl930x speed status accessor
LEDE Commits
lede-commits at lists.infradead.org
Thu Dec 1 13:55:39 PST 2022
svanheule pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/59542c9ac9acd470c4fa3182792de91b4c2f6421
commit 59542c9ac9acd470c4fa3182792de91b4c2f6421
Author: Olliver Schinagl <oliver at schinagl.nl>
AuthorDate: Mon Oct 31 14:02:52 2022 +0100
realtek: Fix rtl930x speed status accessor
The rtl930x speed status registers require 4 bits to indicate the speed
status. As such, we want to divide by 8. To make things consistent with
the rest of this code, use a bitshift however.
This bug probably won't affect many users yet, as there aren't many
rtl930x switches in the wild yet with more then 10 ports, and thus a
low-impact bugfix.
Signed-off-by: Olliver Schinagl <oliver at schinagl.nl>
[also fix port field extraction]
Signed-off-by: Sander Vanheule <sander at svanheule.net>
---
target/linux/realtek/files-5.10/drivers/net/ethernet/rtl838x_eth.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/target/linux/realtek/files-5.10/drivers/net/ethernet/rtl838x_eth.h b/target/linux/realtek/files-5.10/drivers/net/ethernet/rtl838x_eth.h
index 5db5f545b9..d00d11d0c8 100644
--- a/target/linux/realtek/files-5.10/drivers/net/ethernet/rtl838x_eth.h
+++ b/target/linux/realtek/files-5.10/drivers/net/ethernet/rtl838x_eth.h
@@ -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)
More information about the lede-commits
mailing list