All of lore.kernel.org
 help / color / mirror / Atom feed
From: nicolas.ferre@atmel.com (Nicolas Ferre)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] phy: micrel: Add definitions for common Micrel PHY registers
Date: Tue, 16 Jul 2013 10:29:32 +0200	[thread overview]
Message-ID: <51E5046C.60101@atmel.com> (raw)
In-Reply-To: <1373929730-28130-1-git-send-email-dinguyen@altera.com>

On 16/07/2013 01:08, dinguyen at 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

WARNING: multiple messages have this Message-ID (diff)
From: Nicolas Ferre <nicolas.ferre@atmel.com>
To: <dinguyen@altera.com>
Cc: <dinh.linux@gmail.com>, <netdev@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	"David S. Miller" <davem@davemloft.net>,
	Shawn Guo <shawn.guo@linaro.org>,
	Andrew Victor <linux@maxim.org.za>,
	Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com>,
	Pavel Machek <pavel@denx.de>
Subject: Re: [PATCH] phy: micrel: Add definitions for common Micrel PHY registers
Date: Tue, 16 Jul 2013 10:29:32 +0200	[thread overview]
Message-ID: <51E5046C.60101@atmel.com> (raw)
In-Reply-To: <1373929730-28130-1-git-send-email-dinguyen@altera.com>

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

  parent reply	other threads:[~2013-07-16  8:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-15 23:08 [PATCH] phy: micrel: Add definitions for common Micrel PHY registers dinguyen at altera.com
2013-07-15 23:08 ` dinguyen
2013-07-16  0:11 ` Shawn Guo
2013-07-16  0:11   ` Shawn Guo
2013-07-16  8:29 ` Nicolas Ferre [this message]
2013-07-16  8:29   ` Nicolas Ferre
2013-07-16 14:54   ` Dinh Nguyen
2013-07-16 14:54     ` Dinh Nguyen
2013-07-18 11:17 ` Pavel Machek
2013-07-18 11:17   ` Pavel Machek
  -- strict thread matches above, loose matches on Subject: below --
2013-08-13 14:58 dinguyen at altera.com
2013-08-13 14:58 ` dinguyen
2013-08-13 14:59 ` dinguyen at altera.com
2013-08-13 14:59   ` dinguyen
2013-08-14  5:17 ` Shawn Guo
2013-08-14  5:17   ` Shawn Guo
2013-08-14  7:51   ` David Miller
2013-08-14  7:51     ` David Miller
2013-08-14  8:45     ` Shawn Guo
2013-08-14  8:45       ` Shawn Guo
2013-08-14 14:58       ` Dinh Nguyen
2013-08-14 14:58         ` Dinh Nguyen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51E5046C.60101@atmel.com \
    --to=nicolas.ferre@atmel.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.