netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] phy: micrel: Add definitions for common Micrel PHY registers
@ 2013-07-15 23:08 dinguyen
  2013-07-16  0:11 ` Shawn Guo
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: dinguyen @ 2013-07-15 23:08 UTC (permalink / raw)
  To: dinh.linux, netdev
  Cc: linux-arm-kernel, Dinh Nguyen, David S. Miller, Shawn Guo,
	Andrew Victor, Nicolas Ferre, Jean-Christophe Plagniol-Villard,
	Pavel Machek

From: Dinh Nguyen <dinguyen@altera.com>

Add defines for common Micrel PHY setups so that other platforms
can use them. Update imx61 and sama5 hardware to use the micrel_phy.h
PHY defines.

Also add support for the KSZ9021RLRN PHY.

Signed-off-by: Dinh Nguyen <dinguyen@altera.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Shawn Guo <shawn.guo@linaro.org>
CC: Andrew Victor <linux@maxim.org.za>
CC: Nicolas Ferre <nicolas.ferre@atmel.com>
CC: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
CC: Pavel Machek <pavel@denx.de>
---
 arch/arm/mach-at91/board-dt-sama5.c |   17 ++++++-----------
 arch/arm/mach-imx/mach-imx6q.c      |   13 ++++++++-----
 include/linux/micrel_phy.h          |    6 ++++++
 3 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/arch/arm/mach-at91/board-dt-sama5.c b/arch/arm/mach-at91/board-dt-sama5.c
index ad95f6a..bf00d15 100644
--- a/arch/arm/mach-at91/board-dt-sama5.c
+++ b/arch/arm/mach-at91/board-dt-sama5.c
@@ -42,20 +42,15 @@ static int ksz9021rn_phy_fixup(struct phy_device *phy)
 {
 	int value;
 
-#define GMII_RCCPSR	260
-#define GMII_RRDPSR	261
-#define GMII_ERCR	11
-#define GMII_ERDWR	12
-
 	/* Set delay values */
-	value = GMII_RCCPSR | 0x8000;
-	phy_write(phy, GMII_ERCR, value);
+	value = MICREL_KSZ9021_RGMII_CLK_CTRL_PAD_SCEW | 0x8000;
+	phy_write(phy, MICREL_KSZ9021_EXTREG_CTRL, value);
 	value = 0xF2F4;
-	phy_write(phy, GMII_ERDWR, value);
-	value = GMII_RRDPSR | 0x8000;
-	phy_write(phy, GMII_ERCR, value);
+	phy_write(phy, MICREL_KSZ9021_EXTREG_DATA_WRITE, value);
+	value = MICREL_KSZ9021_RGMII_RX_DATA_PAD_SCEW | 0x8000;
+	phy_write(phy, MICREL_KSZ9021_EXTREG_CTRL, value);
 	value = 0x2222;
-	phy_write(phy, GMII_ERDWR, value);
+	phy_write(phy, MICREL_KSZ9021_EXTREG_DATA_WRITE, value);
 
 	return 0;
 }
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index 7be13f8..c8d7814 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -103,13 +103,16 @@ static int ksz9021rn_phy_fixup(struct phy_device *phydev)
 {
 	if (IS_BUILTIN(CONFIG_PHYLIB)) {
 		/* min rx data delay */
-		phy_write(phydev, 0x0b, 0x8105);
-		phy_write(phydev, 0x0c, 0x0000);
+		phy_write(phydev, MICREL_KSZ9021_EXTREG_CTRL,
+			0x8000 | MICREL_KSZ9021_RGMII_RX_DATA_PAD_SCEW);
+		phy_write(phydev, MICREL_KSZ9021_EXTREG_DATA_WRITE, 0x0000);
 
 		/* max rx/tx clock delay, min rx/tx control delay */
-		phy_write(phydev, 0x0b, 0x8104);
-		phy_write(phydev, 0x0c, 0xf0f0);
-		phy_write(phydev, 0x0b, 0x104);
+		phy_write(phydev, MICREL_KSZ9021_EXTREG_CTRL,
+			0x8000 | MICREL_KSZ9021_RGMII_CLK_CTRL_PAD_SCEW);
+		phy_write(phydev, MICREL_KSZ9021_EXTREG_DATA_WRITE, 0xf0f0);
+		phy_write(phydev, MICREL_KSZ9021_EXTREG_CTRL,
+			MICREL_KSZ9021_RGMII_CLK_CTRL_PAD_SCEW);
 	}
 
 	return 0;
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
index 8752dbb..ad05ce6 100644
--- a/include/linux/micrel_phy.h
+++ b/include/linux/micrel_phy.h
@@ -17,6 +17,7 @@
 
 #define PHY_ID_KSZ8873MLL	0x000e7237
 #define PHY_ID_KSZ9021		0x00221610
+#define PHY_ID_KSZ9021RLRN	0x00221611
 #define PHY_ID_KS8737		0x00221720
 #define PHY_ID_KSZ8021		0x00221555
 #define PHY_ID_KSZ8031		0x00221556
@@ -35,4 +36,9 @@
 /* struct phy_device dev_flags definitions */
 #define MICREL_PHY_50MHZ_CLK	0x00000001
 
+#define MICREL_KSZ9021_EXTREG_CTRL	0xB
+#define MICREL_KSZ9021_EXTREG_DATA_WRITE	0xC
+#define MICREL_KSZ9021_RGMII_CLK_CTRL_PAD_SCEW	0x104
+#define MICREL_KSZ9021_RGMII_RX_DATA_PAD_SCEW	0x105
+
 #endif /* _MICREL_PHY_H */
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] phy: micrel: Add definitions for common Micrel PHY registers
  2013-07-15 23:08 [PATCH] phy: micrel: Add definitions for common Micrel PHY registers dinguyen
@ 2013-07-16  0:11 ` Shawn Guo
  2013-07-16  8:29 ` Nicolas Ferre
  2013-07-18 11:17 ` Pavel Machek
  2 siblings, 0 replies; 11+ messages in thread
