Re: [PATCH net-next v6 08/10] net: dsa: microchip: Add Microchip KSZ8863 SMI based driver support
From: Oleksij Rempel
Date: Mon Apr 26 2021 - 08:25:57 EST
On Sat, Apr 24, 2021 at 06:01:05PM +0200, Andrew Lunn wrote:
> > +static int ksz8863_mdio_read(void *ctx, const void *reg_buf, size_t reg_len,
> > + void *val_buf, size_t val_len)
> > +{
> > + struct ksz_device *dev = ctx;
> > + struct ksz8 *ksz8 = dev->priv;
> > + struct mdio_device *mdev = ksz8->priv;
> > + u8 reg = *(u8 *)reg_buf;
> > + u8 *val = val_buf;
> > + int ret = 0;
> > + int i;
>
> ...
>
>
> > +
> > + mutex_lock_nested(&mdev->bus->mdio_lock, MDIO_MUTEX_NESTED);
> > + for (i = 0; i < val_len; i++) {
> > + int tmp = reg + i;
> > +
> > + ret = __mdiobus_read(mdev->bus, ((tmp & 0xE0) >> 5) |
> > + SMI_KSZ88XX_READ_PHY, tmp);
> > + if (ret < 0)
> > + goto out;
> > +
> > + val[i] = ret;
> > + }
> > + ret = 0;
> > +
> > + out:
> > + mutex_unlock(&mdev->bus->mdio_lock);
> > +
> > + return ret;
> > +}
> > +
> > +static int ksz8863_mdio_write(void *ctx, const void *data, size_t count)
> > +{
> > + struct ksz_device *dev = ctx;
> > + struct ksz8 *ksz8 = dev->priv;
> > + struct mdio_device *mdev = ksz8->priv;
> > + u8 *val = (u8 *)(data + 4);
> > + u32 reg = *(u32 *)data;
> > + int ret = 0;
> > + int i;
>
> ...
>
>
> > +static const struct of_device_id ksz8863_dt_ids[] = {
> > + { .compatible = "microchip,ksz8863" },
> > + { .compatible = "microchip,ksz8873" },
> > + { },
> > +};
>
> Is there code somewhere which verifies that what has been found really
> does match what is in device tree? We don't want errors in the device
> tree to be ignored.
>
> Andrew
Hm, it makes sense. But it is not regression of this patches, is it OK
to mainline it separately?
Regards,
Oleksij
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |