linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: phy: Allow BCM54616S PHY to setup internal TX/RX clock delay
@ 2018-11-05 22:35 Tao Ren
  2018-11-05 22:40 ` Florian Fainelli
  2018-11-06 19:17 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Tao Ren @ 2018-11-05 22:35 UTC (permalink / raw)
  To: Andrew Lunn, Florian Fainelli, David S . Miller, netdev, linux-kernel
  Cc: Tao Ren, openbmc

This patch allows users to enable/disable internal TX and/or RX clock
delay for BCM54616S PHYs so as to satisfy RGMII timing specifications.

On a particular platform, whether TX and/or RX clock delay is required
depends on how PHY connected to the MAC IP. This requirement can be
specified through "phy-mode" property in the platform device tree.

The patch is inspired by commit 733336262b28 ("net: phy: Allow BCM5481x
PHYs to setup internal TX/RX clock delay").

Signed-off-by: Tao Ren <taoren@fb.com>
---
 drivers/net/phy/broadcom.c | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
index e86ea105c802..704537010453 100644
--- a/drivers/net/phy/broadcom.c
+++ b/drivers/net/phy/broadcom.c
@@ -92,7 +92,7 @@ static int bcm54612e_config_init(struct phy_device *phydev)
 	return 0;
 }
 
-static int bcm5481x_config(struct phy_device *phydev)
+static int bcm54xx_config_clock_delay(struct phy_device *phydev)
 {
 	int rc, val;
 
@@ -429,7 +429,7 @@ static int bcm5481_config_aneg(struct phy_device *phydev)
 	ret = genphy_config_aneg(phydev);
 
 	/* Then we can set up the delay. */
-	bcm5481x_config(phydev);
+	bcm54xx_config_clock_delay(phydev);
 
 	if (of_property_read_bool(np, "enet-phy-lane-swap")) {
 		/* Lane Swap - Undocumented register...magic! */
@@ -442,6 +442,19 @@ static int bcm5481_config_aneg(struct phy_device *phydev)
 	return ret;
 }
 
+static int bcm54616s_config_aneg(struct phy_device *phydev)
+{
+	int ret;
+
+	/* Aneg firsly. */
+	ret = genphy_config_aneg(phydev);
+
+	/* Then we can set up the delay. */
+	bcm54xx_config_clock_delay(phydev);
+
+	return ret;
+}
+
 static int brcm_phy_setbits(struct phy_device *phydev, int reg, int set)
 {
 	int val;
@@ -636,6 +649,7 @@ static struct phy_driver broadcom_drivers[] = {
 	.features	= PHY_GBIT_FEATURES,
 	.flags		= PHY_HAS_INTERRUPT,
 	.config_init	= bcm54xx_config_init,
+	.config_aneg	= bcm54616s_config_aneg,
 	.ack_interrupt	= bcm_phy_ack_intr,
 	.config_intr	= bcm_phy_config_intr,
 }, {
-- 
2.17.1


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

* Re: [PATCH net] net: phy: Allow BCM54616S PHY to setup internal TX/RX clock delay
  2018-11-05 22:35 [PATCH net] net: phy: Allow BCM54616S PHY to setup internal TX/RX clock delay Tao Ren
@ 2018-11-05 22:40 ` Florian Fainelli
  2018-11-05 23:03   ` Tao Ren
  2018-11-06 19:17 ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: Florian Fainelli @ 2018-11-05 22:40 UTC (permalink / raw)
  To: Tao Ren, Andrew Lunn, David S . Miller, netdev, linux-kernel; +Cc: openbmc

On 11/5/18 2:35 PM, Tao Ren wrote:
> This patch allows users to enable/disable internal TX and/or RX clock
> delay for BCM54616S PHYs so as to satisfy RGMII timing specifications.
> 
> On a particular platform, whether TX and/or RX clock delay is required
> depends on how PHY connected to the MAC IP. This requirement can be
> specified through "phy-mode" property in the platform device tree.
> 
> The patch is inspired by commit 733336262b28 ("net: phy: Allow BCM5481x
> PHYs to setup internal TX/RX clock delay").

I will let David be the judge whether this is appropriate as a bugfix
(thus targeting the "net" tree) or a feature, which would have to wait
for net-next to re-open.

> 
> Signed-off-by: Tao Ren <taoren@fb.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

> ---
>  drivers/net/phy/broadcom.c | 18 ++++++++++++++++--
>  1 file changed, 16 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/net/phy/broadcom.c b/drivers/net/phy/broadcom.c
> index e86ea105c802..704537010453 100644
> --- a/drivers/net/phy/broadcom.c
> +++ b/drivers/net/phy/broadcom.c
> @@ -92,7 +92,7 @@ static int bcm54612e_config_init(struct phy_device *phydev)
>  	return 0;
>  }
>  
> -static int bcm5481x_config(struct phy_device *phydev)
> +static int bcm54xx_config_clock_delay(struct phy_device *phydev)
>  {
>  	int rc, val;
>  
> @@ -429,7 +429,7 @@ static int bcm5481_config_aneg(struct phy_device *phydev)
>  	ret = genphy_config_aneg(phydev);
>  
>  	/* Then we can set up the delay. */
> -	bcm5481x_config(phydev);
> +	bcm54xx_config_clock_delay(phydev);
>  
>  	if (of_property_read_bool(np, "enet-phy-lane-swap")) {
>  		/* Lane Swap - Undocumented register...magic! */
> @@ -442,6 +442,19 @@ static int bcm5481_config_aneg(struct phy_device *phydev)
>  	return ret;
>  }
>  
> +static int bcm54616s_config_aneg(struct phy_device *phydev)
> +{
> +	int ret;
> +
> +	/* Aneg firsly. */
> +	ret = genphy_config_aneg(phydev);
> +
> +	/* Then we can set up the delay. */
> +	bcm54xx_config_clock_delay(phydev);
> +
> +	return ret;
> +}
> +
>  static int brcm_phy_setbits(struct phy_device *phydev, int reg, int set)
>  {
>  	int val;
> @@ -636,6 +649,7 @@ static struct phy_driver broadcom_drivers[] = {
>  	.features	= PHY_GBIT_FEATURES,
>  	.flags		= PHY_HAS_INTERRUPT,
>  	.config_init	= bcm54xx_config_init,
> +	.config_aneg	= bcm54616s_config_aneg,
>  	.ack_interrupt	= bcm_phy_ack_intr,
>  	.config_intr	= bcm_phy_config_intr,
>  }, {
> 


-- 
Florian

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

* Re: [PATCH net] net: phy: Allow BCM54616S PHY to setup internal TX/RX clock delay
  2018-11-05 22:40 ` Florian Fainelli
