[openwrt/openwrt] realtek: rtl931x: Fix printing of port matrix
LEDE Commits
lede-commits at lists.infradead.org
Thu Jul 31 12:59:35 PDT 2025
robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/960ad676c14a726871b0b94ab20ba5ede156f6ca
commit 960ad676c14a726871b0b94ab20ba5ede156f6ca
Author: Harshal Gohel <hg at simonwunderlich.de>
AuthorDate: Tue Jul 15 19:05:12 2025 +0200
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 at simonwunderlich.de>
Signed-off-by: Sharadanand Karanjkar <sk at simonwunderlich.de>
Link: https://github.com/openwrt/openwrt/pull/19572
Signed-off-by: Robert Marko <robimarko at gmail.com>
---
.../linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c | 5 ++++-
.../realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl83xx.h | 1 +
.../realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c | 12 +++++++-----
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)
More information about the lede-commits
mailing list