Re: [PATCH net-next v5 13/13] ax88796b: Add support for AX88772D, AX88179A and AX88279
Andrew Lunn <[email protected]>
| Newsgroups | org.kernel.vger.linux-usb,org.kernel.vger.linux-kernel,org.kernel.vger.netdev |
|---|---|
| Message-ID | <[email protected]> |
> I also would like to add another feature to phylink separately. All the USB > Ethernet controllers have a feature where the controller sends a USB Interrupt > URB to the host when the link state changes. It would be great if instead > of polling, this could be used to trigger a read_status() of the PHY instead > of polling it constantly over USB. This would work like the equivalent of the > PHY link state change interrupts. Basically, the host driver would, upon > receiving a link change interrupt URB trigger a similar code path in phylink > as a link change interrupt by a PHY triggers. Ideally, this could be something > that usbnet would help drivers to set up. Would that make sense? There are already a few different implementations of this. phylib has phy_mac_interrupt(). You might just want to put a phylink wrapper around this. You would still have the polling, but calling this would trigger an immediate poll, speeding things up a bit. You might be able to disable the polling with PHY_MAC_INTERRUPT. These is also phylink_mac_change(). But as the name suggests, that is about the MAC seeing a change in state, not that it knows the PHY changed state. I don't think it triggers phylib. Another option is to implement a Linux interrupt controller. mv88e6xxx_g1_irq_setup_common() is one example which i wrote. The Marvell Ethernet Switch chips have embedded interrupt controllers, including PHY interrupts. The switch chip has one output pin often connected to a GPIO which can trigger an interrupt. When that GPIO interrupt fires, it calls mv88e6xxx_g1_irq_thread_fn() to dispatch the interrupt. That then uses handle_nested_irq() to pass on the interrupt to anything which has called request_irq() with the appropriate values. Now phylib has that, phy_request_interrupt(). For that to work, you need phydev->irq set. That comes from mii_bus->irq[]. So when creating your MDIO bus, you first create the interrupt controller, and then set bus->irq[], mv88e6xxx_g2_irq_mdio_setup(). phylib should then glue it all together. Andrew