lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1496182080.19669.11.camel@nxp.com>
Date:   Wed, 31 May 2017 01:08:00 +0300
From:   Leonard Crestez <leonard.crestez@....com>
To:     Florian Fainelli <f.fainelli@...il.com>,
        Andrew Lunn <andrew@...n.ch>, Andy Duan <fugang.duan@....com>
CC:     Johan Hovold <johan@...nel.org>,
        Alexandre Belloni <alexandre.belloni@...e-electrons.com>,
        Philipp Zabel <p.zabel@...gutronix.de>,
        Fabio Estevam <fabio.estevam@....com>,
        <netdev@...r.kernel.org>, <linux-arm-kernel@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>, Shawn Guo <shawnguo@...nel.org>
Subject: Re: [PATCH 2/2] net: phy: micrel: Restore led_mode and clk_sel on
 resume

On Tue, 2017-05-30 at 11:05 -0700, Florian Fainelli wrote:
> On 05/30/2017 10:34 AM, Leonard Crestez wrote:
> > These bits seem to be lost after a suspend/resume cycle so just set them
> > again.
> > 
> > This patch fixes ethernet suspend/resume on imx6ul-14x14-evk boards.
> > 
> > Signed-off-by: Leonard Crestez <leonard.crestez@....com>
> > ---
> >  drivers/net/phy/micrel.c | 15 +++++++++++++++
> >  1 file changed, 15 insertions(+)
> > 
> > diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
> > index 6a5fd18..c53ee17 100644
> > --- a/drivers/net/phy/micrel.c
> > +++ b/drivers/net/phy/micrel.c
> > @@ -700,6 +700,9 @@ static int kszphy_suspend(struct phy_device *phydev)
> >  
> >  static int kszphy_resume(struct phy_device *phydev)
> >  {
> > +	struct kszphy_priv *priv = phydev->priv;
> > +	int ret;
> > +
> >  	genphy_resume(phydev);
> >  
> >  	/* Enable PHY Interrupts */
> > @@ -709,6 +712,18 @@ static int kszphy_resume(struct phy_device *phydev)
> >  			phydev->drv->config_intr(phydev);
> >  	}
> >  
> > +	if (priv->rmii_ref_clk_sel) {
> > +		ret = kszphy_rmii_clk_sel(phydev, priv->rmii_ref_clk_sel_val);
> > +		if (ret) {
> > +			phydev_err(phydev,
> > +				   "failed to set rmii reference clock\n");
> > +			return ret;
> > +		}
> > +	}
> > +
> > +	if (priv->led_mode >= 0)
> > +		kszphy_setup_led(phydev, priv->type->led_mode_reg, priv->led_mode);
> 
> Should not we actually call kszphy_config_init() in order to restore
> broadcast and nand disable bits as well?

I don't know. In my case the B_CAST_OFF bit doesn't seem to be lost and
NAND_TREE_ON is already off by the time it gets to linux.

The bit that get lost seem to disappear just as the phy is resumed. I
added some prints and they look like this:

PM: early resume of devices complete after 6.534 msecs
begin resume
0x1F=0x8190 0x16=0x202
after genphy_resume 0x1F=0x8100 0x16=0x202
end
resume 0x1F=0x8190 0x16=0x202

> If not, I would be more comfortable if we did create a specific function
> that takes care of setting the reference clock and LED mode.

Ok, I can add a function called kszphy_config_reset() with a comment
explaining it's for bits lost on reset/resume.

Or perhaps a better option would be to just save/restore the entire
0x1F register?

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