netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joel Stanley <joel@jms.id.au>
To: davem@davemloft.net
Cc: gwshan@linux.vnet.ibm.com, andrew@lunn.ch, andrew@aj.id.au,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	benh@kernel.crashing.org
Subject: [PATCH net-next 7/7] net/faraday: Configure old MDIO interface on Aspeed SoCs
Date: Tue, 20 Sep 2016 16:00:07 +0930	[thread overview]
Message-ID: <20160920063007.24291-8-joel@jms.id.au> (raw)
In-Reply-To: <20160920063007.24291-1-joel@jms.id.au>

The Aspeed SoCs have a new MDIO interface as an option in the G4 and G5
SoCs. The old one is still available, so select it in order to remain
compatible with the ftgmac100 driver.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 drivers/net/ethernet/faraday/ftgmac100.c | 9 +++++++++
 drivers/net/ethernet/faraday/ftgmac100.h | 5 +++++
 2 files changed, 14 insertions(+)

diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index 5466df028381..54c6ba3632a3 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -1257,12 +1257,21 @@ static int ftgmac100_setup_mdio(struct net_device *netdev)
 	struct ftgmac100 *priv = netdev_priv(netdev);
 	struct platform_device *pdev = to_platform_device(priv->dev);
 	int i, err = 0;
+	u32 reg;
 
 	/* initialize mdio bus */
 	priv->mii_bus = mdiobus_alloc();
 	if (!priv->mii_bus)
 		return -EIO;
 
+	if (of_machine_is_compatible("aspeed,ast2400") ||
+	    of_machine_is_compatible("aspeed,ast2500")) {
+		/* This driver supports the old MDIO interface */
+		reg = ioread32(priv->base + FTGMAC100_OFFSET_REVR);
+		reg &= ~FTGMAC100_REVR_NEW_MDIO_INTERFACE;
+		iowrite32(reg, priv->base + FTGMAC100_OFFSET_REVR);
+	};
+
 	priv->mii_bus->name = "ftgmac100_mdio";
 	snprintf(priv->mii_bus->id, MII_BUS_ID_SIZE, "%s-%d",
 		 pdev->name, pdev->id);
diff --git a/drivers/net/ethernet/faraday/ftgmac100.h b/drivers/net/ethernet/faraday/ftgmac100.h
index d07b6ea5d1b5..a7ce0ac8858a 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.h
+++ b/drivers/net/ethernet/faraday/ftgmac100.h
@@ -134,6 +134,11 @@
 #define FTGMAC100_DMAFIFOS_TXDMA_REQ		(1 << 31)
 
 /*
+ * Feature Register
+ */
+#define FTGMAC100_REVR_NEW_MDIO_INTERFACE	BIT(31)
+
+/*
  * Receive buffer size register
  */
 #define FTGMAC100_RBSR_SIZE(x)		((x) & 0x3fff)
-- 
2.9.3

      parent reply	other threads:[~2016-09-20  6:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-20  6:30 [PATCH net-next 0/7] ftgmac100 support for ast2500 Joel Stanley
2016-09-20  6:30 ` [PATCH net-next 1/7] net/faraday: Separate rx page storage from rxdesc Joel Stanley
2016-09-20  6:30 ` [PATCH net-next 2/7] net/faraday: Make EDO{R,T}R bits configurable Joel Stanley
2016-09-20  6:30 ` [PATCH net-next 3/7] net/faraday: Adapt for Aspeed SoCs Joel Stanley
2016-09-20  6:30 ` [PATCH net-next 4/7] net/faraday: Avoid PHYSTS_CHG interrupt Joel Stanley
2016-09-20  6:30 ` [PATCH net-next 5/7] net/faraday: Clear stale interrupts Joel Stanley
2016-09-20  6:30 ` [PATCH net-next 6/7] net/faraday: Fix phy link irq on Aspeed G5 SoCs Joel Stanley
2016-09-20 12:13   ` Benjamin Herrenschmidt
2016-09-20 15:29     ` Andrew Lunn
2016-09-21  2:02       ` Joel Stanley
2016-09-21  9:03         ` Benjamin Herrenschmidt
2016-09-21  9:18           ` Joel Stanley
2016-09-21 10:43             ` Benjamin Herrenschmidt
2016-09-20 12:14   ` Sergei Shtylyov
2016-09-20  6:30 ` Joel Stanley [this message]

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=20160920063007.24291-8-joel@jms.id.au \
    --to=joel@jms.id.au \
    --cc=andrew@aj.id.au \
    --cc=andrew@lunn.ch \
    --cc=benh@kernel.crashing.org \
    --cc=davem@davemloft.net \
    --cc=gwshan@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.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).