Re: [PATCH] dp83640: Ensure against premature access to PHY registers after reset
Hi, [This is an automated email] This commit has been processed by the -stable helper bot and determined to be a high probability candidate for -stable trees. (score: 6.8160) The bot has tested the following trees: v4.16.1, v4.15.16, v4.14.33, v4.9.93, v4.4.127. v4.16.1: Build OK! v4.15.16: Build OK! v4.14.33: Build OK! v4.9.93: Build OK! v4.4.127: Build OK! Please let us know if you'd like to have this patch included in a stable tree. -- Thanks, Sasha
Re: [PATCH] dp83640: Ensure against premature access to PHY registers after reset
David Miller writes: > From: Andrew Lunn > Date: Fri, 6 Apr 2018 16:14:10 +0200 > >> On Fri, Apr 06, 2018 at 04:05:40PM +0200, Esben Haabendal wrote: >>> From: Esben Haabendal >>> >>> Signed-off-by: Esben Haabendal >>> --- >>> drivers/net/phy/dp83640.c | 17 + >>> 1 file changed, 17 insertions(+) >>> >>> diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c >>> index 654f42d00092..48403170096a 100644 >>> --- a/drivers/net/phy/dp83640.c >>> +++ b/drivers/net/phy/dp83640.c >>> @@ -1207,6 +1207,22 @@ static void dp83640_remove(struct phy_device *phydev) >>> kfree(dp83640); >>> } >>> >>> +static int dp83640_soft_reset(struct phy_device *phydev) >>> +{ >>> + int ret; >>> + >>> + ret = genphy_soft_reset(phydev); >>> + if (ret < 0) >>> + return ret; >>> + >>> + /* From DP83640 datasheet: "Software driver code must wait 3 us >>> +* following a software reset before allowing further serial MII >>> +* operations with the DP83640." */ >>> + udelay(3); >> >> Hi Esben >> >> The accuracy of udelay() is not guaranteed. So you probably want to be >> a bit pessimistic, and use 10. Ok, will do. /Esben
Re: [PATCH] dp83640: Ensure against premature access to PHY registers after reset
From: Andrew Lunn Date: Fri, 6 Apr 2018 16:14:10 +0200 > On Fri, Apr 06, 2018 at 04:05:40PM +0200, Esben Haabendal wrote: >> From: Esben Haabendal >> >> Signed-off-by: Esben Haabendal >> --- >> drivers/net/phy/dp83640.c | 17 + >> 1 file changed, 17 insertions(+) >> >> diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c >> index 654f42d00092..48403170096a 100644 >> --- a/drivers/net/phy/dp83640.c >> +++ b/drivers/net/phy/dp83640.c >> @@ -1207,6 +1207,22 @@ static void dp83640_remove(struct phy_device *phydev) >> kfree(dp83640); >> } >> >> +static int dp83640_soft_reset(struct phy_device *phydev) >> +{ >> +int ret; >> + >> +ret = genphy_soft_reset(phydev); >> +if (ret < 0) >> +return ret; >> + >> +/* From DP83640 datasheet: "Software driver code must wait 3 us >> + * following a software reset before allowing further serial MII >> + * operations with the DP83640." */ >> +udelay(3); > > Hi Esben > > The accuracy of udelay() is not guaranteed. So you probably want to be > a bit pessimistic, and use 10. Agreed.
Re: [PATCH] dp83640: Ensure against premature access to PHY registers after reset
On Fri, Apr 06, 2018 at 04:05:40PM +0200, Esben Haabendal wrote: > From: Esben Haabendal > > Signed-off-by: Esben Haabendal > --- > drivers/net/phy/dp83640.c | 17 + > 1 file changed, 17 insertions(+) > > diff --git a/drivers/net/phy/dp83640.c b/drivers/net/phy/dp83640.c > index 654f42d00092..48403170096a 100644 > --- a/drivers/net/phy/dp83640.c > +++ b/drivers/net/phy/dp83640.c > @@ -1207,6 +1207,22 @@ static void dp83640_remove(struct phy_device *phydev) > kfree(dp83640); > } > > +static int dp83640_soft_reset(struct phy_device *phydev) > +{ > + int ret; > + > + ret = genphy_soft_reset(phydev); > + if (ret < 0) > + return ret; > + > + /* From DP83640 datasheet: "Software driver code must wait 3 us > + * following a software reset before allowing further serial MII > + * operations with the DP83640." */ > + udelay(3); Hi Esben The accuracy of udelay() is not guaranteed. So you probably want to be a bit pessimistic, and use 10. Andrew