]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: dsa: convert rtl839x stp functions to table helpers
authorMarkus Stockhausen <markus.stockhausen@gmx.de>
Tue, 21 Apr 2026 17:36:07 +0000 (19:36 +0200)
committerRobert Marko <robimarko@gmail.com>
Wed, 22 Apr 2026 14:59:28 +0000 (16:59 +0200)
rtldsa_839x_stp_get() and rtl839x_stp_set() use legacy table code.
Replace that with rtl_table_xxx() helpers.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Link: https://github.com/openwrt/openwrt/pull/23037
Signed-off-by: Robert Marko <robimarko@gmail.com>
target/linux/realtek/files-6.18/drivers/net/dsa/rtl83xx/rtl839x.c

index 56b72f62f480c36069cb57845d1437c1b37fd0d9..828d7a004b813b658dfd174a6665d694bc11c722 100644 (file)
@@ -727,29 +727,26 @@ rtldsa_839x_vlan_profile_dump(struct rtl838x_switch_priv *priv, int idx)
 
 static int rtldsa_839x_stp_get(struct rtl838x_switch_priv *priv, u16 msti, int port, u32 port_state[])
 {
+       struct table_reg *r = rtl_table_get(RTL8390_TBL_0, 5);
        int idx = 3 - ((port + 12) / 16);
        int bit = 2 * ((port + 12) % 16);
-       u32 cmd = 1 << 16 | /* Execute cmd */
-                 0 << 15 | /* Read */
-                 5 << 12 | /* Table type 0b101 */
-                 (msti & 0xfff);
 
-       priv->r->exec_tbl0_cmd(cmd);
+       rtl_table_read(r, msti);
        for (int i = 0; i < 4; 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 rtl839x_stp_set(struct rtl838x_switch_priv *priv, u16 msti, u32 port_state[])
 {
-       u32 cmd = 1 << 16 | /* Execute cmd */
-                 1 << 15 | /* Write */
-                 5 << 12 | /* Table type 0b101 */
-                 (msti & 0xfff);
+       struct table_reg *r = rtl_table_get(RTL8390_TBL_0, 5);
+
        for (int i = 0; i < 4; i++)
-               sw_w32(port_state[i], priv->r->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);
 }
 
 /* Enables or disables the EEE/EEEP capability of a port */