aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
diff options
context:
space:
mode:
authorIyappan Subramanian <isubramanian@apm.com>2016-07-25 17:12:41 -0700
committerDavid S. Miller <davem@davemloft.net>2016-07-25 21:51:43 -0700
commit8089a96f601bdfe3e1b41d14bb703aafaf1b8f34 (patch)
tree011836d4b8f2aa75fa76dba49383a88b6d3d690e /drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
parentdrivers: net: phy: xgene: Add MDIO driver (diff)
downloadlinux-dev-8089a96f601bdfe3e1b41d14bb703aafaf1b8f34.tar.xz
linux-dev-8089a96f601bdfe3e1b41d14bb703aafaf1b8f34.zip
drivers: net: xgene: Add backward compatibility
This patch adds xgene_enet_check_phy_hanlde() function that checks whether MDIO driver is probed successfully and sets pdata->mdio_driver to true. If MDIO driver is not probed, ethernet driver falls back to backward compatibility mode. Since enum xgene_enet_cmd is used by MDIO driver, removing this from ethernet driver. Signed-off-by: Iyappan Subramanian <isubramanian@apm.com> Tested-by: Fushen Chen <fchen@apm.com> Tested-by: Toan Le <toanle@apm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to '')
-rw-r--r--drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c b/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
index 03a70c58bb9d..d12e9cbae820 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_sgmac.c
@@ -366,7 +366,9 @@ static void xgene_sgmac_init(struct xgene_enet_pdata *p)
u32 cfg_bypass_reg, rx_dv_gate_reg;
u32 data, offset;
- xgene_sgmac_reset(p);
+ if (!(p->enet_id == XGENE_ENET2 && p->mdio_driver))
+ xgene_sgmac_reset(p);
+
xgene_sgmii_enable_autoneg(p);
xgene_sgmac_set_speed(p);
xgene_sgmac_set_mac_addr(p);
@@ -445,6 +447,11 @@ static int xgene_enet_reset(struct xgene_enet_pdata *p)
if (!xgene_ring_mgr_init(p))
return -ENODEV;
+ if (p->mdio_driver && p->enet_id == XGENE_ENET2) {
+ xgene_enet_config_ring_if_assoc(p);
+ return 0;
+ }
+
if (p->enet_id == XGENE_ENET2)
xgene_enet_wr_clkrst_csr(p, XGENET_CONFIG_REG_ADDR, SGMII_EN);