netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: phy: Add detection of 1000BaseX link mode support
@ 2019-06-04 22:15 Robert Hancock
  2019-06-06  1:42 ` David Miller
  2019-06-06 20:49 ` David Miller
  0 siblings, 2 replies; 5+ messages in thread
From: Robert Hancock @ 2019-06-04 22:15 UTC (permalink / raw)
  To: netdev; +Cc: andrew, f.fainelli, hkallweit1, Robert Hancock

Add 1000BaseX to the link modes which are detected based on the
MII_ESTATUS register as per 802.3 Clause 22. This allows PHYs which
support 1000BaseX to work properly with drivers using phylink.

Previously 1000BaseX support was not detected, and if that was the only
mode the PHY indicated support for, phylink would refuse to attach it
due to the list of supported modes being empty.

Signed-off-by: Robert Hancock <hancock@sedsystems.ca>
---
 drivers/net/phy/phy_device.c | 3 +++
 include/uapi/linux/mii.h     | 2 ++
 2 files changed, 5 insertions(+)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 2c879ba..03c885e 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -1930,6 +1930,9 @@ int genphy_config_init(struct phy_device *phydev)
 		if (val & ESTATUS_1000_THALF)
 			linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseT_Half_BIT,
 					 features);
+		if (val & ESTATUS_1000_XFULL)
+			linkmode_set_bit(ETHTOOL_LINK_MODE_1000baseX_Full_BIT,
+					 features);
 	}
 
 	linkmode_and(phydev->supported, phydev->supported, features);
diff --git a/include/uapi/linux/mii.h b/include/uapi/linux/mii.h
index a506216..51b48e4 100644
--- a/include/uapi/linux/mii.h
+++ b/include/uapi/linux/mii.h
@@ -121,6 +121,8 @@
 #define EXPANSION_MFAULTS	0x0010	/* Multiple faults detected    */
 #define EXPANSION_RESV		0xffe0	/* Unused...                   */
 
+#define ESTATUS_1000_XFULL	0x8000	/* Can do 1000BaseX Full       */
+#define ESTATUS_1000_XHALF	0x4000	/* Can do 1000BaseX Half       */
 #define ESTATUS_1000_TFULL	0x2000	/* Can do 1000BT Full          */
 #define ESTATUS_1000_THALF	0x1000	/* Can do 1000BT Half          */
 
-- 
1.8.3.1


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

* Re: [PATCH net-next] net: phy: Add detection of 1000BaseX link mode support
  2019-06-04 22:15 [PATCH net-next] net: phy: Add detection of 1000BaseX link mode support Robert Hancock
@ 2019-06-06  1:42 ` David Miller
  2019-06-06  6:05   ` Heiner Kallweit
  2019-06-06 20:49 ` David Miller
  1 sibling, 1 reply; 5+ messages in thread
From: David Miller @ 2019-06-06  1:42 UTC (permalink / raw)
  To: hancock; +Cc: netdev, andrew, f.fainelli, hkallweit1

From: Robert Hancock <hancock@sedsystems.ca>
Date: Tue,  4 Jun 2019 16:15:01 -0600

> Add 1000BaseX to the link modes which are detected based on the
> MII_ESTATUS register as per 802.3 Clause 22. This allows PHYs which
> support 1000BaseX to work properly with drivers using phylink.
> 
> Previously 1000BaseX support was not detected, and if that was the only
> mode the PHY indicated support for, phylink would refuse to attach it
> due to the list of supported modes being empty.
> 
> Signed-off-by: Robert Hancock <hancock@sedsystems.ca>

Andrew/Florian/Heiner, is there a reason we left out the handling of these
ESTATUS bits?


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

* Re: [PATCH net-next] net: phy: Add detection of 1000BaseX link mode support
  2019-06-06  1:42 ` David Miller
@ 2019-06-06  6:05   ` Heiner Kallweit
  2019-06-06 12:27     ` Andrew Lunn
  0 siblings, 1 reply; 5+ messages in thread
From: Heiner Kallweit @ 2019-06-06  6:05 UTC (permalink / raw)
  To: David Miller, hancock; +Cc: netdev, andrew, f.fainelli

