[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <Y4z/A5Yn39AX0yWm@gvm01>
Date: Sun, 4 Dec 2022 21:11:47 +0100
From: Piergiorgio Beruto <piergiorgio.beruto@...il.com>
To: Andrew Lunn <andrew@...n.ch>
Cc: "Russell King (Oracle)" <linux@...linux.org.uk>,
Heiner Kallweit <hkallweit1@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>, linux-kernel@...r.kernel.org,
netdev@...r.kernel.org, Oleksij Rempel <o.rempel@...gutronix.de>
Subject: Re: [PATCH net-next 3/4] drivers/net/phy: Add driver for the onsemi
NCN26000 10BASE-T1S PHY
On Sun, Dec 04, 2022 at 07:00:38PM +0100, Andrew Lunn wrote:
> > On Sun, Dec 04, 2022 at 03:31:33AM +0100, Piergiorgio Beruto wrote:
> > > +static irqreturn_t ncn26000_handle_interrupt(struct phy_device *phydev)
> > > +{
> > > + const struct ncn26000_priv *const priv = phydev->priv;
> > > + u16 events;
> > > + int ret;
> > > +
> > > + // read and aknowledge the IRQ status register
> > > + ret = phy_read(phydev, NCN26000_REG_IRQ_STATUS);
> > > +
> > > + if (unlikely(ret < 0))
> > > + return IRQ_NONE;
> > > +
> > > + events = (u16)ret & priv->enabled_irqs;
> > > + if (events == 0)
> > > + return IRQ_NONE;
> > > +
> > > + if (events & NCN26000_IRQ_LINKST_BIT) {
> > > + ret = phy_read(phydev, MII_BMSR);
> > > +
> > > + if (unlikely(ret < 0)) {
> > > + phydev_err(phydev,
> > > + "error reading the status register (%d)\n",
> > > + ret);
> > > +
> > > + return IRQ_NONE;
> > > + }
> > > +
> > > + phydev->link = ((u16)ret & BMSR_ANEGCOMPLETE) ? 1 : 0;
>
> Hi Piergiorgio
>
> Interrupt handling in PHY don't follow the usual model. Historically,
> PHYs were always polled once per second. The read_status() function
> gets called to report the current status of the PHY. Interrupt are
> just used to indicate that poll should happen now. All the handler
> needs to do is clear the interrupt line so it can be safely reenabled
> and not cause an interrupt storm, and call phy_trigger_machine() to
> trigger the poll.
To be honest, I sort of realized that. But I was confused again by the
read_status() function description. It looked to me it was not invoked
when AN is not supported, but I'm hearing this is not the case.
I'll rework this part.
Thanks
Piergiorgio
Powered by blists - more mailing lists