Re: [PATCH 2/2] net: dsa: LAN9303: Add basic support for LAN9354

From: Andrew Lunn
Date: Mon Aug 29 2022 - 15:20:48 EST


> - if ((reg >> 16) != LAN9303_CHIP_ID) {
> - dev_err(chip->dev, "expecting LAN9303 chip, but found: %X\n",
> + if (((reg >> 16) != LAN9303_CHIP_ID) &&
> + ((reg >> 16) != LAN9354_CHIP_ID)) {
> + dev_err(chip->dev, "unexpected device found: LAN%4.4X\n",
> reg >> 16);
> return -ENODEV;
> }
> @@ -884,7 +889,7 @@ static int lan9303_check_device(struct lan9303 *chip)
> if (ret)
> dev_warn(chip->dev, "failed to disable switching %d\n", ret);
>
> - dev_info(chip->dev, "Found LAN9303 rev. %u\n", reg & 0xffff);
> + dev_info(chip->dev, "Found LAN%4.4X rev. %u\n", (reg >> 16), reg & 0xffff);
>
> ret = lan9303_detect_phy_setup(chip);
> if (ret) {
> diff --git a/drivers/net/dsa/lan9303_mdio.c b/drivers/net/dsa/lan9303_mdio.c
> index bbb7032409ba..d12c55fdc811 100644
> --- a/drivers/net/dsa/lan9303_mdio.c
> +++ b/drivers/net/dsa/lan9303_mdio.c
> @@ -158,6 +158,7 @@ static void lan9303_mdio_shutdown(struct mdio_device *mdiodev)
>
> static const struct of_device_id lan9303_mdio_of_match[] = {
> { .compatible = "smsc,lan9303-mdio" },
> + { .compatible = "microchip,lan9354-mdio" },

Please validate that what you find on the board actually is what the
compatible says it should be. If you don't validate it, there will be
some DT blobs that have the wrong value, but probe fine. But then you
cannot actually make use of the compatible string in the driver to do
something different between the 9303 and the 9354 because some boards
have the wrong compatible....

Andrew