Skip to contentSkip to conversation

net: bcmgenet: Don't set ID_MODE_DIS when not using RGMII

PATCH New Nicolas Saenz Julienne 3 participants 8 messages Feb 20, 2020 – Mar 11, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: bcmgenet: Don't set ID_MODE_DIS when not using RGMII

As per Linux's driver, ID_MODE_DIS is only set when the PHY interface is RGMII. Don't enable it for the rest of setups.

This has been seen to misconfigure RPi4's PHY when booting Linux.

---
 drivers/net/bcmgenet.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/bcmgenet.c +4 -1
index 8f4848aec6..e971b556ac 100644
@@ -448,7 +448,10 @@ static int bcmgenet_adjust_link(struct bcmgenet_eth_priv *priv)
 	}
 
 	clrsetbits_32(priv->mac_reg + EXT_RGMII_OOB_CTRL, OOB_DISABLE,
-			RGMII_LINK | RGMII_MODE_EN | ID_MODE_DIS);
+			RGMII_LINK | RGMII_MODE_EN);
+
+	if (phy_dev->interface == PHY_INTERFACE_MODE_RGMII)
+		setbits_32(priv->mac_reg + EXT_RGMII_OOB_CTRL, ID_MODE_DIS);
 
 	writel(speed << CMD_SPEED_SHIFT, (priv->mac_reg + UMAC_CMD));
 
Signature · 1 line
2.25.0
#1 lore raw

PATCH 1/1 net: bcmgenet: Don't set ID_MODE_DIS when not using RGMII

Quoted 6 lines · Nicolas Saenz Julienne

As per Linux's driver, ID_MODE_DIS is only set when the PHY interface is RGMII. Don't enable it for the rest of setups.

This has been seen to misconfigure RPi4's PHY when booting Linux.

I forgot to add:

Fixes d53e3fa385 ("net: Add support for Broadcom GENETv5 Ethernet controller")

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200220/9d3f1075/attachment-0001.sig>

#2 lore raw

PATCH 1/1 net: bcmgenet: Don't set ID_MODE_DIS when not using RGMII

Quoted 4 lines · Nicolas Saenz Julienne
Quoted 3 lines · Nicolas Saenz Julienne

As per Linux's driver, ID_MODE_DIS is only set when the PHY interface is RGMII. Don't enable it for the rest of setups.

Quoted 8 lines
Quoted 3 lines

This has been seen to misconfigure RPi4's PHY when booting Linux.

I forgot to add:

Fixes d53e3fa385 ("net: Add support for Broadcom GENETv5 Ethernet

controller")

Ping :)

Regards,
Nicolas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200311/81793e0e/attachment.sig>

#3 lore raw

PATCH 1/1 net: bcmgenet: Don't set ID_MODE_DIS when not using RGMII

In reply to Nicolas Saenz Julienne
Quoted 15 lines · Nicolas Saenz Julienne

As per Linux's driver, ID_MODE_DIS is only set when the PHY interface is RGMII. Don't enable it for the rest of setups.

This has been seen to misconfigure RPi4's PHY when booting Linux.

---
 drivers/net/bcmgenet.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/bcmgenet.c +0 -0
index 8f4848aec6..e971b556ac 100644

drivers/net/bcmgenet.c static int bcmgenet_adjust_link(struct bcmgenet_eth_priv *priv) · line 454

Quoted 8 lines
drivers/net/bcmgenet.c +4 -1
@@ -448,7 +448,10 @@ static int bcmgenet_adjust_link(struct bcmgenet_eth_priv *priv)
 	}
 
 	clrsetbits_32(priv->mac_reg + EXT_RGMII_OOB_CTRL, OOB_DISABLE,
-			RGMII_LINK | RGMII_MODE_EN | ID_MODE_DIS);
+			RGMII_LINK | RGMII_MODE_EN);
+
+	if (phy_dev->interface == PHY_INTERFACE_MODE_RGMII)
+		setbits_32(priv->mac_reg + EXT_RGMII_OOB_CTRL, ID_MODE_DIS);

Is this given because by different DTS? Shouldn't that be uniform on the RPi4?

BTW Joe, will you take patches for this driver through your branch? For now I delegated it to me, but I'm fine either way.

