net: dsa: qca8k: Enable delay for RGMII_ID mode
authorVinod Koul <vkoul@kernel.org>
Tue, 19 Feb 2019 06:59:43 +0000 (12:29 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 29 Jan 2020 09:24:16 +0000 (10:24 +0100)
[ Upstream commit a968b5e9d5879f9535d6099505f9e14abcafb623 ]

RGMII_ID specifies that we should have internal delay, so resurrect the
delay addition routine but under the RGMII_ID mode.

Fixes: 40269aa9f40a ("net: dsa: qca8k: disable delay for RGMII mode")
Tested-by: Michal Vokáč <michal.vokac@ysoft.com>
Signed-off-by: Vinod Koul <vkoul@kernel.org>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/dsa/qca8k.c
drivers/net/dsa/qca8k.h

index ebfbaf8597f407d248e405bf6d7010f9ed5c243e..3bbe85aae49bb1dfd4c862982f7b9af7665697ff 100644 (file)
@@ -460,6 +460,18 @@ qca8k_set_pad_ctrl(struct qca8k_priv *priv, int port, int mode)
                qca8k_write(priv, QCA8K_REG_PORT5_PAD_CTRL,
                            QCA8K_PORT_PAD_RGMII_RX_DELAY_EN);
                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(QCA8K_MAX_DELAY) |
+                           QCA8K_PORT_PAD_RGMII_RX_DELAY(QCA8K_MAX_DELAY));
+               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;
index 9c22bc3210cdf58236673bca717e3594feea8efa..db95168ca111d8d0a667996e538ceff585093c69 100644 (file)
@@ -40,6 +40,7 @@
                                                ((0x8 + (x & 0x3)) << 22)
 #define   QCA8K_PORT_PAD_RGMII_RX_DELAY(x)             \
                                                ((0x10 + (x & 0x3)) << 20)
+#define   QCA8K_MAX_DELAY                              3
 #define   QCA8K_PORT_PAD_RGMII_RX_DELAY_EN             BIT(24)
 #define   QCA8K_PORT_PAD_SGMII_EN                      BIT(7)
 #define QCA8K_REG_MODULE_EN                            0x030