Re: [PATCH net-next] net: dsa: microchip: ksz9477: follow errata sheet when applying fixups

From: Andrew Lunn
Date: Mon Jun 19 2023 - 10:11:07 EST


> static void ksz9477_phy_errata_setup(struct ksz_device *dev, int port)
> {
> + u16 cr;
> +
> + /* Errata document says the PHY must be configured to 100Mbps
> + * with auto-neg disabled before configuring the PHY MMD
> + * registers.
> + */
> + ksz_pread16(dev, port, REG_PORT_PHY_CTRL, &cr);
> + ksz_pwrite16(dev, port, REG_PORT_PHY_CTRL,
> + PORT_SPEED_100MBIT | PORT_FULL_DUPLEX);
> +

For this fix, these are fine.

Reviewed-by: Andrew Lunn <andrew@xxxxxxx>

Looking at the values of PORT_SPEED_100MBIT and PORT_FULL_DUPLEX, they
are identical to BMCR_SPEED100 and BMCR_FULLDPLX. In fact, it looks
like for 9477 this is a standard BMCR. Please could you add a follow
up patch which replaces these #defines with the standard ones in
include/uapi/linux/mii.h. The code is then more understandable by
people who know the standard defines.

Thanks
Andrew