]> git.ipfire.org Git - thirdparty/openwrt.git/commitdiff
realtek: rtl931x: Fix printing of port matrix 19572/head
authorHarshal Gohel <hg@simonwunderlich.de>
Tue, 15 Jul 2025 17:05:12 +0000 (19:05 +0200)
committerRobert Marko <robimarko@gmail.com>
Thu, 31 Jul 2025 19:59:24 +0000 (21:59 +0200)
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>
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/dsa.c
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl83xx.h
target/linux/realtek/files-6.12/drivers/net/dsa/rtl83xx/rtl931x.c

index dc442af2b02d386cff675a1595f7f52615dc3c72..a4b1e40c8dddb560531ad72a660005562df7c1c7 100644 (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));
 
-       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);
index abe61942a34cfba85e679ad5575b86b4c7a7db9b..522560ca38cd045b1f5d00b9f7ebb9061c3a77a3 100644 (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);
index 25b7fc6257826c86edc962efad873bb84aea99a0..ed6674e044beb58947221bcd2b260f81f6dda9df 100644 (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)