From 3f614fdd2ec12a98f3c7208da6b2f305d19a336a Mon Sep 17 00:00:00 2001 From: Russell King Date: Sat, 7 Jan 2017 20:47:36 +0000 Subject: net: dsa: program 6176 LED registers Signed-off-by: Russell King --- drivers/net/dsa/mv88e6xxx/chip.c | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/drivers/net/dsa/mv88e6xxx/chip.c b/drivers/net/dsa/mv88e6xxx/chip.c index 9cf1bb29d8b9..34dc63bbeb6c 100644 --- a/drivers/net/dsa/mv88e6xxx/chip.c +++ b/drivers/net/dsa/mv88e6xxx/chip.c @@ -2554,6 +2554,20 @@ static int mv88e6xxx_setup_upstream_port(struct mv88e6xxx_chip *chip, int port) return 0; } +static int mv88e6xxx_setup_led(struct mv88e6xxx_chip *chip, int port) +{ + int err; + + /* LED0 = link/activity, LED1 = 10/100 */ + err = mv88e6xxx_wait_bit(chip, chip->info->port_base_addr + port, + MV88E6XXX_PORT_LED_CONTROL, 15, 0); + if (err) + return err; + + return mv88e6xxx_write(chip, chip->info->port_base_addr + port, + MV88E6XXX_PORT_LED_CONTROL, 0x80b3); +} + static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port) { struct dsa_switch *ds = chip->ds; @@ -2609,6 +2623,12 @@ static int mv88e6xxx_setup_port(struct mv88e6xxx_chip *chip, int port) if (err) return err; + if (chip->info->num_gpio) { + err = mv88e6xxx_setup_led(chip, port); + if (err) + return err; + } + /* Port Control 2: don't force a good FCS, set the maximum frame size to * 10240 bytes, disable 802.1q tags checking, don't discard tagged or * untagged frames on this port, do a destination address lookup on all -- cgit