From 511aa294a91b526c9ea6649c19081c26a6c714e3 Mon Sep 17 00:00:00 2001 From: Markus Stockhausen Date: Tue, 21 Apr 2026 19:36:07 +0200 Subject: [PATCH] realtek: dsa: convert rtl930x stp functions to table helpers rtldsa_930x_stp_get() and rtl930x_stp_set() use legacy table code. Replace that with rtl_table_xxx() helpers. Signed-off-by: Markus Stockhausen Link: https://github.com/openwrt/openwrt/pull/23037 Signed-off-by: Robert Marko --- .../drivers/net/dsa/rtl83xx/rtl930x.c | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/rtl930x.c b/target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/rtl930x.c index 4942e873c0..b166e7daef 100644 --- a/target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/rtl930x.c +++ b/target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/rtl930x.c @@ -646,30 +646,26 @@ static struct table_reg *rtldsa_930x_lag_table(void) static int rtldsa_930x_stp_get(struct rtl838x_switch_priv *priv, u16 msti, int port, u32 port_state[]) { + struct table_reg *r = rtl_table_get(RTL9300_TBL_0, 4); int idx = 1 - ((port + 3) / 16); int bit = 2 * ((port + 3) % 16); - u32 cmd = 1 << 17 | /* Execute cmd */ - 0 << 16 | /* Read */ - 4 << 12 | /* Table type 0b10 */ - (msti & 0xfff); - priv->r->exec_tbl0_cmd(cmd); + rtl_table_read(r, msti); for (int i = 0; i < 2; i++) - port_state[i] = sw_r32(priv->r->tbl_access_data_0(i)); + port_state[i] = sw_r32(rtl_table_data(r, i)); + rtl_table_release(r); return (port_state[idx] >> bit) & 3; } static void rtl930x_stp_set(struct rtl838x_switch_priv *priv, u16 msti, u32 port_state[]) { - u32 cmd = 1 << 17 | /* Execute cmd */ - 1 << 16 | /* Write */ - 4 << 12 | /* Table type 4 */ - (msti & 0xfff); + struct table_reg *r = rtl_table_get(RTL9300_TBL_0, 4); for (int i = 0; i < 2; i++) - sw_w32(port_state[i], RTL930X_TBL_ACCESS_DATA_0(i)); - priv->r->exec_tbl0_cmd(cmd); + sw_w32(port_state[i], rtl_table_data(r, i)); + rtl_table_write(r, msti); + rtl_table_release(r); } static inline int rtl930x_mac_force_mode_ctrl(int p)