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>
.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,
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)