From: Robert Hancock <hidden> Date: 2021-03-11 20:19:35
Some fixes to the macb driver for use in SGMII mode with a fixed-link (such as
for chip-to-chip connectivity).
Robert Hancock (2):
net: macb: poll for fixed link state in SGMII mode
net: macb: Disable PCS auto-negotiation for SGMII fixed-link mode
drivers/net/ethernet/cadence/macb.h | 14 +++++++++++
drivers/net/ethernet/cadence/macb_main.c | 30 ++++++++++++++++++++++++
2 files changed, 44 insertions(+)
--
2.27.0
From: Robert Hancock <hidden> Date: 2021-03-11 20:19:35
When using a fixed-link configuration in SGMII mode, it's not really
sensible to have auto-negotiation enabled since the link settings are
fixed by definition. In other configurations, such as an SGMII
connection to a PHY, it should generally be enabled.
Signed-off-by: Robert Hancock <redacted>
---
drivers/net/ethernet/cadence/macb.h | 14 ++++++++++++++
drivers/net/ethernet/cadence/macb_main.c | 16 ++++++++++++++++
2 files changed, 30 insertions(+)
From: Robert Hancock <hidden> Date: 2021-03-11 20:19:35
When using a fixed-link configuration with GEM in SGMII mode, such as
for a chip-to-chip interconnect, the link state was always showing as
established regardless of the actual connectivity state. We can monitor
the pcs_link_state bit in the Network Status register to determine
whether the PCS link state is actually up.
Signed-off-by: Robert Hancock <redacted>
---
drivers/net/ethernet/cadence/macb_main.c | 14 ++++++++++++++
1 file changed, 14 insertions(+)
@@ -847,6 +847,15 @@ static int macb_phylink_connect(struct macb *bp)return0;}+staticvoidmacb_get_pcs_fixed_state(structphylink_config*config,+structphylink_link_state*state)+{+structnet_device*ndev=to_net_dev(config->dev);+structmacb*bp=netdev_priv(ndev);++state->link=(macb_readl(bp,NSR)&MACB_BIT(NSR_LINK))!=0;+}+/* based on au1000_eth. c*/staticintmacb_mii_probe(structnet_device*dev){
@@ -855,6 +864,11 @@ static int macb_mii_probe(struct net_device *dev)bp->phylink_config.dev=&dev->dev;bp->phylink_config.type=PHYLINK_NETDEV;+if(bp->phy_interface==PHY_INTERFACE_MODE_SGMII){+bp->phylink_config.poll_fixed_state=true;+bp->phylink_config.get_fixed_state=macb_get_pcs_fixed_state;+}+bp->phylink=phylink_create(&bp->phylink_config,bp->pdev->dev.fwnode,bp->phy_interface,&macb_phylink_ops);if(IS_ERR(bp->phylink)){
From: Andrew Lunn <andrew@lunn.ch> Date: 2021-03-13 01:46:28
On Thu, Mar 11, 2021 at 02:18:13PM -0600, Robert Hancock wrote:
When using a fixed-link configuration in SGMII mode, it's not really
sensible to have auto-negotiation enabled since the link settings are
fixed by definition. In other configurations, such as an SGMII
connection to a PHY, it should generally be enabled.
So how do you tell the PCS it should be doing 10Mbps over the SGMII
link? I'm assuming it is the PCS which does the bit replication, not
the MAC?
I'm surprised you are even using SGMII with a fixed link. 1000BaseX is
the norm, and then you don't need to worry about the speed.
Andrew
From: Robert Hancock <hidden> Date: 2021-03-14 23:23:21
On Sat, 2021-03-13 at 02:45 +0100, Andrew Lunn wrote:
On Thu, Mar 11, 2021 at 02:18:13PM -0600, Robert Hancock wrote:
quoted
When using a fixed-link configuration in SGMII mode, it's not really
sensible to have auto-negotiation enabled since the link settings are
fixed by definition. In other configurations, such as an SGMII
connection to a PHY, it should generally be enabled.
So how do you tell the PCS it should be doing 10Mbps over the SGMII
link? I'm assuming it is the PCS which does the bit replication, not
the MAC?
I'm not sure if this is the same for all devices using this Cadence IP, but the
register documentation I have for the Xilinx UltraScale+ MPSoC we are using
indicates this PCS is only capable of 1000 Mbps speeds:
https://www.xilinx.com/html_docs/registers/ug1087/gem___pcs_control.html
So it doesn't actually seem applicable in this case.
I'm surprised you are even using SGMII with a fixed link. 1000BaseX is
the norm, and then you don't need to worry about the speed.
That would be a bit simpler, yes - but it seems like this hardware is set up
more for SGMII mode - it's not entirely clear to me that 1000BaseX is supported
in the hardware, and it's not currently supported in the driver that I can see.
--
Robert Hancock
Senior Hardware Designer, Calian Advanced Technologies
www.calian.com
From: Andrew Lunn <andrew@lunn.ch> Date: 2021-03-15 01:12:19
On Sun, Mar 14, 2021 at 11:22:03PM +0000, Robert Hancock wrote:
On Sat, 2021-03-13 at 02:45 +0100, Andrew Lunn wrote:
quoted
On Thu, Mar 11, 2021 at 02:18:13PM -0600, Robert Hancock wrote:
quoted
When using a fixed-link configuration in SGMII mode, it's not really
sensible to have auto-negotiation enabled since the link settings are
fixed by definition. In other configurations, such as an SGMII
connection to a PHY, it should generally be enabled.
So how do you tell the PCS it should be doing 10Mbps over the SGMII
link? I'm assuming it is the PCS which does the bit replication, not
the MAC?
I'm not sure if this is the same for all devices using this Cadence IP, but the
register documentation I have for the Xilinx UltraScale+ MPSoC we are using
indicates this PCS is only capable of 1000 Mbps speeds:
https://www.xilinx.com/html_docs/registers/ug1087/gem___pcs_control.html
So it doesn't actually seem applicable in this case.
quoted
I'm surprised you are even using SGMII with a fixed link. 1000BaseX is
the norm, and then you don't need to worry about the speed.
That would be a bit simpler, yes - but it seems like this hardware is set up
more for SGMII mode - it's not entirely clear to me that 1000BaseX is supported
in the hardware, and it's not currently supported in the driver that I can see.
This hardware just seems odd. If it was not for the fact the
documentation say SGMII all over the place, i would be temped to say
it is actually doing 1000BaseX.
Assuming the documentation is not totally wrong, your code seems
sensible for the hardware.
Andrew