Re: [PATCH net-next v14 5/5] net: dsa: motorcomm: Add support for Motorcomm YT922x
From: Kyle Switch
Date: Sat Oct 17 2026 - 23:03:42 EST
On 10/17/26 04:15, David Yang wrote:
On Tue, Oct 13, 2026 at 9:11 AM Kyle Switch <kyle.switch@xxxxxxxxxxxxxx> wrote:Okay.
+/* yt922x register lists */The indents below look inconsistent. Please adjust to match the existing macros.
will be removed and use the macros defined earlier in 921x.
+#define YT92XX_PAGE_SELECT 0x1eLeftover from yt921x_speed.
+#define YT92XX_PAGE 0x1f
+#define YT922X_PORTn_STATUS(port) (0x80200 + 4 * (port))
+#define YT922X_PORT_LINK_STATE BIT(8)
+#define YT922X_PORT_LINK_DUPLEX BIT(7)
+#define YT922X_PORT_RX_FC_EN BIT(6)
+#define YT922X_PORT_TX_FC_EN BIT(5)
+#define YT922X_PORT_SPEED_10 0
+#define YT922X_PORT_SPEED_100 1
+#define YT922X_PORT_SPEED_1000 2
+#define YT922X_PORT_SPEED_10000 3
+#define YT922X_PORT_SPEED_2500 4
+#define YT922X_PORT_SPEED_5000 5
okay, will remove meaningless code comments.
+/* ISO */The comments here (and below) did not provide much information beyond
the code itself.
Okay.+#define YT922X_PORTn_ISOLATION(port) (0x4 * (port) + 0x180d80)(0x180d80 + 4 * (port))
okay.
diff --git a/drivers/net/dsa/motorcomm/mdio_bus.c b/drivers/net/dsa/motorcomm/mdio_bus.cintif_ext_* should be placed right after intif_* (if they are still in
index 3aa1111efaa4..a4cb74d0fd90 100644
--- a/drivers/net/dsa/motorcomm/mdio_bus.c
+++ b/drivers/net/dsa/motorcomm/mdio_bus.c
@@ -299,3 +299,42 @@ int yt921x_mbus_ext_init(struct yt921x_priv *priv, struct device_node *mnp)
return 0;
}
+
+/* intif extend register read/write api */
+int
+yt921x_intif_ext_write(struct yt921x_priv *priv, int port, int reg, u16 val)
+{
+ int res;
+
+ if (port > priv->series->max_ports)
+ return -ENODEV;
+
+ res = yt921x_intif_write(priv, port, YT92XX_PAGE_SELECT, reg);
+ if (res)
+ return res;
+
+ res = yt921x_intif_write(priv, port, YT92XX_PAGE, val);
+ if (res)
+ return res;
+
+ return 0;
+}
+
+int
+yt921x_intif_ext_read(struct yt921x_priv *priv, int port, int reg, u16 *valp)
+{
+ int res;
+
+ if (port > priv->series->max_ports)
+ return -ENODEV;
+
+ res = yt921x_intif_write(priv, port, YT92XX_PAGE_SELECT, reg);
+ if (res)
+ return res;
+
+ res = yt921x_intif_read(priv, port, YT92XX_PAGE, valp);
+ if (res)
+ return res;
+
+ return 0;
+}
diff --git a/drivers/net/dsa/motorcomm/mdio_bus.h b/drivers/net/dsa/motorcomm/mdio_bus.h
index e79b725d435b..513a8d2d7618 100644
--- a/drivers/net/dsa/motorcomm/mdio_bus.h
+++ b/drivers/net/dsa/motorcomm/mdio_bus.h
@@ -50,5 +50,7 @@ yt921x_intif_modify(struct yt921x_priv *priv, int port, int reg, u16 mask,
int yt921x_mbus_int_init(struct yt921x_priv *priv, struct device_node *mnp);
int yt921x_mbus_ext_init(struct yt921x_priv *priv, struct device_node *mnp);
+int yt921x_intif_ext_write(struct yt921x_priv *priv, int port, int reg, u16 val);
+int yt921x_intif_ext_read(struct yt921x_priv *priv, int port, int reg, u16 *valp);
#endif
mdio_bus).