[PATCH 03/17] Ensure that the old style MDIO interface is active before registering the MDIO bus on Faraday style MACs. Without this patch the hardware may continue to expect new style commands, yielding MDIO timeouts and general lack of communication with the MII.

Timothy Pearson tpearson at raptorengineering.com
Sat Sep 17 06:35:19 AEST 2016


Signed-off-by: Timothy Pearson <tpearson at raptorengineering.com>
---
 drivers/net/ethernet/faraday/ftgmac100.c |    6 ++++++
 drivers/net/ethernet/faraday/ftgmac100.h |    2 ++
 2 files changed, 8 insertions(+)

diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index c20f767..778c625 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -1250,6 +1250,7 @@ static int ftgmac100_setup_mdio(struct net_device *netdev)
 {
 	struct ftgmac100 *priv = netdev_priv(netdev);
 	struct platform_device *pdev = to_platform_device(priv->dev);
+	uint32_t revcr;
 	int i, err = 0;
 
 	/* initialize mdio bus */
@@ -1257,6 +1258,11 @@ static int ftgmac100_setup_mdio(struct net_device *netdev)
 	if (!priv->mii_bus)
 		return -EIO;
 
+	/* This driver only supports the old MDIO interface -- enable it */
+	revcr = ioread32(priv->base + FTGMAC100_OFFSET_REVR);
+	revcr &= ~FTGMAC100_OFFSET_REVR_NEW_INTERFACE;
+	iowrite32(revcr, 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 d07b6ea..ee5f758 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.h
+++ b/drivers/net/ethernet/faraday/ftgmac100.h
@@ -133,6 +133,8 @@
 #define FTGMAC100_DMAFIFOS_RXDMA_REQ		(1 << 30)
 #define FTGMAC100_DMAFIFOS_TXDMA_REQ		(1 << 31)
 
+#define FTGMAC100_OFFSET_REVR_NEW_INTERFACE	(1 << 31)
+
 /*
  * Receive buffer size register
  */
-- 
1.7.9.5



More information about the openbmc mailing list