Re: [PATCH RFC v2] net: dsa: mv88e6xxx: Support LED control
From: Andrew Lunn
Date: Sun Aug 11 2024 - 16:59:38 EST
> You could also add a
> mv88e6xxx_port_led_read(chip, port, *reg)
> {
> int err;
>
> err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_LED_CONTROL, reg);
> *reg &= 0x3ff;
>
> return err;
Actually, this wrong. You first need to write the register pointer
number you want to read:
err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_LED_CONTROL, ptr);
if (err)
return err;
and then do a read, and mask the only the lower 10 bits, where the
register value will be:
err = mv88e6xxx_port_write(chip, port, MV88E6XXX_PORT_LED_CONTROL, val);
*val &= 0x3ff;
return err;
Andrew