RE: [PATCH] net: phy: micrel: workaround to NAND_Tree# incorrectly strapp-in during the reset period.

2014-12-07 Thread Yang, Wenyou


> -Original Message-
> From: Florian Fainelli [mailto:f.faine...@gmail.com]
> Sent: Monday, December 08, 2014 1:09 PM
> To: Yang, Wenyou
> Cc: net...@vger.kernel.org; linux-kernel@vger.kernel.org; Ferre, Nicolas; 
> linux-
> arm-kernel-boun...@lists.infradead.org; jo...@kernel.org
> Subject: Re: [PATCH] net: phy: micrel: workaround to NAND_Tree# incorrectly
> strapp-in during the reset period.
> 
> Le 07/12/2014 19:35, Wenyou Yang a écrit :
> > Appearance: On some boards, after power up, the Ethernet doesn't work.
> >
> > Reason: On the SAMA5D4EK, the PIOE2 pin is connected to the NAND_Tree#
> > of KSZ8081, But it outputs LOW during the reset period, which cause the
> NAND_Tree# enabled.
> >
> > Workaround: In the .config_init(), add code to disable NAND_Tree# by
> > operating Operation Mode Strap Override(i.e. Register 16h).
> 
> Your patch won't apply cleanly to the net-next tree where the PHY drivers
> development is happening, especially not after Johan's recent changes.
> 
> Is not what you are looking for a phy_fixup() rather than clearing this bit 
> for all
> Micrel PHYs?
Thanks, I will go in this direction.

