[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <X/HwBOnJvlKd8xq0@lunn.ch>
Date: Sun, 3 Jan 2021 17:25:40 +0100
From: Andrew Lunn <andrew@...n.ch>
To: Marek Vasut <marex@...x.de>
Cc: netdev@...r.kernel.org, Heiner Kallweit <hkallweit1@...il.com>,
Lukas Wunner <lukas@...ner.de>
Subject: Re: [PATCH 2/2] net: ks8851: Register MDIO bus and the internal PHY
On Sun, Jan 03, 2021 at 01:58:09PM +0100, Marek Vasut wrote:
> On 12/30/20 5:00 PM, Andrew Lunn wrote:
> > > +static int ks8851_mdio_read(struct mii_bus *bus, int phy_id, int reg)
> > > +{
> > > + struct ks8851_net *ks = bus->priv;
> > > +
> > > + if (phy_id != 0)
> > > + return 0xffffffff;
> > > +
> >
> > Please check for C45 and return -EOPNOTSUPP.
>
> The ks8851_reg_read() does all the register checking already.
Not really.
static int ks8851_phy_read(struct net_device *dev, int phy_addr, int reg)
{
struct ks8851_net *ks = netdev_priv(dev);
unsigned long flags;
int ksreg;
int result;
ksreg = ks8851_phy_reg(reg);
if (!ksreg)
return 0x0; /* no error return allowed, so use zero */
ks8851_lock(ks, &flags);
result = ks8851_rdreg16(ks, ksreg);
ks8851_unlock(ks, &flags);
return result;
}
static int ks8851_phy_reg(int reg)
{
switch (reg) {
case MII_BMCR:
return KS_P1MBCR;
case MII_BMSR:
return KS_P1MBSR;
case MII_PHYSID1:
return KS_PHY1ILR;
case MII_PHYSID2:
return KS_PHY1IHR;
case MII_ADVERTISE:
return KS_P1ANAR;
case MII_LPA:
return KS_P1ANLPR;
}
return 0x0;
}
So a C45 reg will cause 0 to be returned, not -EOPNOTSUPP.
Andrew
Powered by blists - more mailing lists