realtek: rtl931x: Fix printing of port matrix

The function rtl93xx_setup() is called by both RTL930x and RTL931x. But
only the RTL930x specific function to print port matrix was called.
Unfortuntaly, RTL931x needs a different function to access the correct
registers to retrieve the port matrix information.

It is therefore necessary differentiate in rtl93xx_setup between the
SoC families before calling the appropriate function.

Signed-off-by: Harshal Gohel <hg@simonwunderlich.de>
Signed-off-by: Sharadanand Karanjkar <sk@simonwunderlich.de>
Link: https://github.com/openwrt/openwrt/pull/19572
Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
Harshal Gohel
2025-07-15 19:05:12 +02:00
committed by Robert Marko
parent b61fda1035
commit 960ad676c1
3 changed files with 12 additions and 6 deletions

View File

@@ -519,7 +519,10 @@ static int rtl93xx_setup(struct dsa_switch *ds)
}
priv->r->traffic_set(priv->cpu_port, BIT_ULL(priv->cpu_port));
if (priv->family_id == RTL9300_FAMILY_ID)
rtl930x_print_matrix();
else if (priv->family_id == RTL9310_FAMILY_ID)
rtl931x_print_matrix();
/* TODO: Initialize statistics */
rtldsa_init_counters(priv);

View File

@@ -190,6 +190,7 @@ irqreturn_t rtl931x_switch_irq(int irq, void *dev_id);
int rtl931x_sds_cmu_band_get(int sds, phy_interface_t mode);
int rtl931x_sds_cmu_band_set(int sds, bool enable, u32 band, phy_interface_t mode);
extern void rtl931x_sds_init(u32 sds, phy_interface_t mode);
void rtl931x_print_matrix(void);
int rtl83xx_lag_add(struct dsa_switch *ds, int group, int port, struct netdev_lag_upper_info *info);
int rtl83xx_lag_del(struct dsa_switch *ds, int group, int port);

View File

@@ -464,12 +464,14 @@ int rtl931x_write_mmd_phy(u32 port, u32 devnum, u32 regnum, u32 val)
void rtl931x_print_matrix(void)
{
volatile u64 *ptr = RTL838X_SW_BASE + RTL839X_PORT_ISO_CTRL(0);
struct table_reg *r = rtl_table_get(RTL9310_TBL_2, 1);
for (int i = 0; i < 52; i += 4)
pr_debug("> %16llx %16llx %16llx %16llx\n",
ptr[i + 0], ptr[i + 1], ptr[i + 2], ptr[i + 3]);
pr_debug("CPU_PORT> %16llx\n", ptr[52]);
for (int i = 0; i < 64; i++) {
rtl_table_read(r, i);
pr_info("> %08x %08x\n", sw_r32(rtl_table_data(r, 0)),
sw_r32(rtl_table_data(r, 1)));
}
rtl_table_release(r);
}
void rtl931x_set_receive_management_action(int port, rma_ctrl_t type, action_type_t action)