[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CO1PR11MB477101305A603B6BC7083360D5529@CO1PR11MB4771.namprd11.prod.outlook.com>
Date: Wed, 12 Jan 2022 22:55:27 +0000
From: "Ismail, Mohammad Athari" <mohammad.athari.ismail@...el.com>
To: Russell King <linux@...linux.org.uk>
CC: Andrew Lunn <andrew@...n.ch>,
"David S . Miller" <davem@...emloft.net>,
Jakub Kicinski <kuba@...nel.org>,
Oleksij Rempel <linux@...pel-privat.de>,
Heiner Kallweit <hkallweit1@...il.com>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"stable@...r.kernel.org" <stable@...r.kernel.org>
Subject: RE: [PATCH net v2] net: phy: marvell: add Marvell specific PHY
loopback
> -----Original Message-----
> From: Russell King <linux@...linux.org.uk>
> Sent: Wednesday, January 12, 2022 9:13 PM
> To: Ismail, Mohammad Athari <mohammad.athari.ismail@...el.com>
> Cc: Andrew Lunn <andrew@...n.ch>; David S . Miller
> <davem@...emloft.net>; Jakub Kicinski <kuba@...nel.org>; Oleksij
> Rempel <linux@...pel-privat.de>; Heiner Kallweit
> <hkallweit1@...il.com>; netdev@...r.kernel.org; linux-
> kernel@...r.kernel.org; stable@...r.kernel.org
> Subject: Re: [PATCH net v2] net: phy: marvell: add Marvell specific PHY
> loopback
>
> On Wed, Jan 12, 2022 at 05:33:44PM +0800, Mohammad Athari Bin Ismail
> wrote:
> > +static int marvell_loopback(struct phy_device *phydev, bool enable) {
> > + if (enable) {
> > + u16 bmcr_ctl = 0, mscr2_ctl = 0;
> > +
> > + if (phydev->speed == SPEED_1000)
> > + bmcr_ctl = BMCR_SPEED1000;
> > + else if (phydev->speed == SPEED_100)
> > + bmcr_ctl = BMCR_SPEED100;
> > +
> > + if (phydev->duplex == DUPLEX_FULL)
> > + bmcr_ctl |= BMCR_FULLDPLX;
> > +
> > + phy_modify(phydev, MII_BMCR, ~0, bmcr_ctl);
>
> Is there any point in doing a read-modify-write here if you're just setting all
> bits in the register? Wouldn't phy_write() be more appropriate? What about
> error handing?
Yes, you're right. phy_write() is more suitable. And will add error handling as well.
Will include them in v3 patch.
>
> > +
> > + if (phydev->speed == SPEED_1000)
> > + mscr2_ctl = BMCR_SPEED1000;
> > + else if (phydev->speed == SPEED_100)
> > + mscr2_ctl = BMCR_SPEED100;
> > +
> > + phy_modify_paged(phydev, MII_MARVELL_MSCR_PAGE,
> > + MII_88E1510_MSCR_2, BMCR_SPEED1000 |
> > + BMCR_SPEED100, mscr2_ctl);
> > +
I believe this also need error handling.
> > + /* Need soft reset to have speed configuration takes effect
> */
> > + genphy_soft_reset(phydev);
Ditto.
> > +
> > + /* FIXME: Based on trial and error test, it seem 1G need to
> have
> > + * delay between soft reset and loopback enablement.
> > + */
> > + if (phydev->speed == SPEED_1000)
> > + msleep(1000);
> > +
> > + return phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK,
> > + BMCR_LOOPBACK);
> > + } else {
> > + phy_modify(phydev, MII_BMCR, BMCR_LOOPBACK, 0);
>
> Error handling?
Will add it in v3 patch.
-Athari-
>
> Thanks.
>
> --
> RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
> FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!
Powered by blists - more mailing lists