> 
> >
> > Signed-off-by: Wenyou Yang 
> > ---
> >  drivers/net/phy/micrel.c |8 +++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index
> > 8c2a29a..11d72cb 100644
> > --- a/drivers/net/phy/micrel.c
> > +++ b/drivers/net/phy/micrel.c
> > @@ -31,6 +31,7 @@
> >  /* Operation Mode Strap Override */
> >  #define MII_KSZPHY_OMSO0x16
> >  #define KSZPHY_OMSO_B_CAST_OFF (1 << 9)
> > +#define KSZPHY_OMSO_NAND_TREE_OVERRIDE (1 << 5)
> >  #define KSZPHY_OMSO_RMII_OVERRIDE  (1 << 1)
> >  #define KSZPHY_OMSO_MII_OVERRIDE   (1 << 0)
> >
> > @@ -180,7 +181,12 @@ static int kszphy_setup_led(struct phy_device
> > *phydev,
> >
> >  static int kszphy_config_init(struct phy_device *phydev)  {
> > -   return 0;
> > +   int rc;
> > +
> > +   phy_write(phydev, MII_KSZPHY_OMSO, phy_read(phydev,
> MII_KSZPHY_OMSO)
> > +   & (~KSZPHY_OMSO_NAND_TREE_OVERRIDE));
> > +   rc = ksz_config_flags(phydev);
> > +   return rc < 0 ? rc : 0;
> >  }
> >
> >  static int kszphy_config_init_led8041(struct phy_device *phydev)
> >

Best Regards,
Wenyou Yang


Re: [PATCH] net: phy: micrel: workaround to NAND_Tree# incorrectly strapp-in during the reset period.

2014-12-07 Thread Florian Fainelli
Le 07/12/2014 19:35, Wenyou Yang a écrit :
> Appearance: On some boards, after power up, the Ethernet doesn't work.
> 
> Reason: On the SAMA5D4EK, the PIOE2 pin is connected to the NAND_Tree# of 
> KSZ8081,
> But it outputs LOW during the reset period, which cause the NAND_Tree# 
> enabled.
> 
> Workaround: In the .config_init(), add code to disable NAND_Tree#
> by operating Operation Mode Strap Override(i.e. Register 16h).

Your patch won't apply cleanly to the net-next tree where the PHY
drivers development is happening, especially not after Johan's recent
changes.

Is not what you are looking for a phy_fixup() rather than clearing this
bit for all Micrel PHYs?

> 
> Signed-off-by: Wenyou Yang 
> ---
>  drivers/net/phy/micrel.c |8 +++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
> index 8c2a29a..11d72cb 100644
> --- a/drivers/net/phy/micrel.c
> +++ b/drivers/net/phy/micrel.c
> @@ -31,6 +31,7 @@
>  /* Operation Mode Strap Override */
>  #define MII_KSZPHY_OMSO  0x16
>  #define KSZPHY_OMSO_B_CAST_OFF   (1 << 9)
> +#define KSZPHY_OMSO_NAND_TREE_OVERRIDE   (1 << 5)
>  #define KSZPHY_OMSO_RMII_OVERRIDE(1 << 1)
>  #define KSZPHY_OMSO_MII_OVERRIDE (1 << 0)
>  
> @@ -180,7 +181,12 @@ static int kszphy_setup_led(struct phy_device *phydev,
>  
>  static int kszphy_config_init(struct phy_device *phydev)
>  {
> - return 0;
> + int rc;
> +
> + phy_write(phydev, MII_KSZPHY_OMSO, phy_read(phydev, MII_KSZPHY_OMSO)
> + & (~KSZPHY_OMSO_NAND_TREE_OVERRIDE));
> + rc = ksz_config_flags(phydev);
> + return rc < 0 ? rc : 0;
>  }
>  
>  static int kszphy_config_init_led8041(struct phy_device *phydev)
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] net: phy: micrel: workaround to NAND_Tree# incorrectly strapp-in during the reset period.

2014-12-07 Thread Wenyou Yang
Appearance: On some boards, after power up, the Ethernet doesn't work.

Reason: On the SAMA5D4EK, the PIOE2 pin is connected to the NAND_Tree# of 
KSZ8081,
But it outputs LOW during the reset period, which cause the NAND_Tree# enabled.

Workaround: In the .config_init(), add code to disable NAND_Tree#
by operating Operation Mode Strap Override(i.e. Register 16h).

Signed-off-by: Wenyou Yang 
---
 drivers/net/phy/micrel.c |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 8c2a29a..11d72cb 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -31,6 +31,7 @@
 /* Operation Mode Strap Override */
 #define MII_KSZPHY_OMSO0x16
 #define KSZPHY_OMSO_B_CAST_OFF (1 << 9)
+#define KSZPHY_OMSO_NAND_TREE_OVERRIDE (1 << 5)
 #define KSZPHY_OMSO_RMII_OVERRIDE  (1 << 1)
 #define KSZPHY_OMSO_MII_OVERRIDE   (1 << 0)
 
@@ -180,7 +181,12 @@ static int kszphy_setup_led(struct phy_device *phydev,
 
 static int kszphy_config_init(struct phy_device *phydev)
 {
-   return 0;
+   int rc;
+
+   phy_write(phydev, MII_KSZPHY_OMSO, phy_read(phydev, MII_KSZPHY_OMSO)
+   & (~KSZPHY_OMSO_NAND_TREE_OVERRIDE));
+   rc = ksz_config_flags(phydev);
+   return rc < 0 ? rc : 0;
 }
 
 static int kszphy_config_init_led8041(struct phy_device *phydev)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH] net: phy: micrel: workaround to NAND_Tree# incorrectly strapp-in during the reset period.

2014-12-07 Thread Wenyou Yang
Appearance: On some boards, after power up, the Ethernet doesn't work.

Reason: On the SAMA5D4EK, the PIOE2 pin is connected to the NAND_Tree# of 
KSZ8081,
But it outputs LOW during the reset period, which cause the NAND_Tree# enabled.

Workaround: In the .config_init(), add code to disable NAND_Tree#
by operating Operation Mode Strap Override(i.e. Register 16h).

Signed-off-by: Wenyou Yang wenyou.y...@atmel.com
---
 drivers/net/phy/micrel.c |8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
index 8c2a29a..11d72cb 100644
--- a/drivers/net/phy/micrel.c
+++ b/drivers/net/phy/micrel.c
@@ -31,6 +31,7 @@
 /* Operation Mode Strap Override */
 #define MII_KSZPHY_OMSO0x16
 #define KSZPHY_OMSO_B_CAST_OFF (1  9)
+#define KSZPHY_OMSO_NAND_TREE_OVERRIDE (1  5)
 #define KSZPHY_OMSO_RMII_OVERRIDE  (1  1)
 #define KSZPHY_OMSO_MII_OVERRIDE   (1  0)
 
@@ -180,7 +181,12 @@ static int kszphy_setup_led(struct phy_device *phydev,
 
 static int kszphy_config_init(struct phy_device *phydev)
 {
-   return 0;
+   int rc;
+
+   phy_write(phydev, MII_KSZPHY_OMSO, phy_read(phydev, MII_KSZPHY_OMSO)
+(~KSZPHY_OMSO_NAND_TREE_OVERRIDE));
+   rc = ksz_config_flags(phydev);
+   return rc  0 ? rc : 0;
 }
 
 static int kszphy_config_init_led8041(struct phy_device *phydev)
-- 
1.7.9.5

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH] net: phy: micrel: workaround to NAND_Tree# incorrectly strapp-in during the reset period.

2014-12-07 Thread Florian Fainelli
Le 07/12/2014 19:35, Wenyou Yang a écrit :
 Appearance: On some boards, after power up, the Ethernet doesn't work.
 
 Reason: On the SAMA5D4EK, the PIOE2 pin is connected to the NAND_Tree# of 
 KSZ8081,
 But it outputs LOW during the reset period, which cause the NAND_Tree# 
 enabled.
 
 Workaround: In the .config_init(), add code to disable NAND_Tree#
 by operating Operation Mode Strap Override(i.e. Register 16h).

Your patch won't apply cleanly to the net-next tree where the PHY
drivers development is happening, especially not after Johan's recent
changes.

Is not what you are looking for a phy_fixup() rather than clearing this
bit for all Micrel PHYs?

 
 Signed-off-by: Wenyou Yang wenyou.y...@atmel.com
 ---
  drivers/net/phy/micrel.c |8 +++-
  1 file changed, 7 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c
 index 8c2a29a..11d72cb 100644
 --- a/drivers/net/phy/micrel.c
 +++ b/drivers/net/phy/micrel.c
 @@ -31,6 +31,7 @@
  /* Operation Mode Strap Override */
  #define MII_KSZPHY_OMSO  0x16
  #define KSZPHY_OMSO_B_CAST_OFF   (1  9)
 +#define KSZPHY_OMSO_NAND_TREE_OVERRIDE   (1  5)
  #define KSZPHY_OMSO_RMII_OVERRIDE(1  1)
  #define KSZPHY_OMSO_MII_OVERRIDE (1  0)
  
 @@ -180,7 +181,12 @@ static int kszphy_setup_led(struct phy_device *phydev,
  
  static int kszphy_config_init(struct phy_device *phydev)
  {
 - return 0;
 + int rc;
 +
 + phy_write(phydev, MII_KSZPHY_OMSO, phy_read(phydev, MII_KSZPHY_OMSO)
 +  (~KSZPHY_OMSO_NAND_TREE_OVERRIDE));
 + rc = ksz_config_flags(phydev);
 + return rc  0 ? rc : 0;
  }
  
  static int kszphy_config_init_led8041(struct phy_device *phydev)
 

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


RE: [PATCH] net: phy: micrel: workaround to NAND_Tree# incorrectly strapp-in during the reset period.

2014-12-07 Thread Yang, Wenyou


 -Original Message-
 From: Florian Fainelli [mailto:f.faine...@gmail.com]
 Sent: Monday, December 08, 2014 1:09 PM
 To: Yang, Wenyou
 Cc: net...@vger.kernel.org; linux-kernel@vger.kernel.org; Ferre, Nicolas; 
 linux-
 arm-kernel-boun...@lists.infradead.org; jo...@kernel.org
 Subject: Re: [PATCH] net: phy: micrel: workaround to NAND_Tree# incorrectly
 strapp-in during the reset period.
 
 Le 07/12/2014 19:35, Wenyou Yang a écrit :
  Appearance: On some boards, after power up, the Ethernet doesn't work.
 
  Reason: On the SAMA5D4EK, the PIOE2 pin is connected to the NAND_Tree#
  of KSZ8081, But it outputs LOW during the reset period, which cause the
 NAND_Tree# enabled.
 
  Workaround: In the .config_init(), add code to disable NAND_Tree# by
  operating Operation Mode Strap Override(i.e. Register 16h).
 
 Your patch won't apply cleanly to the net-next tree where the PHY drivers
 development is happening, especially not after Johan's recent changes.
 
 Is not what you are looking for a phy_fixup() rather than clearing this bit 
 for all
 Micrel PHYs?
Thanks, I will go in this direction.

 
 
  Signed-off-by: Wenyou Yang wenyou.y...@atmel.com
  ---
   drivers/net/phy/micrel.c |8 +++-
   1 file changed, 7 insertions(+), 1 deletion(-)
 
  diff --git a/drivers/net/phy/micrel.c b/drivers/net/phy/micrel.c index
  8c2a29a..11d72cb 100644
  --- a/drivers/net/phy/micrel.c
  +++ b/drivers/net/phy/micrel.c
  @@ -31,6 +31,7 @@
   /* Operation Mode Strap Override */
   #define MII_KSZPHY_OMSO0x16
   #define KSZPHY_OMSO_B_CAST_OFF (1  9)
  +#define KSZPHY_OMSO_NAND_TREE_OVERRIDE (1  5)
   #define KSZPHY_OMSO_RMII_OVERRIDE  (1  1)
   #define KSZPHY_OMSO_MII_OVERRIDE   (1  0)
 
  @@ -180,7 +181,12 @@ static int kszphy_setup_led(struct phy_device
  *phydev,
 
   static int kszphy_config_init(struct phy_device *phydev)  {
  -   return 0;
  +   int rc;
  +
  +   phy_write(phydev, MII_KSZPHY_OMSO, phy_read(phydev,
 MII_KSZPHY_OMSO)
  +(~KSZPHY_OMSO_NAND_TREE_OVERRIDE));
  +   rc = ksz_config_flags(phydev);
  +   return rc  0 ? rc : 0;
   }
 
   static int kszphy_config_init_led8041(struct phy_device *phydev)
 

Best Regards,
Wenyou Yang