Regards,
Matthias

Quoted 4 lines
drivers/net/bcmgenet.c +0 -0
 	writel(speed << CMD_SPEED_SHIFT, (priv->mac_reg + UMAC_CMD));
 
 
#4 lore raw

PATCH 1/1 net: bcmgenet: Don't set ID_MODE_DIS when not using RGMII

Hi Matthias,

Quoted 20 lines · Matthias Brugger
Quoted 18 lines · Nicolas Saenz Julienne

As per Linux's driver, ID_MODE_DIS is only set when the PHY interface is RGMII. Don't enable it for the rest of setups.

This has been seen to misconfigure RPi4's PHY when booting Linux.

---
 drivers/net/bcmgenet.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/bcmgenet.c +0 -0
index 8f4848aec6..e971b556ac 100644
@@ -448,7 +448,10 @@ static int bcmgenet_adjust_link(struct
 bcmgenet_eth_priv *priv)
 	}
 
Quoted 8 lines

drivers/net/bcmgenet.c static int bcmgenet_adjust_link(struct bcmgenet_eth_priv *priv) · line 454

Quoted 6 lines
drivers/net/bcmgenet.c +4 -1
 	clrsetbits_32(priv->mac_reg + EXT_RGMII_OOB_CTRL, OOB_DISABLE,
-			RGMII_LINK | RGMII_MODE_EN | ID_MODE_DIS);
+			RGMII_LINK | RGMII_MODE_EN);
+
+	if (phy_dev->interface == PHY_INTERFACE_MODE_RGMII)
+		setbits_32(priv->mac_reg + EXT_RGMII_OOB_CTRL, ID_MODE_DIS);

Is this given because by different DTS? Shouldn't that be uniform on the RPi4?

The interface type is read from DT, the 'phy-mode' property. In the case of the RPi4 it's 'rgmii-rxid'.

The downstream DT used to be configured differently ('rgmii' and using 'ethernet-phy-ieee802.3-c22'), that's why you might have seen the board working at some point with this driver. But as we updated the DT to match upstream's we switched to 'rgmii-rxid' which is being misconfigured as 'rgmii' in u-boot. So you have u-boot configuring 'rgmii' while Linux configures 'rgmii-rxid', which fails to clear the ID_MODE_DIS bit. This, I imagine, blocks the delay configuration process from the PHY (I don't have any documentation).

Regards,
Nicolas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200221/f0024b31/attachment.sig>

#5 lore raw

PATCH 1/1 net: bcmgenet: Don't set ID_MODE_DIS when not using RGMII

Florian,

Quoted 36 lines · Nicolas Saenz Julienne

Hi Matthias,

Quoted 19 lines · Matthias Brugger
Quoted 18 lines · Nicolas Saenz Julienne

As per Linux's driver, ID_MODE_DIS is only set when the PHY interface is RGMII. Don't enable it for the rest of setups.

This has been seen to misconfigure RPi4's PHY when booting Linux.

---
 drivers/net/bcmgenet.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/bcmgenet.c +0 -0
index 8f4848aec6..e971b556ac 100644
@@ -448,7 +448,10 @@ static int bcmgenet_adjust_link(struct
 bcmgenet_eth_priv *priv)
 	}
 
Quoted 9 lines

drivers/net/bcmgenet.c static int bcmgenet_adjust_link(struct · line 455

Quoted 6 lines
drivers/net/bcmgenet.c +4 -1
 	clrsetbits_32(priv->mac_reg + EXT_RGMII_OOB_CTRL, OOB_DISABLE,
-			RGMII_LINK | RGMII_MODE_EN | ID_MODE_DIS);
+			RGMII_LINK | RGMII_MODE_EN);
+
+	if (phy_dev->interface == PHY_INTERFACE_MODE_RGMII)
+		setbits_32(priv->mac_reg + EXT_RGMII_OOB_CTRL, ID_MODE_DIS);

Is this given because by different DTS? Shouldn't that be uniform on the RPi4?

The interface type is read from DT, the 'phy-mode' property. In the case of the
RPi4 it's 'rgmii-rxid'.

Quoted 9 lines