From: Shawn Guo @ 2013-07-16  0:11 UTC (permalink / raw)
  To: dinguyen
  Cc: dinh.linux, netdev, linux-arm-kernel, David S. Miller,
	Andrew Victor, Nicolas Ferre, Jean-Christophe Plagniol-Villard,
	Pavel Machek

On Mon, Jul 15, 2013 at 06:08:50PM -0500, dinguyen@altera.com wrote:
> From: Dinh Nguyen <dinguyen@altera.com>
> 
> Add defines for common Micrel PHY setups so that other platforms
> can use them. Update imx61 and sama5 hardware to use the micrel_phy.h
> PHY defines.
> 
> Also add support for the KSZ9021RLRN PHY.
> 
> Signed-off-by: Dinh Nguyen <dinguyen@altera.com>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Shawn Guo <shawn.guo@linaro.org>

Acked-by: Shawn Guo <shawn.guo@linaro.org>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] phy: micrel: Add definitions for common Micrel PHY registers
  2013-07-15 23:08 [PATCH] phy: micrel: Add definitions for common Micrel PHY registers dinguyen
  2013-07-16  0:11 ` Shawn Guo
@ 2013-07-16  8:29 ` Nicolas Ferre
  2013-07-16 14:54   ` Dinh Nguyen
  2013-07-18 11:17 ` Pavel Machek
  2 siblings, 1 reply; 11+ messages in thread
From: Nicolas Ferre @ 2013-07-16  8:29 UTC (permalink / raw)
  To: dinguyen
  Cc: dinh.linux, netdev, linux-arm-kernel, David S. Miller, Shawn Guo,
	Andrew Victor, Jean-Christophe Plagniol-Villard, Pavel Machek

On 16/07/2013 01:08, dinguyen@altera.com :
> From: Dinh Nguyen <dinguyen@altera.com>
>
> Add defines for common Micrel PHY setups so that other platforms
> can use them. Update imx61 and sama5 hardware to use the micrel_phy.h
> PHY defines.
>
> Also add support for the KSZ9021RLRN PHY.
>
> Signed-off-by: Dinh Nguyen <dinguyen@altera.com>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Shawn Guo <shawn.guo@linaro.org>
> CC: Andrew Victor <linux@maxim.org.za>
> CC: Nicolas Ferre <nicolas.ferre@atmel.com>

Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>

BTW, which way do you plan to use to merge it upstream?

Thanks a lot, bye,

> CC: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
> CC: Pavel Machek <pavel@denx.de>
> ---
>   arch/arm/mach-at91/board-dt-sama5.c |   17 ++++++-----------
>   arch/arm/mach-imx/mach-imx6q.c      |   13 ++++++++-----
>   include/linux/micrel_phy.h          |    6 ++++++
>   3 files changed, 20 insertions(+), 16 deletions(-)
>
> diff --git a/arch/arm/mach-at91/board-dt-sama5.c b/arch/arm/mach-at91/board-dt-sama5.c
> index ad95f6a..bf00d15 100644
> --- a/arch/arm/mach-at91/board-dt-sama5.c
> +++ b/arch/arm/mach-at91/board-dt-sama5.c
> @@ -42,20 +42,15 @@ static int ksz9021rn_phy_fixup(struct phy_device *phy)
>   {
>   	int value;
>
> -#define GMII_RCCPSR	260
> -#define GMII_RRDPSR	261
> -#define GMII_ERCR	11
> -#define GMII_ERDWR	12
> -
>   	/* Set delay values */
> -	value = GMII_RCCPSR | 0x8000;
> -	phy_write(phy, GMII_ERCR, value);
> +	value = MICREL_KSZ9021_RGMII_CLK_CTRL_PAD_SCEW | 0x8000;
> +	phy_write(phy, MICREL_KSZ9021_EXTREG_CTRL, value);
>   	value = 0xF2F4;
> -	phy_write(phy, GMII_ERDWR, value);
> -	value = GMII_RRDPSR | 0x8000;
> -	phy_write(phy, GMII_ERCR, value);
> +	phy_write(phy, MICREL_KSZ9021_EXTREG_DATA_WRITE, value);
> +	value = MICREL_KSZ9021_RGMII_RX_DATA_PAD_SCEW | 0x8000;
> +	phy_write(phy, MICREL_KSZ9021_EXTREG_CTRL, value);
>   	value = 0x2222;
> -	phy_write(phy, GMII_ERDWR, value);
> +	phy_write(phy, MICREL_KSZ9021_EXTREG_DATA_WRITE, value);
>
>   	return 0;
>   }
> diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
> index 7be13f8..c8d7814 100644
> --- a/arch/arm/mach-imx/mach-imx6q.c
> +++ b/arch/arm/mach-imx/mach-imx6q.c
> @@ -103,13 +103,16 @@ static int ksz9021rn_phy_fixup(struct phy_device *phydev)
>   {
>   	if (IS_BUILTIN(CONFIG_PHYLIB)) {
>   		/* min rx data delay */
> -		phy_write(phydev, 0x0b, 0x8105);
> -		phy_write(phydev, 0x0c, 0x0000);
> +		phy_write(phydev, MICREL_KSZ9021_EXTREG_CTRL,
> +			0x8000 | MICREL_KSZ9021_RGMII_RX_DATA_PAD_SCEW);
> +		phy_write(phydev, MICREL_KSZ9021_EXTREG_DATA_WRITE, 0x0000);
>
>   		/* max rx/tx clock delay, min rx/tx control delay */
> -		phy_write(phydev, 0x0b, 0x8104);
> -		phy_write(phydev, 0x0c, 0xf0f0);
> -		phy_write(phydev, 0x0b, 0x104);
> +		phy_write(phydev, MICREL_KSZ9021_EXTREG_CTRL,
> +			0x8000 | MICREL_KSZ9021_RGMII_CLK_CTRL_PAD_SCEW);
> +		phy_write(phydev, MICREL_KSZ9021_EXTREG_DATA_WRITE, 0xf0f0);
> +		phy_write(phydev, MICREL_KSZ9021_EXTREG_CTRL,
> +			MICREL_KSZ9021_RGMII_CLK_CTRL_PAD_SCEW);
>   	}
>
>   	return 0;
> diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
> index 8752dbb..ad05ce6 100644
> --- a/include/linux/micrel_phy.h
> +++ b/include/linux/micrel_phy.h
> @@ -17,6 +17,7 @@
>
>   #define PHY_ID_KSZ8873MLL	0x000e7237
>   #define PHY_ID_KSZ9021		0x00221610
> +#define PHY_ID_KSZ9021RLRN	0x00221611
>   #define PHY_ID_KS8737		0x00221720
>   #define PHY_ID_KSZ8021		0x00221555
>   #define PHY_ID_KSZ8031		0x00221556
> @@ -35,4 +36,9 @@
>   /* struct phy_device dev_flags definitions */
>   #define MICREL_PHY_50MHZ_CLK	0x00000001
>
> +#define MICREL_KSZ9021_EXTREG_CTRL	0xB
> +#define MICREL_KSZ9021_EXTREG_DATA_WRITE	0xC
> +#define MICREL_KSZ9021_RGMII_CLK_CTRL_PAD_SCEW	0x104
> +#define MICREL_KSZ9021_RGMII_RX_DATA_PAD_SCEW	0x105
> +
>   #endif /* _MICREL_PHY_H */
>


-- 
Nicolas Ferre

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] phy: micrel: Add definitions for common Micrel PHY registers
  2013-07-16  8:29 ` Nicolas Ferre
@ 2013-07-16 14:54   ` Dinh Nguyen
  0 siblings, 0 replies; 11+ messages in thread
From: Dinh Nguyen @ 2013-07-16 14:54 UTC (permalink / raw)
  To: Nicolas Ferre
  Cc: dinh.linux, netdev, linux-arm-kernel, David S. Miller, Shawn Guo,
	Andrew Victor, Jean-Christophe Plagniol-Villard, Pavel Machek

On Tue, 2013-07-16 at 10:29 +0200, Nicolas Ferre wrote:
> On 16/07/2013 01:08, dinguyen@altera.com :
> > From: Dinh Nguyen <dinguyen@altera.com>
> >
> > Add defines for common Micrel PHY setups so that other platforms
> > can use them. Update imx61 and sama5 hardware to use the micrel_phy.h
> > PHY defines.
> >
> > Also add support for the KSZ9021RLRN PHY.
> >
> > Signed-off-by: Dinh Nguyen <dinguyen@altera.com>
> > Cc: David S. Miller <davem@davemloft.net>
> > Cc: Shawn Guo <shawn.guo@linaro.org>
> > CC: Andrew Victor <linux@maxim.org.za>
> > CC: Nicolas Ferre <nicolas.ferre@atmel.com>
> 
> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
> 
> BTW, which way do you plan to use to merge it upstream?

Thanks Nicolas, I was hoping to have either Shawn or you pick it up?

Dinh
> 
> Thanks a lot, bye,
> 
> > CC: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
> > CC: Pavel Machek <pavel@denx.de>
> > ---
> >   arch/arm/mach-at91/board-dt-sama5.c |   17 ++++++-----------
> >   arch/arm/mach-imx/mach-imx6q.c      |   13 ++++++++-----
> >   include/linux/micrel_phy.h          |    6 ++++++
> >   3 files changed, 20 insertions(+), 16 deletions(-)
> >
> > diff --git a/arch/arm/mach-at91/board-dt-sama5.c b/arch/arm/mach-at91/board-dt-sama5.c
> > index ad95f6a..bf00d15 100644
> > --- a/arch/arm/mach-at91/board-dt-sama5.c
> > +++ b/arch/arm/mach-at91/board-dt-sama5.c
> > @@ -42,20 +42,15 @@ static int ksz9021rn_phy_fixup(struct phy_device *phy)
> >   {
> >   	int value;
> >
> > -#define GMII_RCCPSR	260
> > -#define GMII_RRDPSR	261
> > -#define GMII_ERCR	11
> > -#define GMII_ERDWR	12
> > -
> >   	/* Set delay values */
> > -	value = GMII_RCCPSR | 0x8000;
> > -	phy_write(phy, GMII_ERCR, value);
> > +	value = MICREL_KSZ9021_RGMII_CLK_CTRL_PAD_SCEW | 0x8000;
> > +	phy_write(phy, MICREL_KSZ9021_EXTREG_CTRL, value);
> >   	value = 0xF2F4;
> > -	phy_write(phy, GMII_ERDWR, value);
> > -	value = GMII_RRDPSR | 0x8000;
> > -	phy_write(phy, GMII_ERCR, value);
> > +	phy_write(phy, MICREL_KSZ9021_EXTREG_DATA_WRITE, value);
> > +	value = MICREL_KSZ9021_RGMII_RX_DATA_PAD_SCEW | 0x8000;
> > +	phy_write(phy, MICREL_KSZ9021_EXTREG_CTRL, value);
> >   	value = 0x2222;
> > -	phy_write(phy, GMII_ERDWR, value);
> > +	phy_write(phy, MICREL_KSZ9021_EXTREG_DATA_WRITE, value);
> >
> >   	return 0;
> >   }
> > diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
> > index 7be13f8..c8d7814 100644
> > --- a/arch/arm/mach-imx/mach-imx6q.c
> > +++ b/arch/arm/mach-imx/mach-imx6q.c
> > @@ -103,13 +103,16 @@ static int ksz9021rn_phy_fixup(struct phy_device *phydev)
> >   {
> >   	if (IS_BUILTIN(CONFIG_PHYLIB)) {
> >   		/* min rx data delay */
> > -		phy_write(phydev, 0x0b, 0x8105);
> > -		phy_write(phydev, 0x0c, 0x0000);
> > +		phy_write(phydev, MICREL_KSZ9021_EXTREG_CTRL,
> > +			0x8000 | MICREL_KSZ9021_RGMII_RX_DATA_PAD_SCEW);
> > +		phy_write(phydev, MICREL_KSZ9021_EXTREG_DATA_WRITE, 0x0000);
> >
> >   		/* max rx/tx clock delay, min rx/tx control delay */
> > -		phy_write(phydev, 0x0b, 0x8104);
> > -		phy_write(phydev, 0x0c, 0xf0f0);
> > -		phy_write(phydev, 0x0b, 0x104);
> > +		phy_write(phydev, MICREL_KSZ9021_EXTREG_CTRL,
> > +			0x8000 | MICREL_KSZ9021_RGMII_CLK_CTRL_PAD_SCEW);
> > +		phy_write(phydev, MICREL_KSZ9021_EXTREG_DATA_WRITE, 0xf0f0);
> > +		phy_write(phydev, MICREL_KSZ9021_EXTREG_CTRL,
> > +			MICREL_KSZ9021_RGMII_CLK_CTRL_PAD_SCEW);
> >   	}
> >
> >   	return 0;
> > diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
> > index 8752dbb..ad05ce6 100644
> > --- a/include/linux/micrel_phy.h
> > +++ b/include/linux/micrel_phy.h
> > @@ -17,6 +17,7 @@
> >
> >   #define PHY_ID_KSZ8873MLL	0x000e7237
> >   #define PHY_ID_KSZ9021		0x00221610
> > +#define PHY_ID_KSZ9021RLRN	0x00221611
> >   #define PHY_ID_KS8737		0x00221720
> >   #define PHY_ID_KSZ8021		0x00221555
> >   #define PHY_ID_KSZ8031		0x00221556
> > @@ -35,4 +36,9 @@
> >   /* struct phy_device dev_flags definitions */
> >   #define MICREL_PHY_50MHZ_CLK	0x00000001
> >
> > +#define MICREL_KSZ9021_EXTREG_CTRL	0xB
> > +#define MICREL_KSZ9021_EXTREG_DATA_WRITE	0xC
> > +#define MICREL_KSZ9021_RGMII_CLK_CTRL_PAD_SCEW	0x104
> > +#define MICREL_KSZ9021_RGMII_RX_DATA_PAD_SCEW	0x105
> > +
> >   #endif /* _MICREL_PHY_H */
> >
> 
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] phy: micrel: Add definitions for common Micrel PHY registers
  2013-07-15 23:08 [PATCH] phy: micrel: Add definitions for common Micrel PHY registers dinguyen
  2013-07-16  0:11 ` Shawn Guo
  2013-07-16  8:29 ` Nicolas Ferre
@ 2013-07-18 11:17 ` Pavel Machek
  2 siblings, 0 replies; 11+ messages in thread
From: Pavel Machek @ 2013-07-18 11:17 UTC (permalink / raw)
  To: dinguyen
  Cc: dinh.linux, netdev, linux-arm-kernel, David S. Miller, Shawn Guo,
	Andrew Victor, Nicolas Ferre, Jean-Christophe Plagniol-Villard

On Mon 2013-07-15 18:08:50, dinguyen@altera.com wrote:
> From: Dinh Nguyen <dinguyen@altera.com>
> 
> Add defines for common Micrel PHY setups so that other platforms
> can use them. Update imx61 and sama5 hardware to use the micrel_phy.h
> PHY defines.

Looks good to me.

> Signed-off-by: Dinh Nguyen <dinguyen@altera.com>
> Cc: David S. Miller <davem@davemloft.net>
> Cc: Shawn Guo <shawn.guo@linaro.org>
> CC: Andrew Victor <linux@maxim.org.za>
> CC: Nicolas Ferre <nicolas.ferre@atmel.com>
> CC: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>

Reviewed-by: Pavel Machek <pavel@denx.de>
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] phy: micrel: Add definitions for common Micrel PHY registers
@ 2013-08-13 14:58 dinguyen
  2013-08-13 14:59 ` dinguyen
  2013-08-14  5:17 ` Shawn Guo
  0 siblings, 2 replies; 11+ messages in thread
From: dinguyen @ 2013-08-13 14:58 UTC (permalink / raw)
  To: dinh.linux
  Cc: Dinh Nguyen, Shawn Guo, Nicolas Ferre, David S. Miller,
	Andrew Victor, Jean-Christophe Plagniol-Villard, netdev,
	linux-arm-kernel

From: Dinh Nguyen <dinguyen@altera.com>

Hi Shawn,

Can you apply this patch to your tree for 3.12?

Thanks,

Dinh Nguyen (1):
  phy: micrel: Add definitions for common Micrel PHY registers

 arch/arm/mach-at91/board-dt-sama5.c |   17 ++++++-----------
 arch/arm/mach-imx/mach-imx6q.c      |   13 ++++++++-----
 include/linux/micrel_phy.h          |    6 ++++++
 3 files changed, 20 insertions(+), 16 deletions(-)

Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: David S. Miller <davem@davemloft.net>
CC: Andrew Victor <linux@maxim.org.za>
CC: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: netdev@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org

-- 
1.7.9.5

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] phy: micrel: Add definitions for common Micrel PHY registers
  2013-08-13 14:58 dinguyen
@ 2013-08-13 14:59 ` dinguyen
  2013-08-14  5:17 ` Shawn Guo
  1 sibling, 0 replies; 11+ messages in thread
From: dinguyen @ 2013-08-13 14:59 UTC (permalink / raw)
  To: dinh.linux
  Cc: Dinh Nguyen, David S. Miller, Andrew Victor,
	Jean-Christophe Plagniol-Villard, Shawn Guo, Nicolas Ferre,
	netdev, linux-arm-kernel

From: Dinh Nguyen <dinguyen@altera.com>

Add defines for common Micrel PHY setups so that other platforms
can use them. Update imx61 and sama5 hardware to use the micrel_phy.h
PHY defines.

Also add support for the KSZ9021RLRN PHY.

Signed-off-by: Dinh Nguyen <dinguyen@altera.com>
Acked-by: Shawn Guo <shawn.guo@linaro.org>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: David S. Miller <davem@davemloft.net>
CC: Andrew Victor <linux@maxim.org.za>
CC: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
Cc: Shawn Guo <shawn.guo@linaro.org>
Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
Cc: netdev@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
---
 arch/arm/mach-at91/board-dt-sama5.c |   17 ++++++-----------
 arch/arm/mach-imx/mach-imx6q.c      |   13 ++++++++-----
 include/linux/micrel_phy.h          |    6 ++++++
 3 files changed, 20 insertions(+), 16 deletions(-)

diff --git a/arch/arm/mach-at91/board-dt-sama5.c b/arch/arm/mach-at91/board-dt-sama5.c
index ad95f6a..bf00d15 100644
--- a/arch/arm/mach-at91/board-dt-sama5.c
+++ b/arch/arm/mach-at91/board-dt-sama5.c
@@ -42,20 +42,15 @@ static int ksz9021rn_phy_fixup(struct phy_device *phy)
 {
 	int value;
 
-#define GMII_RCCPSR	260
-#define GMII_RRDPSR	261
-#define GMII_ERCR	11
-#define GMII_ERDWR	12
-
 	/* Set delay values */
-	value = GMII_RCCPSR | 0x8000;
-	phy_write(phy, GMII_ERCR, value);
+	value = MICREL_KSZ9021_RGMII_CLK_CTRL_PAD_SCEW | 0x8000;
+	phy_write(phy, MICREL_KSZ9021_EXTREG_CTRL, value);
 	value = 0xF2F4;
-	phy_write(phy, GMII_ERDWR, value);
-	value = GMII_RRDPSR | 0x8000;
-	phy_write(phy, GMII_ERCR, value);
+	phy_write(phy, MICREL_KSZ9021_EXTREG_DATA_WRITE, value);
+	value = MICREL_KSZ9021_RGMII_RX_DATA_PAD_SCEW | 0x8000;
+	phy_write(phy, MICREL_KSZ9021_EXTREG_CTRL, value);
 	value = 0x2222;
-	phy_write(phy, GMII_ERDWR, value);
+	phy_write(phy, MICREL_KSZ9021_EXTREG_DATA_WRITE, value);
 
 	return 0;
 }
diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c
index 7be13f8..c8d7814 100644
--- a/arch/arm/mach-imx/mach-imx6q.c
+++ b/arch/arm/mach-imx/mach-imx6q.c
@@ -103,13 +103,16 @@ static int ksz9021rn_phy_fixup(struct phy_device *phydev)
 {
 	if (IS_BUILTIN(CONFIG_PHYLIB)) {
 		/* min rx data delay */
-		phy_write(phydev, 0x0b, 0x8105);
-		phy_write(phydev, 0x0c, 0x0000);
+		phy_write(phydev, MICREL_KSZ9021_EXTREG_CTRL,
+			0x8000 | MICREL_KSZ9021_RGMII_RX_DATA_PAD_SCEW);
+		phy_write(phydev, MICREL_KSZ9021_EXTREG_DATA_WRITE, 0x0000);
 
 		/* max rx/tx clock delay, min rx/tx control delay */
-		phy_write(phydev, 0x0b, 0x8104);
-		phy_write(phydev, 0x0c, 0xf0f0);
-		phy_write(phydev, 0x0b, 0x104);
+		phy_write(phydev, MICREL_KSZ9021_EXTREG_CTRL,
+			0x8000 | MICREL_KSZ9021_RGMII_CLK_CTRL_PAD_SCEW);
+		phy_write(phydev, MICREL_KSZ9021_EXTREG_DATA_WRITE, 0xf0f0);
+		phy_write(phydev, MICREL_KSZ9021_EXTREG_CTRL,
+			MICREL_KSZ9021_RGMII_CLK_CTRL_PAD_SCEW);
 	}
 
 	return 0;
diff --git a/include/linux/micrel_phy.h b/include/linux/micrel_phy.h
index 8752dbb..ad05ce6 100644
--- a/include/linux/micrel_phy.h
+++ b/include/linux/micrel_phy.h
@@ -17,6 +17,7 @@
 
 #define PHY_ID_KSZ8873MLL	0x000e7237
 #define PHY_ID_KSZ9021		0x00221610
+#define PHY_ID_KSZ9021RLRN	0x00221611
 #define PHY_ID_KS8737		0x00221720
 #define PHY_ID_KSZ8021		0x00221555
 #define PHY_ID_KSZ8031		0x00221556
@@ -35,4 +36,9 @@
 /* struct phy_device dev_flags definitions */
 #define MICREL_PHY_50MHZ_CLK	0x00000001
 
+#define MICREL_KSZ9021_EXTREG_CTRL	0xB
+#define MICREL_KSZ9021_EXTREG_DATA_WRITE	0xC
+#define MICREL_KSZ9021_RGMII_CLK_CTRL_PAD_SCEW	0x104
+#define MICREL_KSZ9021_RGMII_RX_DATA_PAD_SCEW	0x105
+
 #endif /* _MICREL_PHY_H */
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] phy: micrel: Add definitions for common Micrel PHY registers
  2013-08-13 14:58 dinguyen
  2013-08-13 14:59 ` dinguyen
@ 2013-08-14  5:17 ` Shawn Guo
  2013-08-14  7:51   ` David Miller
  1 sibling, 1 reply; 11+ messages in thread
From: Shawn Guo @ 2013-08-14  5:17 UTC (permalink / raw)
  To: dinguyen
  Cc: dinh.linux, Nicolas Ferre, David S. Miller, Andrew Victor,
	Jean-Christophe Plagniol-Villard, netdev, linux-arm-kernel

On Tue, Aug 13, 2013 at 09:58:59AM -0500, dinguyen@altera.com wrote:
> From: Dinh Nguyen <dinguyen@altera.com>
> 
> Hi Shawn,
> 
> Can you apply this patch to your tree for 3.12?
> 

I need David's Ack to send the patch through IMX tree.

Shawn

> Thanks,
> 
> Dinh Nguyen (1):
>   phy: micrel: Add definitions for common Micrel PHY registers
> 
>  arch/arm/mach-at91/board-dt-sama5.c |   17 ++++++-----------
>  arch/arm/mach-imx/mach-imx6q.c      |   13 ++++++++-----
>  include/linux/micrel_phy.h          |    6 ++++++
>  3 files changed, 20 insertions(+), 16 deletions(-)
> 
> Cc: Shawn Guo <shawn.guo@linaro.org>
> Cc: Nicolas Ferre <nicolas.ferre@atmel.com>
> Cc: David S. Miller <davem@davemloft.net>
> CC: Andrew Victor <linux@maxim.org.za>
> CC: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>
> Cc: netdev@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> 
> -- 
> 1.7.9.5
> 
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] phy: micrel: Add definitions for common Micrel PHY registers
  2013-08-14  5:17 ` Shawn Guo
@ 2013-08-14  7:51   ` David Miller
  2013-08-14  8:45     ` Shawn Guo
  0 siblings, 1 reply; 11+ messages in thread
From: David Miller @ 2013-08-14  7:51 UTC (permalink / raw)
  To: shawn.guo
  Cc: dinguyen, dinh.linux, nicolas.ferre, linux, plagnioj, netdev,
	linux-arm-kernel

From: Shawn Guo <shawn.guo@linaro.org>
Date: Wed, 14 Aug 2013 13:17:46 +0800

> On Tue, Aug 13, 2013 at 09:58:59AM -0500, dinguyen@altera.com wrote:
>> From: Dinh Nguyen <dinguyen@altera.com>
>> 
>> Hi Shawn,
>> 
>> Can you apply this patch to your tree for 3.12?
>> 
> 
> I need David's Ack to send the patch through IMX tree.

Acked-by: David S. Miller <davem@davemloft.net>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] phy: micrel: Add definitions for common Micrel PHY registers
  2013-08-14  7:51   ` David Miller
@ 2013-08-14  8:45     ` Shawn Guo
  2013-08-14 14:58       ` Dinh Nguyen
  0 siblings, 1 reply; 11+ messages in thread
From: Shawn Guo @ 2013-08-14  8:45 UTC (permalink / raw)
  To: David Miller
  Cc: dinguyen, dinh.linux, nicolas.ferre, linux, plagnioj, netdev,
	linux-arm-kernel

On Wed, Aug 14, 2013 at 12:51:54AM -0700, David Miller wrote:
> From: Shawn Guo <shawn.guo@linaro.org>
> Date: Wed, 14 Aug 2013 13:17:46 +0800
> 
> > On Tue, Aug 13, 2013 at 09:58:59AM -0500, dinguyen@altera.com wrote:
> >> From: Dinh Nguyen <dinguyen@altera.com>
> >> 
> >> Hi Shawn,
> >> 
> >> Can you apply this patch to your tree for 3.12?
> >> 
> > 
> > I need David's Ack to send the patch through IMX tree.
> 
> Acked-by: David S. Miller <davem@davemloft.net>

Okay, applied with David's ACK.

Shawn

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] phy: micrel: Add definitions for common Micrel PHY registers
  2013-08-14  8:45     ` Shawn Guo
@ 2013-08-14 14:58       ` Dinh Nguyen
  0 siblings, 0 replies; 11+ messages in thread
From: Dinh Nguyen @ 2013-08-14 14:58 UTC (permalink / raw)
  To: Shawn Guo
  Cc: David Miller, dinh.linux, nicolas.ferre, linux, plagnioj, netdev,
	linux-arm-kernel

On Wed, 2013-08-14 at 16:45 +0800, Shawn Guo wrote:
> On Wed, Aug 14, 2013 at 12:51:54AM -0700, David Miller wrote:
> > From: Shawn Guo <shawn.guo@linaro.org>
> > Date: Wed, 14 Aug 2013 13:17:46 +0800
> > 
> > > On Tue, Aug 13, 2013 at 09:58:59AM -0500, dinguyen@altera.com wrote:
> > >> From: Dinh Nguyen <dinguyen@altera.com>
> > >> 
> > >> Hi Shawn,
> > >> 
> > >> Can you apply this patch to your tree for 3.12?
> > >> 
> > > 
> > > I need David's Ack to send the patch through IMX tree.
> > 
> > Acked-by: David S. Miller <davem@davemloft.net>
> 
> Okay, applied with David's ACK.

Thanks,

Dinh
> 
> Shawn
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-08-14 14:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-07-15 23:08 [PATCH] phy: micrel: Add definitions for common Micrel PHY registers dinguyen
2013-07-16  0:11 ` Shawn Guo
2013-07-16  8:29 ` Nicolas Ferre
2013-07-16 14:54   ` Dinh Nguyen
2013-07-18 11:17 ` Pavel Machek
  -- strict thread matches above, loose matches on Subject: below --
2013-08-13 14:58 dinguyen
2013-08-13 14:59 ` dinguyen
2013-08-14  5:17 ` Shawn Guo
2013-08-14  7:51   ` David Miller
2013-08-14  8:45     ` Shawn Guo
2013-08-14 14:58       ` Dinh Nguyen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).