RE: [PATCH] net/phy: refactor RTL8211F initialization

2015-04-22 Thread shengzhou....@freescale.com
> -Original Message-
> From: Florian Fainelli [mailto:f.faine...@gmail.com]
> Sent: Thursday, April 23, 2015 12:57 AM
> To: Liu Shengzhou-B36685; netdev@vger.kernel.org; joe.hershber...@gmail.com
> Subject: Re: [PATCH] net/phy: refactor RTL8211F initialization
> 
> On 22/04/15 03:22, Shengzhou Liu wrote:
> > RTL8211F needs to enalbe TXDLY for RGMII during phy initialization, so
> > move it to rtl8211f_config for early initialization.
> >
> > Signed-off-by: Shengzhou Liu 
> > cc: Joe Hershberger 
> > ---
> >  drivers/net/phy/realtek.c | 25 +
> >  1 file changed, 17 insertions(+), 8 deletions(-)
> >
> > diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
> > index 3917c82..d48095b 100644
> > --- a/drivers/net/phy/realtek.c
> > +++ b/drivers/net/phy/realtek.c
> > @@ -43,6 +43,22 @@ static int rtl8211x_config(struct phy_device *phydev)
> > return 0;
> >  }
> >
> > +static int rtl8211f_config(struct phy_device *phydev) {
> > +   phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, BMCR_RESET);
> 
> That part of the change is not documented but has to be, and you should use
> genphy_soft_reset() which also takes care of waiting the required amount of
> time before BMCR_RESET is cleared.

There is no genphy_soft_reset() in current u-boot tree.  

> > +
> > +   if (phydev->interface == PHY_INTERFACE_MODE_RGMII) {
> > +   /* enable TXDLY */
> > +   phy_write(phydev, MDIO_DEVAD_NONE,
> > + MIIM_RTL8211F_PAGE_SELECT, 0xd08);
> > +   phy_write(phydev, MDIO_DEVAD_NONE, 0x11, 0x109);
> 
> Do you need to reset the page selector somehow after this write?

Actually no need to reset the page selector.

> > +   }
> > +
> > +   genphy_config_aneg(phydev);
> > +
> > +   return 0;
> > +}
> > +
> >  static int rtl8211x_parse_status(struct phy_device *phydev)  {
> > unsigned int speed;
> > @@ -142,13 +158,6 @@ static int rtl8211f_parse_status(struct phy_device
> *phydev)
> > phydev->speed = SPEED_10;
> > }
> >
> > -   if (phydev->interface == PHY_INTERFACE_MODE_RGMII) {
> > -   /* enable TXDLY */
> > -   phy_write(phydev, MDIO_DEVAD_NONE,
> > - MIIM_RTL8211F_PAGE_SELECT, 0xd08);
> > -   phy_write(phydev, MDIO_DEVAD_NONE, 0x11, 0x109);
> > -   }
> > -
> > return 0;
> >  }
> >
> > @@ -209,7 +218,7 @@ static struct phy_driver RTL8211F_driver = {
> > .uid = 0x1cc916,
> > .mask = 0xff,
> > .features = PHY_GBIT_FEATURES,
> > -   .config = &rtl8211x_config,
> > +   .config = &rtl8211f_config,
> > .startup = &rtl8211f_startup,
> > .shutdown = &genphy_shutdown,
> >  };
> >
> 
> 
> --
> Florian


RE: [PATCH] net/phy: refactor RTL8211F initialization

2015-04-22 Thread shengzhou....@freescale.com
> -Original Message-
> From: Florian Fainelli [mailto:f.faine...@gmail.com]
> Sent: Thursday, April 23, 2015 12:39 PM
> To: Liu Shengzhou-B36685; netdev@vger.kernel.org; joe.hershber...@gmail.com
> Subject: Re: [PATCH] net/phy: refactor RTL8211F initialization
> 
> Le 22/04/2015 20:53, shengzhou@freescale.com a écrit :
> >> -Original Message-
> >> From: Florian Fainelli [mailto:f.faine...@gmail.com]
> >> Sent: Thursday, April 23, 2015 12:57 AM
> >> To: Liu Shengzhou-B36685; netdev@vger.kernel.org;
> >> joe.hershber...@gmail.com
> >> Subject: Re: [PATCH] net/phy: refactor RTL8211F initialization
> >>
> >> On 22/04/15 03:22, Shengzhou Liu wrote:
> >>> RTL8211F needs to enalbe TXDLY for RGMII during phy initialization,
> >>> so move it to rtl8211f_config for early initialization.
> >>>
> >>> Signed-off-by: Shengzhou Liu 
> >>> cc: Joe Hershberger 
> >>> ---
> >>>  drivers/net/phy/realtek.c | 25 +
> >>>  1 file changed, 17 insertions(+), 8 deletions(-)
> >>>
> >>> diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c
> >>> index 3917c82..d48095b 100644
> >>> --- a/drivers/net/phy/realtek.c
> >>> +++ b/drivers/net/phy/realtek.c
> >>> @@ -43,6 +43,22 @@ static int rtl8211x_config(struct phy_device *phydev)
> >>>   return 0;
> >>>  }
> >>>
> >>> +static int rtl8211f_config(struct phy_device *phydev) {
> >>> + phy_write(phydev, MDIO_DEVAD_NONE, MII_BMCR, BMCR_RESET);
> >>
> >> That part of the change is not documented but has to be, and you
> >> should use
> >> genphy_soft_reset() which also takes care of waiting the required
> >> amount of time before BMCR_RESET is cleared.
> >
> > There is no genphy_soft_reset() in current u-boot tree.
> 
> Did you mean to submit that against u-boot or Linux? If the latter, there is
> absolutely no need to have the same file compile under u-boot and Linux
> without changes, that is too restrictive. There is a
> genphy_soft_reset() which takes care of waiting for BMCR_RESET to clear,
> please use it, there is no guarantee otherwise that a PHY has completed a
> reset.
> --
> Florian
This patch is for u-boot, not for kernel. There is no genphy_soft_reset() in 
u-boot.