Re: [PATCH net-next v14 5/5] net: dsa: motorcomm: Add support for Motorcomm YT922x

From: David Yang

Date: Fri Oct 16 2026 - 16:16:06 EST


On Tue, Oct 13, 2026 at 9:11 AM Kyle Switch <kyle.switch@xxxxxxxxxxxxxx> wrote:
> +/* yt922x register lists */

The indents below look inconsistent. Please adjust to match the existing macros.

> +#define YT92XX_PAGE_SELECT 0x1e
> +#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

Leftover from yt921x_speed.

> +/* ISO */

The comments here (and below) did not provide much information beyond
the code itself.

> +#define YT922X_PORTn_ISOLATION(port) (0x4 * (port) + 0x180d80)

(0x180d80 + 4 * (port))

> diff --git a/drivers/net/dsa/motorcomm/mdio_bus.c b/drivers/net/dsa/motorcomm/mdio_bus.c
> 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

intif_ext_* should be placed right after intif_* (if they are still in
mdio_bus).