summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/apm
diff options
context:
space:
mode:
authorQuan Nguyen <qnguyen@apm.com>2017-05-10 23:45:01 +0300
committerDavid S. Miller <davem@davemloft.net>2017-05-16 18:41:08 +0300
commitd09d3629b6f60bd5df5303eb2f4b26c52571388a (patch)
tree8f7e5b2f3e2de85750d40d4b18cb42205cd02264 /drivers/net/ethernet/apm
parent8ec7074a6bf74e12f67c0dc90cdaa7969bb49c74 (diff)
downloadlinux-d09d3629b6f60bd5df5303eb2f4b26c52571388a.tar.xz
drivers: net: xgene: Use rgmii mdio mac access
This patch switches to use rgmii mdio mac access routines if available, as they share the same HW. Signed-off-by: Quan Nguyen <qnguyen@apm.com> Signed-off-by: Iyappan Subramanian <isubramanian@apm.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/apm')
-rw-r--r--drivers/net/ethernet/apm/xgene/xgene_enet_hw.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
index 2050c58eddfd..47c5b754068d 100644
--- a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
+++ b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
@@ -277,6 +277,13 @@ void xgene_enet_wr_mac(struct xgene_enet_pdata *pdata, u32 wr_addr, u32 wr_data)
u8 wait = 10;
u32 done;
+ if (pdata->mdio_driver && ndev->phydev &&
+ pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) {
+ struct mii_bus *bus = ndev->phydev->mdio.bus;
+
+ return xgene_mdio_wr_mac(bus->priv, wr_addr, wr_data);
+ }
+
addr = pdata->mcx_mac_addr + MAC_ADDR_REG_OFFSET;
wr = pdata->mcx_mac_addr + MAC_WRITE_REG_OFFSET;
cmd = pdata->mcx_mac_addr + MAC_COMMAND_REG_OFFSET;
@@ -328,6 +335,13 @@ u32 xgene_enet_rd_mac(struct xgene_enet_pdata *pdata, u32 rd_addr)
u32 done, rd_data;
u8 wait = 10;
+ if (pdata->mdio_driver && pdata->ndev->phydev &&
+ pdata->phy_mode == PHY_INTERFACE_MODE_RGMII) {
+ struct mii_bus *bus = pdata->ndev->phydev->mdio.bus;
+
+ return xgene_mdio_rd_mac(bus->priv, rd_addr);
+ }
+
addr = pdata->mcx_mac_addr + MAC_ADDR_REG_OFFSET;
rd = pdata->mcx_mac_addr + MAC_READ_REG_OFFSET;
cmd = pdata->mcx_mac_addr + MAC_COMMAND_REG_OFFSET;