netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: macb: reject unsupported rgmii delays
@ 2020-06-16  7:49 Helmut Grohne
  2020-06-17  9:24 ` Nicolas Ferre
                   ` (2 more replies)
  0 siblings, 3 replies; 23+ messages in thread
From: Helmut Grohne @ 2020-06-16  7:49 UTC (permalink / raw)
  To: Nicolas Ferre, David S. Miller, Jakub Kicinski, Russell King,
	Palmer Dabbelt, Paul Walmsley, netdev

The macb driver does not support configuring rgmii delays. At least for
the Zynq GEM, delays are not supported by the hardware at all. However,
the driver happily accepts and ignores any such delays.

When operating in a mac to phy connection, the delay setting applies to
the phy. Since the MAC does not support delays, the phy must provide
them and the only supported mode is rgmii-id.  However, in a fixed mac
to mac connection, the delay applies to the mac itself. Therefore the
only supported rgmii mode is rgmii.

Link: https://lore.kernel.org/netdev/20200610081236.GA31659@laureti-dev/
Signed-off-by: Helmut Grohne <helmut.grohne@intenta.de>
---
 drivers/net/ethernet/cadence/macb_main.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
index 5b9d7c60eebc..bee5bf65e8b3 100644
--- a/drivers/net/ethernet/cadence/macb_main.c
+++ b/drivers/net/ethernet/cadence/macb_main.c
@@ -514,7 +514,7 @@ static void macb_validate(struct phylink_config *config,
 	    state->interface != PHY_INTERFACE_MODE_RMII &&
 	    state->interface != PHY_INTERFACE_MODE_GMII &&
 	    state->interface != PHY_INTERFACE_MODE_SGMII &&
-	    !phy_interface_mode_is_rgmii(state->interface)) {
+	    state->interface != PHY_INTERFACE_MODE_RGMII_ID) {
 		bitmap_zero(supported, __ETHTOOL_LINK_MODE_MASK_NBITS);
 		return;
 	}
@@ -694,6 +694,13 @@ static int macb_phylink_connect(struct macb *bp)
 	struct phy_device *phydev;
 	int ret;
 
+	if (of_phy_is_fixed_link(dn) &&
+	    phy_interface_mode_is_rgmii(bp->phy_interface) &&
+	    bp->phy_interface != PHY_INTERFACE_MODE_RGMII) {
+		netdev_err(dev, "RGMII delays are not supported\n");
+		return -EINVAL;
+	}
+
 	if (dn)
 		ret = phylink_of_phy_connect(bp->phylink, dn, 0);
 
-- 
2.20.1


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

end of thread, other threads:[~2020-06-18 19:10 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-16  7:49 [PATCH] net: macb: reject unsupported rgmii delays Helmut Grohne
2020-06-17  9:24 ` Nicolas Ferre
2020-06-17  9:57 ` Vladimir Oltean
2020-06-17 11:15   ` Helmut Grohne
2020-06-17 10:55 ` Russell King - ARM Linux admin
2020-06-17 11:21   ` Helmut Grohne
2020-06-17 11:40     ` Russell King - ARM Linux admin
2020-06-17 11:52       ` Helmut Grohne
2020-06-17 12:08         ` Russell King - ARM Linux admin
2020-06-18  8:14           ` Helmut Grohne
2020-06-18  8:45             ` Russell King - ARM Linux admin
2020-06-18  9:05               ` Helmut Grohne
2020-06-18 10:01                 ` Russell King - ARM Linux admin
2020-06-18 18:26                   ` Florian Fainelli
2020-06-18 18:06               ` Florian Fainelli
2020-06-18 18:49                 ` Russell King - ARM Linux admin
2020-06-18 19:02                   ` Florian Fainelli
2020-06-18 19:10                     ` Russell King - ARM Linux admin
2020-06-17 11:32   ` Vladimir Oltean
2020-06-17 11:34     ` Russell King - ARM Linux admin
2020-06-17 11:38       ` Vladimir Oltean
2020-06-17 11:57         ` Russell King - ARM Linux admin
2020-06-18 18:25           ` 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).