From 4241ef52372ebee93f4ed67e08c9316ccb20bdd7 Mon Sep 17 00:00:00 2001 From: Vivien Didelot Date: Sat, 31 Aug 2019 16:18:29 -0400 Subject: net: dsa: mv88e6xxx: introduce .serdes_irq_mapping Introduce a new .serdes_irq_mapping operation to prepare the abstraction of IRQ mapping from the SERDES IRQ setup code. Signed-off-by: Vivien Didelot Signed-off-by: David S. Miller --- drivers/net/dsa/mv88e6xxx/serdes.c | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'drivers/net/dsa/mv88e6xxx/serdes.c') diff --git a/drivers/net/dsa/mv88e6xxx/serdes.c b/drivers/net/dsa/mv88e6xxx/serdes.c index f65652e6edec..4fb1dca64ef1 100644 --- a/drivers/net/dsa/mv88e6xxx/serdes.c +++ b/drivers/net/dsa/mv88e6xxx/serdes.c @@ -240,18 +240,25 @@ static int mv88e6352_serdes_irq_disable(struct mv88e6xxx_chip *chip) return mv88e6352_serdes_write(chip, MV88E6352_SERDES_INT_ENABLE, 0); } +unsigned int mv88e6352_serdes_irq_mapping(struct mv88e6xxx_chip *chip, int port) +{ + return irq_find_mapping(chip->g2_irq.domain, MV88E6352_SERDES_IRQ); +} + int mv88e6352_serdes_irq_setup(struct mv88e6xxx_chip *chip, int port) { + unsigned int irq; int err; if (!mv88e6352_port_has_serdes(chip, port)) return 0; - chip->ports[port].serdes_irq = irq_find_mapping(chip->g2_irq.domain, - MV88E6352_SERDES_IRQ); - if (!chip->ports[port].serdes_irq) + irq = mv88e6xxx_serdes_irq_mapping(chip, port); + if (!irq) return 0; + chip->ports[port].serdes_irq = irq; + /* Requesting the IRQ will trigger irq callbacks. So we cannot * hold the reg_lock. */ @@ -673,8 +680,14 @@ out: return ret; } +unsigned int mv88e6390_serdes_irq_mapping(struct mv88e6xxx_chip *chip, int port) +{ + return irq_find_mapping(chip->g2_irq.domain, port); +} + int mv88e6390_serdes_irq_setup(struct mv88e6xxx_chip *chip, int port) { + unsigned int irq; int err; u8 lane; @@ -685,11 +698,12 @@ int mv88e6390_serdes_irq_setup(struct mv88e6xxx_chip *chip, int port) return err; } - chip->ports[port].serdes_irq = irq_find_mapping(chip->g2_irq.domain, - port); - if (!chip->ports[port].serdes_irq) + irq = mv88e6xxx_serdes_irq_mapping(chip, port); + if (!irq) return 0; + chip->ports[port].serdes_irq = irq; + /* Requesting the IRQ will trigger irq callbacks. So we cannot * hold the reg_lock. */ -- cgit v1.2.1