mirror of
https://github.com/openwrt/openwrt.git
synced 2026-06-17 14:50:15 +04:00
realtek: dsa: convert rtl838x stp functions to table helpers
rtldsa_838x_stp_get() and rtl838x_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>
This commit is contained in:
committed by
Robert Marko
parent
dc359b56f7
commit
e202670213
@@ -660,30 +660,26 @@ static void rtl838x_set_static_move_action(int port, bool forward)
|
||||
|
||||
static int rtldsa_838x_stp_get(struct rtl838x_switch_priv *priv, u16 msti, int port, u32 port_state[])
|
||||
{
|
||||
struct table_reg *r = rtl_table_get(RTL8380_TBL_0, 2);
|
||||
int idx = 1 - (port / 16);
|
||||
int bit = 2 * (port % 16);
|
||||
u32 cmd = 1 << 15 | /* Execute cmd */
|
||||
1 << 14 | /* Read */
|
||||
2 << 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 rtl838x_stp_set(struct rtl838x_switch_priv *priv, u16 msti, u32 port_state[])
|
||||
{
|
||||
u32 cmd = 1 << 15 | /* Execute cmd */
|
||||
0 << 14 | /* Write */
|
||||
2 << 12 | /* Table type 0b10 */
|
||||
(msti & 0xfff);
|
||||
struct table_reg *r = rtl_table_get(RTL8380_TBL_0, 2);
|
||||
|
||||
for (int i = 0; i < 2; 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);
|
||||
}
|
||||
|
||||
static void rtl838x_traffic_set(int source, u64 dest_matrix)
|
||||
|
||||
Reference in New Issue
Block a user