@ 2018-11-05 23:03   ` Tao Ren
  0 siblings, 0 replies; 5+ messages in thread
From: Tao Ren @ 2018-11-05 23:03 UTC (permalink / raw)
  To: Florian Fainelli, Andrew Lunn, David S . Miller, netdev, linux-kernel
  Cc: openbmc

On 11/5/18 2:40 PM, Florian Fainelli wrote:

> I will let David be the judge whether this is appropriate as a bugfix
> (thus targeting the "net" tree) or a feature, which would have to wait
> for net-next to re-open.

Sure.

>> Signed-off-by: Tao Ren <taoren@fb.com>
> 
> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

Thank you Florian for the quick review!

Thanks,
Tao Ren

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

* Re: [PATCH net] net: phy: Allow BCM54616S PHY to setup internal TX/RX clock delay
  2018-11-05 22:35 [PATCH net] net: phy: Allow BCM54616S PHY to setup internal TX/RX clock delay Tao Ren
  2018-11-05 22:40 ` Florian Fainelli
@ 2018-11-06 19:17 ` David Miller
  2018-11-06 19:42   ` Tao Ren
  1 sibling, 1 reply; 5+ messages in thread
From: David Miller @ 2018-11-06 19:17 UTC (permalink / raw)
  To: taoren; +Cc: andrew, f.fainelli, netdev, linux-kernel, openbmc

From: Tao Ren <taoren@fb.com>
Date: Mon, 5 Nov 2018 14:35:40 -0800

> This patch allows users to enable/disable internal TX and/or RX clock
> delay for BCM54616S PHYs so as to satisfy RGMII timing specifications.
> 
> On a particular platform, whether TX and/or RX clock delay is required
> depends on how PHY connected to the MAC IP. This requirement can be
> specified through "phy-mode" property in the platform device tree.
> 
> The patch is inspired by commit 733336262b28 ("net: phy: Allow BCM5481x
> PHYs to setup internal TX/RX clock delay").
> 
> Signed-off-by: Tao Ren <taoren@fb.com>

This is fine for 'net', applied, thanks.

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

* Re: [PATCH net] net: phy: Allow BCM54616S PHY to setup internal TX/RX clock delay
  2018-11-06 19:17 ` David Miller
@ 2018-11-06 19:42   ` Tao Ren
  0 siblings, 0 replies; 5+ messages in thread
From: Tao Ren @ 2018-11-06 19:42 UTC (permalink / raw)
  To: David Miller; +Cc: andrew, f.fainelli, netdev, linux-kernel, openbmc

On 11/6/18 11:17 AM, David Miller wrote:
> From: Tao Ren <taoren@fb.com>
> Date: Mon, 5 Nov 2018 14:35:40 -0800
> 
>> This patch allows users to enable/disable internal TX and/or RX clock
>> delay for BCM54616S PHYs so as to satisfy RGMII timing specifications.
>>
>> On a particular platform, whether TX and/or RX clock delay is required
>> depends on how PHY connected to the MAC IP. This requirement can be
>> specified through "phy-mode" property in the platform device tree.
>>
>> The patch is inspired by commit 733336262b28 ("net: phy: Allow BCM5481x
>> PHYs to setup internal TX/RX clock delay").
>>
>> Signed-off-by: Tao Ren <taoren@fb.com>
> 
> This is fine for 'net', applied, thanks.

Thanks David for the quick action.

- Tao Ren

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

end of thread, other threads:[~2018-11-06 19:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-05 22:35 [PATCH net] net: phy: Allow BCM54616S PHY to setup internal TX/RX clock delay Tao Ren
2018-11-05 22:40 ` Florian Fainelli
2018-11-05 23:03   ` Tao Ren
2018-11-06 19:17 ` David Miller
2018-11-06 19:42   ` Tao Ren

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).