[RFC Patch net-next 0/4] net: dsa: microchip: ksz9477: enable interrupt for internal phy link detection

Arun Ramadoss posted 4 patches 3 years, 3 months ago
There is a newer version of this series
drivers/net/dsa/microchip/ksz_common.c   | 437 +++++++++++++++++++++++
drivers/net/dsa/microchip/ksz_common.h   |  10 +
drivers/net/dsa/microchip/lan937x_main.c | 425 ----------------------
drivers/net/phy/micrel.c                 |   2 +
4 files changed, 449 insertions(+), 425 deletions(-)
[RFC Patch net-next 0/4] net: dsa: microchip: ksz9477: enable interrupt for internal phy link detection
Posted by Arun Ramadoss 3 years, 3 months ago
This patch series implements the common interrupt handling for ksz9477 based
switches and lan937x. The ksz9477 and lan937x has similar interrupt registers
except ksz9477 has 4 port based interrupts whereas lan937x has 6 interrupts.
The patch moves the phy interrupt hanler implemented in lan937x_main.c to
ksz_common.c, along with the mdio_register functionality.

Arun Ramadoss (4):
  net: dsa: microchip: determine number of port irq based on switch type
  net: dsa: microchip: enable phy interrupts only if interrupt enabled
    in dts
  net: dsa: microchip: move interrupt handling logic from lan937x to
    ksz_common
  net: phy: micrel: enable interrupt for ksz9477 phy

 drivers/net/dsa/microchip/ksz_common.c   | 437 +++++++++++++++++++++++
 drivers/net/dsa/microchip/ksz_common.h   |  10 +
 drivers/net/dsa/microchip/lan937x_main.c | 425 ----------------------
 drivers/net/phy/micrel.c                 |   2 +
 4 files changed, 449 insertions(+), 425 deletions(-)

-- 
2.36.1
Re: [RFC Patch net-next 0/4] net: dsa: microchip: ksz9477: enable interrupt for internal phy link detection
Posted by Andrew Lunn 3 years, 3 months ago
On Fri, Sep 09, 2022 at 09:31:16PM +0530, Arun Ramadoss wrote:
> This patch series implements the common interrupt handling for ksz9477 based
> switches and lan937x. The ksz9477 and lan937x has similar interrupt registers
> except ksz9477 has 4 port based interrupts whereas lan937x has 6 interrupts.
> The patch moves the phy interrupt hanler implemented in lan937x_main.c to
> ksz_common.c, along with the mdio_register functionality.

It is a good idea to state why it is an RFC. What sort of comments do
you want?

    Andrew
Re: [RFC Patch net-next 0/4] net: dsa: microchip: ksz9477: enable interrupt for internal phy link detection
Posted by Arun.Ramadoss@microchip.com 3 years, 3 months ago
Hi Andrew, 
On Mon, 2022-09-12 at 23:33 +0200, Andrew Lunn wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
> 
> On Fri, Sep 09, 2022 at 09:31:16PM +0530, Arun Ramadoss wrote:
> > This patch series implements the common interrupt handling for
> > ksz9477 based
> > switches and lan937x. The ksz9477 and lan937x has similar interrupt
> > registers
> > except ksz9477 has 4 port based interrupts whereas lan937x has 6
> > interrupts.
> > The patch moves the phy interrupt hanler implemented in
> > lan937x_main.c to
> > ksz_common.c, along with the mdio_register functionality.
> 
> It is a good idea to state why it is an RFC. What sort of comments do
> you want?

In the arch/arm/boot/dts/at91-sama5d3_ksz9477_evb.dts file, they
haven't specified the phy-handle. If I use that dts file with this
patch, during the mdio_register I get the error *no mdio bus node* and
the ksz probe fails. If I update the dts file with phy-handle  and mdio
node, the mdio_register is successfull and interrupt handling works
fine. Do I need to add any checks before mdio_register or updating the
dts file is enough?

> 
>     Andrew
Re: [RFC Patch net-next 0/4] net: dsa: microchip: ksz9477: enable interrupt for internal phy link detection
Posted by Andrew Lunn 3 years, 3 months ago
On Tue, Sep 13, 2022 at 04:21:47AM +0000, Arun.Ramadoss@microchip.com wrote:
> Hi Andrew, 
> On Mon, 2022-09-12 at 23:33 +0200, Andrew Lunn wrote:
> > EXTERNAL EMAIL: Do not click links or open attachments unless you
> > know the content is safe
> > 
> > On Fri, Sep 09, 2022 at 09:31:16PM +0530, Arun Ramadoss wrote:
> > > This patch series implements the common interrupt handling for
> > > ksz9477 based
> > > switches and lan937x. The ksz9477 and lan937x has similar interrupt
> > > registers
> > > except ksz9477 has 4 port based interrupts whereas lan937x has 6
> > > interrupts.
> > > The patch moves the phy interrupt hanler implemented in
> > > lan937x_main.c to
> > > ksz_common.c, along with the mdio_register functionality.
> > 
> > It is a good idea to state why it is an RFC. What sort of comments do
> > you want?
> 
> In the arch/arm/boot/dts/at91-sama5d3_ksz9477_evb.dts file, they
> haven't specified the phy-handle. If I use that dts file with this
> patch, during the mdio_register I get the error *no mdio bus node* and
> the ksz probe fails. If I update the dts file with phy-handle  and mdio
> node, the mdio_register is successfull and interrupt handling works
> fine. Do I need to add any checks before mdio_register or updating the
> dts file is enough?

Drivers are supposed to remain backwards compatible to older DT blobs.
So you need to support the phy-handle not being present.

You can however still add it to at91-sama5d3_ksz9477_evb.dts, have the
yaml binding indicate it is a required property, and maybe in 2 years
change the driver to make it required.

    Andrew