The downstream DT used to be configured differently ('rgmii' and using 'ethernet-phy-ieee802.3-c22'), that's why you might have seen the board working
at some point with this driver. But as we updated the DT to match upstream's we
switched to 'rgmii-rxid' which is being misconfigured as 'rgmii' in u-boot. So you have u-boot configuring 'rgmii' while Linux configures 'rgmii-rxid', which fails to clear the ID_MODE_DIS bit. This, I imagine, blocks the delay configuration process from the PHY (I don't have any documentation).

With this in mind, would it make sens to do this in the Linux driver?

(quoted diff) +0 -0

b/drivers/net/ethernet/broadcom/genet/bcmmii.c
index 6392a2530183..10244941a7a6 100644

drivers/net/ethernet/broadcom/genet/bcmmii.c +0 -0
@@ -294,6 +294,7 @@ int bcmgenet_mii_config(struct net_device *dev, bool init)
	*/
	if (priv->ext_phy) {
		reg = bcmgenet_ext_readl(priv, EXT_RGMII_OOB_CTRL);
+               reg &= ~ID_MODE_DIS;
		reg |= id_mode_dis;
		if (GENET_IS_V1(priv) || GENET_IS_V2(priv) || GENET_IS_V3(priv))
			reg |= RGMII_MODE_EN_V123;

It all comes down to wheter we trust bootloader's config or not.

Regards,
Nicolas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200221/b3b0b39d/attachment.sig>

#6 lore raw

PATCH 1/1 net: bcmgenet: Don't set ID_MODE_DIS when not using RGMII

In reply to Nicolas Saenz Julienne
Quoted 6 lines · Nicolas Saenz Julienne

As per Linux's driver, ID_MODE_DIS is only set when the PHY interface is RGMII. Don't enable it for the rest of setups.

This has been seen to misconfigure RPi4's PHY when booting Linux.

Does the failure look like the following: you have a driver for the Broadcom PHY used on the Pi4 in u-boot, and the phy_dev->interface value is being used to configure the Ethernet PHY chip in a certain way.

Later when you boot Linux, you do not have CONFIG_BROADCOM_PHY enabled so the Generic PHY driver gets used instead, and there is a disagreement between the AMAC and PHY as to whom should be adding the delays?

At any rate:

Quoted 21 lines
---
 drivers/net/bcmgenet.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/net/bcmgenet.c +4 -1
index 8f4848aec6..e971b556ac 100644
@@ -448,7 +448,10 @@ static int bcmgenet_adjust_link(struct bcmgenet_eth_priv *priv)
 	}
 
 	clrsetbits_32(priv->mac_reg + EXT_RGMII_OOB_CTRL, OOB_DISABLE,
-			RGMII_LINK | RGMII_MODE_EN | ID_MODE_DIS);
+			RGMII_LINK | RGMII_MODE_EN);
+
+	if (phy_dev->interface == PHY_INTERFACE_MODE_RGMII)
+		setbits_32(priv->mac_reg + EXT_RGMII_OOB_CTRL, ID_MODE_DIS);
 
 	writel(speed << CMD_SPEED_SHIFT, (priv->mac_reg + UMAC_CMD));
 
Signature · 1 line
Florian
#7 lore raw

PATCH 1/1 net: bcmgenet: Don't set ID_MODE_DIS when not using RGMII

Hi Florian,

Quoted 8 lines · Florian Fainelli
Quoted 6 lines · Nicolas Saenz Julienne

As per Linux's driver, ID_MODE_DIS is only set when the PHY interface is RGMII. Don't enable it for the rest of setups.

This has been seen to misconfigure RPi4's PHY when booting Linux.

Quoted 7 lines

Does the failure look like the following: you have a driver for the Broadcom PHY used on the Pi4 in u-boot, and the phy_dev->interface value is being used to configure the Ethernet PHY chip in a certain way.

Later when you boot Linux, you do not have CONFIG_BROADCOM_PHY enabled so the Generic PHY driver gets used instead, and there is a disagreement between the AMAC and PHY as to whom should be adding the delays?

I added an explanation to Matthias' response. I think it fits yours, modulo my limited knowledge in the area :)

Quoted 3 lines

At any rate:

Thanks!

Regards,
Nicolas

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: This is a digitally signed message part
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20200221/8431dedf/attachment.sig>