[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <AM6PR01MB4262FB2EBD4AFBC05C02F9B6F02F0@AM6PR01MB4262.eurprd01.prod.exchangelabs.com>
Date: Mon, 30 Jul 2018 14:00:44 +0000
From: "Onnasch, Alexander (EXT)" <Alexander.Onnasch@...disgyr.com>
To: Andrew Lunn <andrew@...n.ch>
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
Hi Andrew
thanks for your feedback. I was on holiday, thus just delayed, not forgotten...
Sorry for top-posting - odd company default mail setup.
I checked again phy_write_mmd(), you are right !
Patch with changed implementation will follow.
Best regards, Alex
-----Original Message-----
From: Andrew Lunn <andrew@...n.ch>
Sent: Dienstag, 19. Juni 2018 17:29
To: Onnasch, Alexander (EXT) <Alexander.Onnasch@...disgyr.com>
Cc: Florian Fainelli <f.fainelli@...il.com>; netdev@...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