net/faraday: Configure old MDIO interface on Aspeed SoCs
authorJoel Stanley <joel@jms.id.au>
Wed, 21 Sep 2016 23:05:02 +0000 (08:35 +0930)
committerDavid S. Miller <davem@davemloft.net>
Thu, 22 Sep 2016 07:31:14 +0000 (03:31 -0400)
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>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/faraday/ftgmac100.c
drivers/net/ethernet/faraday/ftgmac100.h

index 189373743ddfcb594326590e11d5cc4c89fa2f77..e3653b14008a4f8e0d0653764e3384ea9d2689ef 100644 (file)
@@ -1252,12 +1252,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);
index c258586ce4a44c77bb18991859deba701102e263..8a377ab1d127bf732a42dc2420f5a51147e5da67 100644 (file)
 #define FTGMAC100_DMAFIFOS_RXDMA_REQ           (1 << 30)
 #define FTGMAC100_DMAFIFOS_TXDMA_REQ           (1 << 31)
 
+/*
+ * Feature Register
+ */
+#define FTGMAC100_REVR_NEW_MDIO_INTERFACE      BIT(31)
+
 /*
  * Receive buffer size register
  */