[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180619152858.GD26796@lunn.ch>
Date: Tue, 19 Jun 2018 17:28:58 +0200
From: Andrew Lunn <andrew@...n.ch>
To: "Onnasch, Alexander (EXT)" <Alexander.Onnasch@...disgyr.com>
Cc: Florian Fainelli <f.fainelli@...il.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] net/phy: Micrel KSZ8061 PHY link failure after cable
connect
On Tue, Jun 19, 2018 at 02:23:41PM +0000, Onnasch, Alexander (EXT) wrote:
> Hi Andrew
> thanks for the hint. But actually I cannot confirm - or I don't see it yet.
>
> Without having tested, just from the code, the struct phy_driver instance for PHY_ID_KSZ8061 in micrel.c does not have a .write_mmd function assigned, thus phy_write_mmd should evaluate to its else-clause (see below) and not to mdiobus_write (as in phy_write).
>
> Also the ksz8061_extended_write() function which I have added uses the same principle as already existing HW-specific functions in micrel.c for simular reasons (kszphy_extended_write and ksz9031_extended_write).
> They use phy_write all over the place in that file and never phy_write_mmd - for whatever reason they had.
> Thus I thought it would be a good idea ...
Hi Alexander
Please don't top post. And wrap your lines at around 75 characters
> struct mii_bus *bus = phydev->mdio.bus;
> int phy_addr = phydev->mdio.addr;
>
> mutex_lock(&bus->mdio_lock);
> mmd_phy_indirect(bus, phy_addr, devad, regnum);
>
> /* Write the data into MMD's selected register */
> bus->write(bus, phy_addr, MII_MMD_DATA, val);
> mutex_unlock(&bus->mdio_lock);
> > +static int ksz8061_extended_write(struct phy_device *phydev,
> > + u8 mode, u32 dev_addr, u32 regnum, u16 val) {
> > + phy_write(phydev, MII_KSZ8061RN_MMD_CTRL_REG, dev_addr);
> > + phy_write(phydev, MII_KSZ8061RN_MMD_REGDATA_REG, regnum);
> > + phy_write(phydev, MII_KSZ8061RN_MMD_CTRL_REG, (mode << 14) | dev_addr);
> > + return phy_write(phydev, MII_KSZ8061RN_MMD_REGDATA_REG, val); }
>
> Hi Alexander
>
> This looks a lot like phy_write_mmd().
Look closely at the two implementations. Look at what
mmd_phy_indirect() does. I _think_ these are identical. So don't add
your own helper, please use the core code.
Andrew
Powered by blists - more mailing lists