diff mbox

[U-Boot,1/2] net: phy: introduce a quirk PHY_BROKEN_RESET

Message ID 1452592519-14492-1-git-send-email-shh.xie@gmail.com
State Changes Requested
Delegated to: Joe Hershberger
Headers show

Commit Message

shaohui xie Jan. 12, 2016, 9:55 a.m. UTC
From: Shaohui Xie <Shaohui.Xie@nxp.com>

Current driver always performs a phy soft reset when connecting the phy
device, but soft reset is not always supported by a phy device, so
introduce a quirk PHY_BROKEN_RESET to let such a phy device to skip soft
reset. This commit uses 'flags' of phy device structure to store the
quirk.

Signed-off-by: Shaohui Xie <Shaohui.Xie@nxp.com>
---
 drivers/net/phy/phy.c | 3 +++
 include/phy.h         | 1 +
 2 files changed, 4 insertions(+)

Comments

Joe Hershberger Jan. 27, 2016, 3:36 p.m. UTC | #1
On Tue, Jan 12, 2016 at 3:55 AM,  <shh.xie@gmail.com> wrote:
> From: Shaohui Xie <Shaohui.Xie@nxp.com>
>
> Current driver always performs a phy soft reset when connecting the phy
> device, but soft reset is not always supported by a phy device, so
> introduce a quirk PHY_BROKEN_RESET to let such a phy device to skip soft
> reset. This commit uses 'flags' of phy device structure to store the
> quirk.
>
> Signed-off-by: Shaohui Xie <Shaohui.Xie@nxp.com>
> ---
>  drivers/net/phy/phy.c | 3 +++
>  include/phy.h         | 1 +
>  2 files changed, 4 insertions(+)
>
> diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
> index 51b5746..2a36ae7 100644
> --- a/drivers/net/phy/phy.c
> +++ b/drivers/net/phy/phy.c
> @@ -707,6 +707,9 @@ int phy_reset(struct phy_device *phydev)
>         int timeout = 500;
>         int devad = MDIO_DEVAD_NONE;
>
> +       if (phydev->flags == PHY_BROKEN_RESET)

Please mask off this bit so this test still work if someone adds a
different flag.

E.g.: if (phydev->flags & PHY_BROKEN_RESET)

> +               return 0;
> +
>  #ifdef CONFIG_PHYLIB_10G
>         /* If it's 10G, we need to issue reset through one of the MMDs */
>         if (is_10g_interface(phydev->interface)) {
> diff --git a/include/phy.h b/include/phy.h
> index 66cf61b..5f604a1 100644
> --- a/include/phy.h
> +++ b/include/phy.h
> @@ -16,6 +16,7 @@
>  #include <linux/mdio.h>
>
>  #define PHY_MAX_ADDR 32
> +#define PHY_BROKEN_RESET       (1 << 0) /* soft reset not supported */

Please name this something like PHY_FLAG_BROKEN_RESET.

>
>  #define PHY_BASIC_FEATURES     (SUPPORTED_10baseT_Half | \
>                                  SUPPORTED_10baseT_Full | \
> --
> 2.1.0.27.g96db324
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot
shaohui xie Jan. 28, 2016, 3:09 a.m. UTC | #2
> -----Original Message-----

> From: Joe Hershberger [mailto:joe.hershberger@gmail.com]

> Sent: Wednesday, January 27, 2016 11:37 PM

> To: shaohui 谢 <shh.xie@gmail.com>

> Cc: u-boot <u-boot@lists.denx.de>; Joe Hershberger <joe.hershberger@ni.com>;

> Shaohui Xie <shaohui.xie@nxp.com>; York Sun <yorksun@freescale.com>

> Subject: Re: [U-Boot] [PATCH 1/2] net: phy: introduce a quirk PHY_BROKEN_RESET

> 

> On Tue, Jan 12, 2016 at 3:55 AM,  <shh.xie@gmail.com> wrote:

> > From: Shaohui Xie <Shaohui.Xie@nxp.com>

> >

> > Current driver always performs a phy soft reset when connecting the

> > phy device, but soft reset is not always supported by a phy device, so

> > introduce a quirk PHY_BROKEN_RESET to let such a phy device to skip

> > soft reset. This commit uses 'flags' of phy device structure to store

> > the quirk.

> >

> > Signed-off-by: Shaohui Xie <Shaohui.Xie@nxp.com>

> > ---

> >  drivers/net/phy/phy.c | 3 +++

> >  include/phy.h         | 1 +

> >  2 files changed, 4 insertions(+)

> >

> > diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c index

> > 51b5746..2a36ae7 100644

> > --- a/drivers/net/phy/phy.c

> > +++ b/drivers/net/phy/phy.c

> > @@ -707,6 +707,9 @@ int phy_reset(struct phy_device *phydev)

> >         int timeout = 500;

> >         int devad = MDIO_DEVAD_NONE;

> >

> > +       if (phydev->flags == PHY_BROKEN_RESET)

> 

> Please mask off this bit so this test still work if someone adds a different flag.

> 

> E.g.: if (phydev->flags & PHY_BROKEN_RESET)

[S.H] OK. Will fix it.

> 

> > +               return 0;

> > +

> >  #ifdef CONFIG_PHYLIB_10G

> >         /* If it's 10G, we need to issue reset through one of the MMDs */

> >         if (is_10g_interface(phydev->interface)) { diff --git

> > a/include/phy.h b/include/phy.h index 66cf61b..5f604a1 100644

> > --- a/include/phy.h

> > +++ b/include/phy.h

> > @@ -16,6 +16,7 @@

> >  #include <linux/mdio.h>

> >

> >  #define PHY_MAX_ADDR 32

> > +#define PHY_BROKEN_RESET       (1 << 0) /* soft reset not supported */

> 

> Please name this something like PHY_FLAG_BROKEN_RESET.

[S.H] OK. Will do.

Thank you!
Shaohui
> 

> >

> >  #define PHY_BASIC_FEATURES     (SUPPORTED_10baseT_Half | \

> >                                  SUPPORTED_10baseT_Full | \

> > --

> > 2.1.0.27.g96db324

> >

> > _______________________________________________

> > U-Boot mailing list

> > U-Boot@lists.denx.de

> > http://lists.denx.de/mailman/listinfo/u-boot
diff mbox

Patch

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 51b5746..2a36ae7 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -707,6 +707,9 @@  int phy_reset(struct phy_device *phydev)
 	int timeout = 500;
 	int devad = MDIO_DEVAD_NONE;
 
+	if (phydev->flags == PHY_BROKEN_RESET)
+		return 0;
+
 #ifdef CONFIG_PHYLIB_10G
 	/* If it's 10G, we need to issue reset through one of the MMDs */
 	if (is_10g_interface(phydev->interface)) {
diff --git a/include/phy.h b/include/phy.h
index 66cf61b..5f604a1 100644
--- a/include/phy.h
+++ b/include/phy.h
@@ -16,6 +16,7 @@ 
 #include <linux/mdio.h>
 
 #define PHY_MAX_ADDR 32
+#define PHY_BROKEN_RESET	(1 << 0) /* soft reset not supported */
 
 #define PHY_BASIC_FEATURES	(SUPPORTED_10baseT_Half | \
 				 SUPPORTED_10baseT_Full | \