net: dsa: qca8k: Enable delay for RGMII_ID mode
Subsystems (4)
PATCH 1/1 net: dsa: qca8k: Enable delay for RGMII_ID mode
RGMII_ID specifies that we should have internal delay, so resurrect the delay addition routine but under the RGMII_ID mode.
--- drivers/net/dsa/qca8k.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)
drivers/net/dsa/qca8k.c +12 -0
@@ -443,6 +443,18 @@ qca8k_set_pad_ctrl(struct qca8k_priv *priv, int port, int mode) val =QCA8K_PORT_PAD_RGMII_EN ;qca8k_write (priv, reg, val);break ; +case PHY_INTERFACE_MODE_RGMII_ID : +/* RGMII_ID needs internal delay. This is enabled through +* PORT5_PAD_CTRL for all ports, rather than individual port +* registers +*/ +qca8k_write (priv, reg, +QCA8K_PORT_PAD_RGMII_EN | +QCA8K_PORT_PAD_RGMII_TX_DELAY (3 ) | +QCA8K_PORT_PAD_RGMII_RX_DELAY (3 )); +qca8k_write (priv,QCA8K_REG_PORT5_PAD_CTRL , +QCA8K_PORT_PAD_RGMII_RX_DELAY_EN ); +break ;case PHY_INTERFACE_MODE_SGMII :qca8k_write (priv, reg,QCA8K_PORT_PAD_SGMII_EN );break ;
Signature · 1 line
2.20.1
Andrew Lunn
maintainerQuoted 19 lines · Vinod Koul
RGMII_IDspecifies that we should have internal delay, so resurrect the delay addition routine but under theRGMII_IDmode.Fixes 40269aa9f40a ("net: dsa: qca8k: disable delay for RGMII mode")Signed-off-by Vinod Koul <[email protected]>--- drivers/net/dsa/qca8k.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/net/dsa/qca8k.c +2
-0@@ -443,6 +443,18 @@ qca8k_set_pad_ctrl(struct qca8k_priv *priv, int port, int mode) val =QCA8K_PORT_PAD_RGMII_EN ;qca8k_write (priv, reg, val);break ; +case PHY_INTERFACE_MODE_RGMII_ID : +/* RGMII_ID needs internal delay. This is enabled through
drivers/net/dsa/qca8k.c qca8k_set_pad_ctrl(struct qca8k_priv *priv, int port, int mode) · line 457
Quoted 10 lines
drivers/net/dsa/qca8k.c +10
-0+* PORT5_PAD_CTRL for all ports, rather than individual port +* registers +*/ +qca8k_write (priv, reg, +QCA8K_PORT_PAD_RGMII_EN | +QCA8K_PORT_PAD_RGMII_TX_DELAY (3 ) | +QCA8K_PORT_PAD_RGMII_RX_DELAY (3 )); +qca8k_write (priv,QCA8K_REG_PORT5_PAD_CTRL , +QCA8K_PORT_PAD_RGMII_RX_DELAY_EN ); +break ;
Hi Vinod
So i'm still confused if this is global, or per-port. The first register written looks to be per-port, although only for ports 0 and
6. The second write seems to be global.
Is there a danger that port 0 has PHY_INTERFACE_MODE_RGMII_ID and port 6 has PHY_INTERFACE_MODE_RGMII, and we end up with delays disabled? Maybe we should try to detect this, and return an error?
drivers/net/dsa/qca8k.c qca8k_set_pad_ctrl(struct qca8k_priv *priv, int port, int mode) · line 460
Quoted 3 lines
drivers/net/dsa/qca8k.c +0
-0case PHY_INTERFACE_MODE_SGMII :qca8k_write (priv, reg,QCA8K_PORT_PAD_SGMII_EN );break ;
I think it would be good to add the other two PHY_INTERFACE_MODE_RGMII modes to the default clause so we get an error reported that they are not implemented.
Andrew
Quoted 5 lines · Vinod Koul
RGMII_IDspecifies that we should have internal delay, so resurrect the delay addition routine but under theRGMII_IDmode.Fixes 40269aa9f40a ("net: dsa: qca8k: disable delay for RGMII mode")Signed-off-by Vinod Koul <[email protected]>
Fixes the problem on my imx6dl platform with QCA8334 switch. Thank you!
Quoted 28 lines
--- drivers/net/dsa/qca8k.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/net/dsa/qca8k.c +12
-0@@ -443,6 +443,18 @@ qca8k_set_pad_ctrl(struct qca8k_priv *priv, int port, int mode) val =QCA8K_PORT_PAD_RGMII_EN ;qca8k_write (priv, reg, val);break ; +case PHY_INTERFACE_MODE_RGMII_ID : +/* RGMII_ID needs internal delay. This is enabled through +* PORT5_PAD_CTRL for all ports, rather than individual port +* registers +*/ +qca8k_write (priv, reg, +QCA8K_PORT_PAD_RGMII_EN | +QCA8K_PORT_PAD_RGMII_TX_DELAY (3 ) | +QCA8K_PORT_PAD_RGMII_RX_DELAY (3 )); +qca8k_write (priv,QCA8K_REG_PORT5_PAD_CTRL , +QCA8K_PORT_PAD_RGMII_RX_DELAY_EN ); +break ;case PHY_INTERFACE_MODE_SGMII :qca8k_write (priv, reg,QCA8K_PORT_PAD_SGMII_EN );break ;
Andrew Lunn
maintainerdrivers/net/dsa/qca8k.c qca8k_set_pad_ctrl(struct qca8k_priv *priv, int port, int mode) · line 454
Quoted 9 lines · Vinod Koul
drivers/net/dsa/qca8k.c +9
-0+case PHY_INTERFACE_MODE_RGMII_ID : +/* RGMII_ID needs internal delay. This is enabled through +* PORT5_PAD_CTRL for all ports, rather than individual port +* registers +*/ +qca8k_write (priv, reg, +QCA8K_PORT_PAD_RGMII_EN | +QCA8K_PORT_PAD_RGMII_TX_DELAY (3 ) | +QCA8K_PORT_PAD_RGMII_RX_DELAY (3 ));
Hi Vinod
Could you add some #defines for the delay values?
Thanks
Andrew
Hi Andrew,
Quoted 33 lines · Andrew Lunn
Quoted 19 lines · Vinod Koul
RGMII_IDspecifies that we should have internal delay, so resurrect the delay addition routine but under theRGMII_IDmode.Fixes 40269aa9f40a ("net: dsa: qca8k: disable delay for RGMII mode")Signed-off-by Vinod Koul <[email protected]>--- drivers/net/dsa/qca8k.c | 12 ++++++++++++ 1 file changed, 12 insertions(+)drivers/net/dsa/qca8k.c +2
-0@@ -443,6 +443,18 @@ qca8k_set_pad_ctrl(struct qca8k_priv *priv, int port, int mode) val =QCA8K_PORT_PAD_RGMII_EN ;qca8k_write (priv, reg, val);break ; +case PHY_INTERFACE_MODE_RGMII_ID : +/* RGMII_ID needs internal delay. This is enabled through drivers/net/dsa/qca8k.c qca8k_set_pad_ctrl(struct qca8k_priv *priv, int port, int mode) · line 457
Quoted 10 lines
drivers/net/dsa/qca8k.c +10
-0+* PORT5_PAD_CTRL for all ports, rather than individual port +* registers +*/ +qca8k_write (priv, reg, +QCA8K_PORT_PAD_RGMII_EN | +QCA8K_PORT_PAD_RGMII_TX_DELAY (3 ) | +QCA8K_PORT_PAD_RGMII_RX_DELAY (3 )); +qca8k_write (priv,QCA8K_REG_PORT5_PAD_CTRL , +QCA8K_PORT_PAD_RGMII_RX_DELAY_EN ); +break ;Hi Vinod
Quoted 3 lines
So i'm still confused if this is global, or per-port. The first register written looks to be per-port, although only for ports 0 and
6. The second write seems to be global.
This is still a global write which enables the delay in all the ports (as was the case previously)
Quoted 3 lines
Is there a danger that port 0 has
PHY_INTERFACE_MODE_RGMII_IDand port 6 hasPHY_INTERFACE_MODE_RGMII, and we end up with delays disabled? Maybe we should try to detect this, and return an error?
If that was the case, I would presume people would have reported an issue that it doesn't work for them..?
Quoted 7 lines
drivers/net/dsa/qca8k.c qca8k_set_pad_ctrl(struct qca8k_priv *priv, int port, int mode) · line 460
Quoted 3 lines
drivers/net/dsa/qca8k.c +0
-0case PHY_INTERFACE_MODE_SGMII :qca8k_write (priv, reg,QCA8K_PORT_PAD_SGMII_EN );break ;I think it would be good to add the other two
PHY_INTERFACE_MODE_RGMIImodes to the default clause so we get an error reported that they are not implemented.
That is still the case:
default:
pr_err("xMII mode %d not supported\n", mode);
return -EINVAL;Signature · 1 line
~Vinod
Quoted 13 lines · Andrew Lunn
drivers/net/dsa/qca8k.c qca8k_set_pad_ctrl(struct qca8k_priv *priv, int port, int mode) · line 454
Quoted 9 lines · Vinod Koul
drivers/net/dsa/qca8k.c +9
-0+case PHY_INTERFACE_MODE_RGMII_ID : +/* RGMII_ID needs internal delay. This is enabled through +* PORT5_PAD_CTRL for all ports, rather than individual port +* registers +*/ +qca8k_write (priv, reg, +QCA8K_PORT_PAD_RGMII_EN | +QCA8K_PORT_PAD_RGMII_TX_DELAY (3 ) | +QCA8K_PORT_PAD_RGMII_RX_DELAY (3 ));Hi Vinod
Quoted 1 line
Could you add some #defines for the delay values?
Sure will update the patch
Signature · 1 line
~Vinod