Skip to content

Commit 4b59232

Browse files
xdarklightdavem330
authored andcommitted
net: dsa: lantiq_gswip: Configure all remaining GSWIP_MII_CFG bits
There are a few more bits in the GSWIP_MII_CFG register for which we did rely on the boot-loader (or the hardware defaults) to set them up properly. For some external RMII PHYs we need to select the GSWIP_MII_CFG_RMII_CLK bit and also we should un-set it for non-RMII PHYs. The GSWIP_MII_CFG_RMII_CLK bit is ignored for other PHY connection modes. The GSWIP IP also supports in-band auto-negotiation for RGMII PHYs when the GSWIP_MII_CFG_RGMII_IBS bit is set. Clear this bit always as there's no known hardware which uses this (so it is not tested yet). Clear the xMII isolation bit when set at initialization time if it was previously set by the bootloader. Not doing so could lead to no traffic (neither RX nor TX) on a port with this bit set. While here, also add the GSWIP_MII_CFG_RESET bit. We don't need to manage it because this bit is self-clearning when set. We still add it here to get a better overview of the GSWIP_MII_CFG register. Fixes: 14fceff ("net: dsa: Add Lantiq / Intel DSA driver for vrx200") Cc: stable@vger.kernel.org Suggested-by: Hauke Mehrtens <hauke@hauke-m.de> Acked-by: Hauke Mehrtens <hauke@hauke-m.de> Signed-off-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 3e9005b commit 4b59232

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

drivers/net/dsa/lantiq_gswip.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,12 @@
9393

9494
/* GSWIP MII Registers */
9595
#define GSWIP_MII_CFGp(p) (0x2 * (p))
96+
#define GSWIP_MII_CFG_RESET BIT(15)
9697
#define GSWIP_MII_CFG_EN BIT(14)
98+
#define GSWIP_MII_CFG_ISOLATE BIT(13)
9799
#define GSWIP_MII_CFG_LDCLKDIS BIT(12)
100+
#define GSWIP_MII_CFG_RGMII_IBS BIT(8)
101+
#define GSWIP_MII_CFG_RMII_CLK BIT(7)
98102
#define GSWIP_MII_CFG_MODE_MIIP 0x0
99103
#define GSWIP_MII_CFG_MODE_MIIM 0x1
100104
#define GSWIP_MII_CFG_MODE_RMIIP 0x2
@@ -821,9 +825,11 @@ static int gswip_setup(struct dsa_switch *ds)
821825
/* Configure the MDIO Clock 2.5 MHz */
822826
gswip_mdio_mask(priv, 0xff, 0x09, GSWIP_MDIO_MDC_CFG1);
823827

824-
/* Disable the xMII link */
828+
/* Disable the xMII interface and clear it's isolation bit */
825829
for (i = 0; i < priv->hw_info->max_ports; i++)
826-
gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_EN, 0, i);
830+
gswip_mii_mask_cfg(priv,
831+
GSWIP_MII_CFG_EN | GSWIP_MII_CFG_ISOLATE,
832+
0, i);
827833

828834
/* enable special tag insertion on cpu port */
829835
gswip_switch_mask(priv, 0, GSWIP_FDMA_PCTRL_STEN,
@@ -1597,6 +1603,9 @@ static void gswip_phylink_mac_config(struct dsa_switch *ds, int port,
15971603
break;
15981604
case PHY_INTERFACE_MODE_RMII:
15991605
miicfg |= GSWIP_MII_CFG_MODE_RMIIM;
1606+
1607+
/* Configure the RMII clock as output: */
1608+
miicfg |= GSWIP_MII_CFG_RMII_CLK;
16001609
break;
16011610
case PHY_INTERFACE_MODE_RGMII:
16021611
case PHY_INTERFACE_MODE_RGMII_ID:
@@ -1609,7 +1618,11 @@ static void gswip_phylink_mac_config(struct dsa_switch *ds, int port,
16091618
"Unsupported interface: %d\n", state->interface);
16101619
return;
16111620
}
1612-
gswip_mii_mask_cfg(priv, GSWIP_MII_CFG_MODE_MASK, miicfg, port);
1621+
1622+
gswip_mii_mask_cfg(priv,
1623+
GSWIP_MII_CFG_MODE_MASK | GSWIP_MII_CFG_RMII_CLK |
1624+
GSWIP_MII_CFG_RGMII_IBS | GSWIP_MII_CFG_LDCLKDIS,
1625+
miicfg, port);
16131626

16141627
switch (state->interface) {
16151628
case PHY_INTERFACE_MODE_RGMII_ID:

0 commit comments

Comments
 (0)