Re: [PATCH v2 5/5] net: dsa: add support for mv88e6250

From: Andrew Lunn
Date: Fri May 24 2019 - 10:30:33 EST


> @@ -4841,6 +4910,10 @@ static const struct of_device_id mv88e6xxx_of_match[] = {
> .compatible = "marvell,mv88e6190",
> .data = &mv88e6xxx_table[MV88E6190],
> },
> + {
> + .compatible = "marvell,mv88e6250",
> + .data = &mv88e6xxx_table[MV88E6250],
> + },
> { /* sentinel */ },
> };

Ah, yes. I had not thought about that. A device at address 0 would be
found, but a device at address 16 would be missed.

Please add this compatible string to Documentation/devicetree/bindings/net/dsa/marvell.txt

> +++ b/drivers/net/dsa/mv88e6xxx/global1.c
> @@ -182,6 +182,25 @@ int mv88e6185_g1_reset(struct mv88e6xxx_chip *chip)
> return mv88e6185_g1_wait_ppu_polling(chip);
> }
>
> +int mv88e6250_g1_reset(struct mv88e6xxx_chip *chip)
> +{
> + u16 val;
> + int err;
> +
> + /* Set the SWReset bit 15 */
> + err = mv88e6xxx_g1_read(chip, MV88E6XXX_G1_CTL1, &val);
> + if (err)
> + return err;
> +
> + val |= MV88E6XXX_G1_CTL1_SW_RESET;
> +
> + err = mv88e6xxx_g1_write(chip, MV88E6XXX_G1_CTL1, val);
> + if (err)
> + return err;
> +
> + return mv88e6xxx_g1_wait_init_ready(chip);
> +}

It looks like you could refactor mv88e6352_g1_reset() to call
this function, and then mv88e6352_g1_wait_ppu_polling(chip);

Otherwise, this looks good.

Andrew