summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarshal Gohel2025-07-15 17:05:12 +0000
committerRobert Marko2025-07-31 19:59:24 +0000
commit960ad676c14a726871b0b94ab20ba5ede156f6ca (patch)
tree6217359a83beac11f9fbf301ccece2b7a37cbd23
parentb61fda10358ff79be707ccc0eb2e6f0e2d2b7e9d (diff)
downloadopenwrt-960ad676c14a726871b0b94ab20ba5ede156f6ca.tar.gz
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>
-rw-r--r--target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c5
-rw-r--r--target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl83xx.h1
-rw-r--r--target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c12
3 files changed, 12 insertions, 6 deletions
diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c
index dc442af2b0..a4b1e40c8d 100644
--- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c
+++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c
@@ -519,7 +519,10 @@ static int rtl93xx_setup(struct dsa_switch *ds)
}
priv->r->traffic_set(priv->cpu_port, BIT_ULL(priv->cpu_port));
- rtl930x_print_matrix();
+ 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);
diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl83xx.h b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl83xx.h
index abe61942a3..522560ca38 100644
--- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl83xx.h
+++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl83xx.h
@@ -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);
diff --git a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c
index 25b7fc6257..ed6674e044 100644
--- a/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c
+++ b/target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c
@@ -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)