On 06.06.2019 03:42, David Miller wrote:
> From: Robert Hancock <hancock@sedsystems.ca>
> Date: Tue,  4 Jun 2019 16:15:01 -0600
> 
>> Add 1000BaseX to the link modes which are detected based on the
>> MII_ESTATUS register as per 802.3 Clause 22. This allows PHYs which
>> support 1000BaseX to work properly with drivers using phylink.
>>
>> Previously 1000BaseX support was not detected, and if that was the only
>> mode the PHY indicated support for, phylink would refuse to attach it
>> due to the list of supported modes being empty.
>>
>> Signed-off-by: Robert Hancock <hancock@sedsystems.ca>
> 
> Andrew/Florian/Heiner, is there a reason we left out the handling of these
> ESTATUS bits?
> 
> 
I can only guess here:
In the beginning phylib took care of BaseT modes only. Once drivers for
BaseX modes were added the authors dealt with it in the drivers directly
instead of extending the core.

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

* Re: [PATCH net-next] net: phy: Add detection of 1000BaseX link mode support
  2019-06-06  6:05   ` Heiner Kallweit
@ 2019-06-06 12:27     ` Andrew Lunn
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Lunn @ 2019-06-06 12:27 UTC (permalink / raw)
  To: Heiner Kallweit; +Cc: David Miller, hancock, netdev, f.fainelli

On Thu, Jun 06, 2019 at 08:05:31AM +0200, Heiner Kallweit wrote:
> On 06.06.2019 03:42, David Miller wrote:
> > From: Robert Hancock <hancock@sedsystems.ca>
> > Date: Tue,  4 Jun 2019 16:15:01 -0600
> > 
> >> Add 1000BaseX to the link modes which are detected based on the
> >> MII_ESTATUS register as per 802.3 Clause 22. This allows PHYs which
> >> support 1000BaseX to work properly with drivers using phylink.
> >>
> >> Previously 1000BaseX support was not detected, and if that was the only
> >> mode the PHY indicated support for, phylink would refuse to attach it
> >> due to the list of supported modes being empty.
> >>
> >> Signed-off-by: Robert Hancock <hancock@sedsystems.ca>
> > 
> > Andrew/Florian/Heiner, is there a reason we left out the handling of these
> > ESTATUS bits?
> > 
> > 
> I can only guess here:
> In the beginning phylib took care of BaseT modes only. Once drivers for
> BaseX modes were added the authors dealt with it in the drivers directly
> instead of extending the core.

That seems like a reasonable guess. Also, SFPs are also reasonably new
in this field, so using a PHY as a media converter like this was not
needed before.

       Andrew

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

* Re: [PATCH net-next] net: phy: Add detection of 1000BaseX link mode support
  2019-06-04 22:15 [PATCH net-next] net: phy: Add detection of 1000BaseX link mode support Robert Hancock
  2019-06-06  1:42 ` David Miller
@ 2019-06-06 20:49 ` David Miller
  1 sibling, 0 replies; 5+ messages in thread
From: David Miller @ 2019-06-06 20:49 UTC (permalink / raw)
  To: hancock; +Cc: netdev, andrew, f.fainelli, hkallweit1

From: Robert Hancock <hancock@sedsystems.ca>
Date: Tue,  4 Jun 2019 16:15:01 -0600

> Add 1000BaseX to the link modes which are detected based on the
> MII_ESTATUS register as per 802.3 Clause 22. This allows PHYs which
> support 1000BaseX to work properly with drivers using phylink.
> 
> Previously 1000BaseX support was not detected, and if that was the only
> mode the PHY indicated support for, phylink would refuse to attach it
> due to the list of supported modes being empty.
> 
> Signed-off-by: Robert Hancock <hancock@sedsystems.ca>

Applied, thanks.

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

end of thread, other threads:[~2019-06-06 20:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-04 22:15 [PATCH net-next] net: phy: Add detection of 1000BaseX link mode support Robert Hancock
2019-06-06  1:42 ` David Miller
2019-06-06  6:05   ` Heiner Kallweit
2019-06-06 12:27     ` Andrew Lunn
2019-06-06 20:49 ` David Miller

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