net: dsa: mv88e6xxx: Implement the 6390 external MDIO bus
authorAndrew Lunn <andrew@lunn.ch>
Tue, 24 Jan 2017 13:53:51 +0000 (14:53 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 24 Jan 2017 20:33:51 +0000 (15:33 -0500)
With all the infrastructure in place, implement access to the external
MDIO bus on the 6390 family.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/dsa/mv88e6xxx/global2.c
drivers/net/dsa/mv88e6xxx/mv88e6xxx.h

index 1f9a12a1fad9cfa9408c25bbfbb29757a32e61a6..353e26bea3c3544eb2b9570fc2f62444872675ab 100644 (file)
@@ -506,8 +506,12 @@ int mv88e6xxx_g2_smi_phy_read(struct mv88e6xxx_chip *chip,
                              int addr, int reg, u16 *val)
 {
        u16 cmd = GLOBAL2_SMI_PHY_CMD_OP_22_READ_DATA | (addr << 5) | reg;
+       struct mv88e6xxx_mdio_bus *mdio_bus = bus->priv;
        int err;
 
+       if (mdio_bus->external)
+               cmd |= GLOBAL2_SMI_PHY_CMD_EXTERNAL;
+
        err = mv88e6xxx_g2_smi_phy_wait(chip);
        if (err)
                return err;
@@ -524,8 +528,12 @@ int mv88e6xxx_g2_smi_phy_write(struct mv88e6xxx_chip *chip,
                               int addr, int reg, u16 val)
 {
        u16 cmd = GLOBAL2_SMI_PHY_CMD_OP_22_WRITE_DATA | (addr << 5) | reg;
+       struct mv88e6xxx_mdio_bus *mdio_bus = bus->priv;
        int err;
 
+       if (mdio_bus->external)
+               cmd |= GLOBAL2_SMI_PHY_CMD_EXTERNAL;
+
        err = mv88e6xxx_g2_smi_phy_wait(chip);
        if (err)
                return err;
index 7d24add45e74cb26945fb247c8b8b4f5cee717de..572d585dc1e2fe6583ff758a394ce79ddc26a704 100644 (file)
 #define GLOBAL2_PTP_AVB_DATA   0x17
 #define GLOBAL2_SMI_PHY_CMD                    0x18
 #define GLOBAL2_SMI_PHY_CMD_BUSY               BIT(15)
+#define GLOBAL2_SMI_PHY_CMD_EXTERNAL           BIT(13)
 #define GLOBAL2_SMI_PHY_CMD_MODE_22            BIT(12)
 #define GLOBAL2_SMI_PHY_CMD_OP_22_WRITE_DATA   ((0x1 << 10) | \
                                                 GLOBAL2_SMI_PHY_CMD_MODE_22 | \