Subject: Re: [RFC Patch net-next v3 3/3] net: dsa: microchip: lan937x: add interrupt support for port phy link

From: Andrew Lunn <[email-masked]>
Date: Thu, 1 Sep 2022 14:32:46 +0200

> > > +static irqreturn_t lan937x_girq_thread_fn(int irq, void *dev_id)
> > > +{
> > > +     struct ksz_device *dev = dev_id;
> > > +     unsigned int nhandled = 0;
> > > +     unsigned int sub_irq;
> > > +     unsigned int n;
> > > +     u32 data;
> > > +     int ret;
> > > +
> > > +     ret = ksz_read32(dev, REG_SW_INT_STATUS__4, &data);
> > > +     if (ret)
> > > +             goto out;
> > > +
> > > +     if (data & POR_READY_INT) {
> > > +             ret = ksz_write32(dev, REG_SW_INT_STATUS__4,
> > > POR_READY_INT);
> > > +             if (ret)
> > > +                     goto out;
> > > +     }
> > 
> > What do these two read/writes do? It seems like you are discarding an
> > interrupt?
> 
> This interrupt in Power on reset interrupt. It is enabled by default in
> the chip. I am not performing any operation based on POR. So I just
> cleared the interrupt. Do I need to disable the POR interrupt in the
> setup function, since no operation is performed based on it?

It is pretty normal during interrupt controller creation to first
disable all interrupt sources, then clear the interrupt status
register if that can be done with a single operation, and then
register the interrupt controller with the IRQ core. That way, any
outstanding interrupts don't fire.

	    Andrew