realtek: rtl931x: Fix link status get not fetching correct status
Some checks are pending
Build Kernel / Build all affected Kernels (push) Waiting to run
Build all core packages / Build all core packages for selected target (push) Waiting to run

Just like rtl930x, rtl931x also requires two reads to fetch current link
status.

While at it, rename the function to a proper naming scheme.

Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
Co-developed-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Co-developed-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Sven Eckelmann <sven@narfation.org>
Signed-off-by: Sharadanand Karanjkar <sk@simonwunderlich.de>
Link: https://github.com/openwrt/openwrt/pull/19578
Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
This commit is contained in:
Harshal Gohel 2025-04-08 10:46:15 +00:00 committed by Hauke Mehrtens
parent 445af8c038
commit 6473e3ed5e
2 changed files with 10 additions and 3 deletions

View file

@ -610,7 +610,7 @@ static const struct rtl838x_eth_reg rtl931x_reg = {
.dma_if_rx_ring_cntr = rtl931x_dma_if_rx_ring_cntr,
.dma_if_rx_cur = RTL931X_DMA_IF_RX_CUR,
.rst_glb_ctrl = RTL931X_RST_GLB_CTRL,
.get_mac_link_sts = rtl931x_get_mac_link_sts,
.get_mac_link_sts = rtldsa_931x_get_mac_link_sts,
.get_mac_link_dup_sts = rtl931x_get_mac_link_dup_sts,
.get_mac_link_spd_sts = rtl931x_get_mac_link_spd_sts,
.get_mac_rx_pause_sts = rtl931x_get_mac_rx_pause_sts,

View file

@ -307,9 +307,16 @@ inline u32 rtl930x_get_mac_link_sts(int port)
return link & BIT(port);
}
inline u32 rtl931x_get_mac_link_sts(int p)
inline u32 rtldsa_931x_get_mac_link_sts(int port)
{
return (sw_r32(RTL931X_MAC_LINK_STS + ((p >> 5) << 2)) & BIT(p % 32));
unsigned int reg = RTL931X_MAC_LINK_STS + (port / 32) * 4;
u32 mask = BIT(port % 32);
u32 link;
link = sw_r32(reg);
link = sw_r32(reg);
return (link & mask);
}
inline u32 rtl838x_get_mac_link_dup_sts(int port)