diff options
author | Andrew Lunn <andrew@lunn.ch> | 2018-03-17 22:32:05 +0300 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2018-03-18 23:52:59 +0300 |
commit | 6f88284f3bd77a0e51de22d4956f07557bcc0dbf (patch) | |
tree | d0669876ce2f0829c5f48dca950625ffe3d90fd3 /drivers/net/dsa/mv88e6xxx/global2.c | |
parent | bc3931557d1d55584100b1ffefc248137b5cb7e1 (diff) | |
download | linux-6f88284f3bd77a0e51de22d4956f07557bcc0dbf.tar.xz |
net: dsa: mv88e6xxx: Add MDIO interrupts for internal PHYs
When registering an MDIO bus, it is possible to pass an array of
interrupts, one per address on the bus. phylib will then associate the
interrupt to the PHY device, if no other interrupt is provided.
Some of the global2 interrupts are PHY interrupts. Place them into the
MDIO bus structure.
Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/dsa/mv88e6xxx/global2.c')
-rw-r--r-- | drivers/net/dsa/mv88e6xxx/global2.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/drivers/net/dsa/mv88e6xxx/global2.c b/drivers/net/dsa/mv88e6xxx/global2.c index 5f370f1fc7c4..6c620974fef3 100644 --- a/drivers/net/dsa/mv88e6xxx/global2.c +++ b/drivers/net/dsa/mv88e6xxx/global2.c @@ -1107,6 +1107,38 @@ out: return err; } +int mv88e6xxx_g2_irq_mdio_setup(struct mv88e6xxx_chip *chip, + struct mii_bus *bus) +{ + int phy, irq, err, err_phy; + + for (phy = 0; phy < chip->info->num_internal_phys; phy++) { + irq = irq_find_mapping(chip->g2_irq.domain, phy); + if (irq < 0) { + err = irq; + goto out; + } + bus->irq[chip->info->port_base_addr + phy] = irq; + } + return 0; +out: + err_phy = phy; + + for (phy = 0; phy < err_phy; phy++) + irq_dispose_mapping(bus->irq[phy]); + + return err; +} + +void mv88e6xxx_g2_irq_mdio_free(struct mv88e6xxx_chip *chip, + struct mii_bus *bus) +{ + int phy; + + for (phy = 0; phy < chip->info->num_internal_phys; phy++) + irq_dispose_mapping(bus->irq[phy]); +} + int mv88e6xxx_g2_setup(struct mv88e6xxx_chip *chip) { u16 reg; |