[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YwOAxh7Bc12OornD@lunn.ch>
Date: Mon, 22 Aug 2022 15:12:38 +0200
From: Andrew Lunn <andrew@...n.ch>
To: Arun Ramadoss <arun.ramadoss@...rochip.com>
Cc: linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
Woojung Huh <woojung.huh@...rochip.com>,
UNGLinuxDriver@...rochip.com,
Vivien Didelot <vivien.didelot@...il.com>,
Florian Fainelli <f.fainelli@...il.com>,
Vladimir Oltean <olteanv@...il.com>,
"David S. Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
Russell King <linux@...linux.org.uk>,
Tristram Ha <Tristram.Ha@...rochip.com>
Subject: Re: [RFC Patch net-next v2] net: dsa: microchip: lan937x: enable
interrupt for internal phy link detection
On Mon, Aug 22, 2022 at 02:50:17PM +0530, Arun Ramadoss wrote:
> This patch enables the interrupts for internal phy link detection for
> LAN937x. The interrupt enable bits are active low. It first enables port
> interrupt and then port phy interrupt. Also patch register the irq
> thread and in the ISR routine it clears the POR_READY_STS bit.
> POR_READY_STS bit is write one clear bit and all other bit in the
> register are read only. Since phy interrupts are handled by the lan937x
> phy layer, switch interrupt routine does not read the phy layer
> interrupts.
> +static irqreturn_t lan937x_switch_irq_thread(int irq, void *dev_id)
> +{
> + struct ksz_device *dev = dev_id;
> + irqreturn_t result = IRQ_NONE;
> + u32 data;
> + int ret;
> +
> + /* Read global interrupt status register */
> + ret = ksz_read32(dev, REG_SW_INT_STATUS__4, &data);
> + if (ret)
> + return result;
> +
> + if (data & POR_READY_INT) {
> + ret = ksz_write32(dev, REG_SW_INT_STATUS__4, POR_READY_INT);
> + if (ret)
> + return result;
> + }
> +
> + return result;
> +}
I don't understand how this all fits together. How do you get from
this interrupt handler into the PHY interrupt handler?
The hardware looks similar to the mv88e6xxx driver. You have a top
level interrupt controller which indicates a port has some sort of
interrupt handler. This is the mv88e6xxx_g1_irq_thread_work(). It
finds which port triggered the interrupt and then hands the interrupt
off to the nested interrupt handler.
mv88e6xxx_g2_irq_thread_fn() is the nested per port interrupt
handler. It reads the per port interrupt status register, find the
interrupt handler and calls the nested interrupt handler.
This all glues together because phylib does a request_threaded_irq()
for the PHY interrupt, so this last nested interrupt handler is in
phylib.
Andrew
Powered by blists - more mailing lists