netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] net: phy: Allow EEE for all RGMII variants
@ 2015-05-15 23:30 Florian Fainelli
  2015-05-16  1:22 ` David Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Florian Fainelli @ 2015-05-15 23:30 UTC (permalink / raw)
  To: netdev; +Cc: davem, linux, peppe.cavallaro, Florian Fainelli

RGMII interfaces come in multiple flavors: RGMII with transmit or
receive internal delay, no delays at all, or delays in both direction.

This change extends the initial check for PHY_INTERFACE_MODE_RGMII to
cover all of these variants since EEE should be allowed for any of these
modes, since it is a property of the RGMII, hence Gigabit PHY capability
more than the RGMII electrical interface and its delays.

Fixes: a59a4d192166 ("phy: add the EEE support and the way to access to the MMD registers")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
David this change dates back to 3.6, however the comment update will depend on
a9f6309585cbefa4a7f08c9017ca482c3222323a ("net: phy: allow phy_init_eee() to
work with internal PHYs") to be included, which is only 3.18, nobody but me
really complained about that so I guess 3.18+ is reasonable.

 drivers/net/phy/phy.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 52cd8db2c57d..757f28a4284c 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1053,13 +1053,14 @@ int phy_init_eee(struct phy_device *phydev, bool clk_stop_enable)
 {
 	/* According to 802.3az,the EEE is supported only in full duplex-mode.
 	 * Also EEE feature is active when core is operating with MII, GMII
-	 * or RGMII. Internal PHYs are also allowed to proceed and should
-	 * return an error if they do not support EEE.
+	 * or RGMII (all kinds). Internal PHYs are also allowed to proceed and
+	 * should return an error if they do not support EEE.
 	 */
 	if ((phydev->duplex == DUPLEX_FULL) &&
 	    ((phydev->interface == PHY_INTERFACE_MODE_MII) ||
 	    (phydev->interface == PHY_INTERFACE_MODE_GMII) ||
-	    (phydev->interface == PHY_INTERFACE_MODE_RGMII) ||
+	    (phydev->interface >= PHY_INTERFACE_MODE_RGMII &&
+	     phydev->interface <= PHY_INTERFACE_MODE_RGMII_TXID) ||
 	     phy_is_internal(phydev))) {
 		int eee_lp, eee_cap, eee_adv;
 		u32 lp, cap, adv;
-- 
2.1.0

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

* Re: [PATCH net] net: phy: Allow EEE for all RGMII variants
  2015-05-15 23:30 [PATCH net] net: phy: Allow EEE for all RGMII variants Florian Fainelli
@ 2015-05-16  1:22 ` David Miller
  2015-05-16  2:01   ` Florian Fainelli
  0 siblings, 1 reply; 3+ messages in thread
From: David Miller @ 2015-05-16  1:22 UTC (permalink / raw)
  To: f.fainelli; +Cc: netdev, linux, peppe.cavallaro

From: Florian Fainelli <f.fainelli@gmail.com>
Date: Fri, 15 May 2015 16:30:41 -0700

> RGMII interfaces come in multiple flavors: RGMII with transmit or
> receive internal delay, no delays at all, or delays in both direction.
> 
> This change extends the initial check for PHY_INTERFACE_MODE_RGMII to
> cover all of these variants since EEE should be allowed for any of these
> modes, since it is a property of the RGMII, hence Gigabit PHY capability
> more than the RGMII electrical interface and its delays.
> 
> Fixes: a59a4d192166 ("phy: add the EEE support and the way to access to the MMD registers")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

This is not the first time I've seen this bug.

A helper like phydev_is_rgmii() is probably long overdue.

> David this change dates back to 3.6, however the comment update will depend on
> a9f6309585cbefa4a7f08c9017ca482c3222323a ("net: phy: allow phy_init_eee() to
> work with internal PHYs") to be included, which is only 3.18, nobody but me
> really complained about that so I guess 3.18+ is reasonable.

Ok, applied and queued up for -stable, thanks.

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

* Re: [PATCH net] net: phy: Allow EEE for all RGMII variants
  2015-05-16  1:22 ` David Miller
@ 2015-05-16  2:01   ` Florian Fainelli
  0 siblings, 0 replies; 3+ messages in thread
From: Florian Fainelli @ 2015-05-16  2:01 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, linux, peppe.cavallaro

Le 05/15/15 18:22, David Miller a écrit :
> From: Florian Fainelli <f.fainelli@gmail.com>
> Date: Fri, 15 May 2015 16:30:41 -0700
> 
>> RGMII interfaces come in multiple flavors: RGMII with transmit or
>> receive internal delay, no delays at all, or delays in both direction.
>>
>> This change extends the initial check for PHY_INTERFACE_MODE_RGMII to
>> cover all of these variants since EEE should be allowed for any of these
>> modes, since it is a property of the RGMII, hence Gigabit PHY capability
>> more than the RGMII electrical interface and its delays.
>>
>> Fixes: a59a4d192166 ("phy: add the EEE support and the way to access to the MMD registers")
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
> 
> This is not the first time I've seen this bug.
> 
> A helper like phydev_is_rgmii() is probably long overdue.

Sounds very reasonable, I will cook something which does that, thanks!

> 
>> David this change dates back to 3.6, however the comment update will depend on
>> a9f6309585cbefa4a7f08c9017ca482c3222323a ("net: phy: allow phy_init_eee() to
>> work with internal PHYs") to be included, which is only 3.18, nobody but me
>> really complained about that so I guess 3.18+ is reasonable.
> 
> Ok, applied and queued up for -stable, thanks.
> 


-- 
Florian

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

end of thread, other threads:[~2015-05-16  2:01 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-15 23:30 [PATCH net] net: phy: Allow EEE for all RGMII variants Florian Fainelli
2015-05-16  1:22 ` David Miller
2015-05-16  2:01   ` Florian Fainelli

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