[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YIRAwY+5yLJf1+CH@lunn.ch>
Date: Sat, 24 Apr 2021 18:01:05 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Oleksij Rempel <o.rempel@...gutronix.de>
Cc: Woojung Huh <woojung.huh@...rochip.com>,
UNGLinuxDriver@...rochip.com,
Florian Fainelli <f.fainelli@...il.com>,
Vivien Didelot <vivien.didelot@...il.com>,
Vladimir Oltean <olteanv@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Michael Grzeschik <m.grzeschik@...gutronix.de>,
kernel@...gutronix.de, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, Russell King <linux@...linux.org.uk>
Subject: Re: [PATCH net-next v6 08/10] net: dsa: microchip: Add Microchip
KSZ8863 SMI based driver support
> +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
Powered by blists - more mailing lists