Re: [PATCH net-next 5/6] net: dsa: mv88e6xxx: add helper for switch ready

2016-12-01 Thread Vivien Didelot
Hi Andrew, Andrew Lunn writes: > As we have seen in the past, this sort of loop is broken if we end up > sleeping for a long time. Please take the opportunity to replace it > with one of our _wait() helpers, e.g. mv88e6xxx_g1_wait() That won't work. the _wait() helpers are made to wait on self-

Re: [PATCH net-next 5/6] net: dsa: mv88e6xxx: add helper for switch ready

2016-11-30 Thread Andrew Lunn
> +static int mv88e6xxx_wait_switch_ready(struct mv88e6xxx_chip *chip) > +{ > + const unsigned long timeout = jiffies + 1 * HZ; > + bool ready; > + int err; > + > + /* Wait up to 1 second for switch to be ready. > + * The switch is ready when all units inside the device (ATU, V

[PATCH net-next 5/6] net: dsa: mv88e6xxx: add helper for switch ready

2016-11-30 Thread Vivien Didelot
All Marvell switches (even 88E6060) have a bit to inform that the switch is ready to accept frames. Implement that in mv88e6xxx_g1_init_ready(). If the switch has a PPU, we must wait until its state is active polling, otherwise we cannot access PortStatus registers. Nicely wrap all that in a mv88