diff mbox series

[3/4] net: dsa: microchip: Disable RGMII in-band status on KSZ9893

Message ID 20200905140325.108846-4-pbarker@konsulko.com
State Changes Requested
Delegated to: David Miller
Headers show
Series ksz9477 dsa switch driver improvements | expand

Commit Message

Paul Barker Sept. 5, 2020, 2:03 p.m. UTC
We can't assume that the link partner supports the in-band status
reporting which is enabled by default on the KSZ9893 when using RGMII
for the upstream port.

Signed-off-by: Paul Barker <pbarker@konsulko.com>
---
 drivers/net/dsa/microchip/ksz9477.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Andrew Lunn Sept. 5, 2020, 3:32 p.m. UTC | #1
On Sat, Sep 05, 2020 at 03:03:24PM +0100, Paul Barker wrote:
> We can't assume that the link partner supports the in-band status
> reporting which is enabled by default on the KSZ9893 when using RGMII
> for the upstream port.

What do you mean by RGMII inband status reporting? SGMII/1000BaseX has
in band signalling, but RGMII?

   Andrew
Paul Barker Sept. 5, 2020, 3:53 p.m. UTC | #2
On Sat, 5 Sep 2020 at 16:32, Andrew Lunn <andrew@lunn.ch> wrote:
>
> On Sat, Sep 05, 2020 at 03:03:24PM +0100, Paul Barker wrote:
> > We can't assume that the link partner supports the in-band status
> > reporting which is enabled by default on the KSZ9893 when using RGMII
> > for the upstream port.
>
> What do you mean by RGMII inband status reporting? SGMII/1000BaseX has
> in band signalling, but RGMII?
>
>    Andrew

I'm referencing page 56 of the KSZ9893 datasheet
(http://ww1.microchip.com/downloads/en/DeviceDoc/KSZ9893R-Data-Sheet-DS00002420D.pdf).
The datasheet says "The RGMII port will not function properly if IBS
is enabled in the switch, but it is not receiving in-band status from
a connected PHY." Since we can't guarantee all possible link partners
will support this it should be disabled. In particular, the IMX6 SoC
we're using with this switch doesn't support this on its Ethernet
port.

I don't really know much about how this is implemented or how widely
it's supported.

Thanks,
Florian Fainelli Sept. 5, 2020, 4:04 p.m. UTC | #3
On 9/5/2020 8:53 AM, Paul Barker wrote:
> On Sat, 5 Sep 2020 at 16:32, Andrew Lunn <andrew@lunn.ch> wrote:
>>
>> On Sat, Sep 05, 2020 at 03:03:24PM +0100, Paul Barker wrote:
>>> We can't assume that the link partner supports the in-band status
>>> reporting which is enabled by default on the KSZ9893 when using RGMII
>>> for the upstream port.
>>
>> What do you mean by RGMII inband status reporting? SGMII/1000BaseX has
>> in band signalling, but RGMII?
>>
>>     Andrew
> 
> I'm referencing page 56 of the KSZ9893 datasheet
> (http://ww1.microchip.com/downloads/en/DeviceDoc/KSZ9893R-Data-Sheet-DS00002420D.pdf).
> The datasheet says "The RGMII port will not function properly if IBS
> is enabled in the switch, but it is not receiving in-band status from
> a connected PHY." Since we can't guarantee all possible link partners
> will support this it should be disabled. In particular, the IMX6 SoC
> we're using with this switch doesn't support this on its Ethernet
> port.

The RGMII 2.0 specification, pages 7 and 8 has more details:

http://web.archive.org/web/20160303171328/http://www.hp.com/rnd/pdfs/RGMIIv2_0_final_hp.pdf

and section 3.4.1 indicates that this is optional anyway for link 
status/speed/duplex.

It comes down to putting a appropriate data word on RXD[7:0] to signal 
link status, speed and speed, if the link partner does not provide the 
inter-frame word, then the receiver cannot reconstruct that information, 
or it will incorrectly decode it.

> 
> I don't really know much about how this is implemented or how widely
> it's supported.

It is supported by the Broadcom GENET adapter and probably a few others, 
however for the same reasons, I have not seen it being widely used. You 
would save two reads of BMSR to determine the link status which is nice, 
but link parameter changes are disruptive anyway.
Andrew Lunn Sept. 5, 2020, 4:06 p.m. UTC | #4
On Sat, Sep 05, 2020 at 04:53:20PM +0100, Paul Barker wrote:
> On Sat, 5 Sep 2020 at 16:32, Andrew Lunn <andrew@lunn.ch> wrote:
> >
> > On Sat, Sep 05, 2020 at 03:03:24PM +0100, Paul Barker wrote:
> > > We can't assume that the link partner supports the in-band status
> > > reporting which is enabled by default on the KSZ9893 when using RGMII
> > > for the upstream port.
> >
> > What do you mean by RGMII inband status reporting? SGMII/1000BaseX has
> > in band signalling, but RGMII?
> >
> >    Andrew
> 
> I'm referencing page 56 of the KSZ9893 datasheet
> (http://ww1.microchip.com/downloads/en/DeviceDoc/KSZ9893R-Data-Sheet-DS00002420D.pdf).
> The datasheet says "The RGMII port will not function properly if IBS
> is enabled in the switch, but it is not receiving in-band status from
> a connected PHY." Since we can't guarantee all possible link partners
> will support this it should be disabled. In particular, the IMX6 SoC
> we're using with this switch doesn't support this on its Ethernet
> port.
> 
> I don't really know much about how this is implemented or how widely
> it's supported.

I never knew RGMII had this. What i did find was:

http://web.archive.org/web/20160303171328/http://www.hp.com/rnd/pdfs/RGMIIv2_0_final_hp.pdf

which does talk about it, section 3.4.1. It is clearly optional, and
since this is the first time i've heard of it, i suspect not many
systems actually implement it. So turning it off seems wise.

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew
diff mbox series

Patch

diff --git a/drivers/net/dsa/microchip/ksz9477.c b/drivers/net/dsa/microchip/ksz9477.c
index 3e36aa628c9f..2c953ab6ce16 100644
--- a/drivers/net/dsa/microchip/ksz9477.c
+++ b/drivers/net/dsa/microchip/ksz9477.c
@@ -1240,6 +1240,9 @@  static void ksz9477_port_setup(struct ksz_device *dev, int port, bool cpu_port)
 			if (dev->interface == PHY_INTERFACE_MODE_RGMII_ID ||
 			    dev->interface == PHY_INTERFACE_MODE_RGMII_TXID)
 				data8 |= PORT_RGMII_ID_EG_ENABLE;
+			/* On KSZ9893, disable RGMII in-band status support */
+			if (dev->features & IS_9893)
+				data8 &= ~PORT_MII_MAC_MODE;
 			p->phydev.speed = SPEED_1000;
 			break;
 		}