linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: isubramanian@apm.com (Iyappan Subramanian)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 net-next 03/12] drivers: net: xgene: Use rgmii mdio mac access
Date: Wed, 10 May 2017 13:45:01 -0700	[thread overview]
Message-ID: <1494449110-23785-4-git-send-email-isubramanian@apm.com> (raw)
In-Reply-To: <1494449110-23785-1-git-send-email-isubramanian@apm.com>

From: Quan Nguyen <qnguyen@apm.com>

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>
---
 drivers/net/ethernet/apm/xgene/xgene_enet_hw.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c b/drivers/net/ethernet/apm/xgene/xgene_enet_hw.c
index 2050c58..47c5b75 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;
-- 
1.9.1

  parent reply	other threads:[~2017-05-10 20:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-10 20:44 [PATCH v2 net-next 00/12] drivers: net: xgene: Add ethtool stats and bug fixes Iyappan Subramanian
2017-05-10 20:44 ` [PATCH v2 net-next 01/12] drivers: net: xgene: Protect indirect MAC access Iyappan Subramanian
2017-05-10 20:45 ` [PATCH v2 net-next 02/12] drivers: net: phy: xgene: Add lock to protect mac access Iyappan Subramanian
2017-05-10 20:45 ` Iyappan Subramanian [this message]
2017-05-10 21:48   ` [PATCH v2 net-next 03/12] drivers: net: xgene: Use rgmii mdio " Florian Fainelli
2017-05-10 20:45 ` [PATCH v2 net-next 04/12] drivers: net: xgene: Remove redundant local stats Iyappan Subramanian
2017-05-10 20:45 ` [PATCH v2 net-next 05/12] drivers: net: xgene: Refactor statistics error parsing code Iyappan Subramanian
2017-05-10 20:45 ` [PATCH v2 net-next 06/12] drivers: net: xgene: Remove unused macros Iyappan Subramanian
2017-05-10 20:45 ` [PATCH v2 net-next 07/12] drivers: net: xgene: Extend ethtool statistics Iyappan Subramanian
2017-05-10 20:45 ` [PATCH v2 net-next 08/12] drivers: net: xgene: Add rx_overrun/tx_underrun statistics Iyappan Subramanian
2017-05-10 20:45 ` [PATCH v2 net-next 09/12] drivers: net: xgene: Workaround for HW errata 10GE_4 Iyappan Subramanian
2017-05-10 20:45 ` [PATCH v2 net-next 10/12] drivers: net: xgene: Add frame recovered statistics counter for errata 10GE_8/ENET_11 Iyappan Subramanian
2017-05-10 20:45 ` [PATCH v2 net-next 11/12] drivers: net: xgene: Workaround for HW errata 10GE_10/ENET_15 Iyappan Subramanian
2017-05-10 20:45 ` [PATCH v2 net-next 12/12] drivers: net: xgene: Fix redundant prefetch buffer cleanup Iyappan Subramanian
2017-05-16 15:48 ` [PATCH v2 net-next 00/12] drivers: net: xgene: Add ethtool stats and bug fixes David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1494449110-23785-4-git-send-email-isubramanian@apm.com \
    --to=isubramanian@apm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).