[RFC,net-next,05/11] net: dsa: microchip: lan937x: add shared global interrupt

Message ID 20230202125930.271740-6-rakesh.sankaranarayanan@microchip.com
State New
Headers
Series net: dsa: microchip: lan937x: add switch cascade support |

Commit Message

Rakesh Sankaranarayanan Feb. 2, 2023, 12:59 p.m. UTC
  In cascade mode interrupt line is shared among both switches.
Update global interrupt flag for shared interrupt, otherwise second
switch probe will fail with busy status.

Signed-off-by: Rakesh Sankaranarayanan <rakesh.sankaranarayanan@microchip.com>
---
 drivers/net/dsa/microchip/ksz_common.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
  

Comments

Andrew Lunn Feb. 2, 2023, 3:25 p.m. UTC | #1
On Thu, Feb 02, 2023 at 06:29:24PM +0530, Rakesh Sankaranarayanan wrote:
> In cascade mode interrupt line is shared among both switches.

I assume this is specific to the board you are using. Other boards
could have two interrupts. It should not cause a problem marking it a
shared, but please update the commit message to indicate that the
interrupts don't need to be shared.

	Andrew
  

Patch

diff --git a/drivers/net/dsa/microchip/ksz_common.c b/drivers/net/dsa/microchip/ksz_common.c
index 7062ce1749fb..adf8391dd29f 100644
--- a/drivers/net/dsa/microchip/ksz_common.c
+++ b/drivers/net/dsa/microchip/ksz_common.c
@@ -2009,7 +2009,8 @@  static irqreturn_t ksz_irq_thread_fn(int irq, void *dev_id)
 	return (nhandled > 0 ? IRQ_HANDLED : IRQ_NONE);
 }
 
-static int ksz_irq_common_setup(struct ksz_device *dev, struct ksz_irq *kirq)
+static int ksz_irq_common_setup(struct ksz_device *dev, struct ksz_irq *kirq,
+				unsigned long flag)
 {
 	int ret, n;
 
@@ -2025,7 +2026,7 @@  static int ksz_irq_common_setup(struct ksz_device *dev, struct ksz_irq *kirq)
 		irq_create_mapping(kirq->domain, n);
 
 	ret = request_threaded_irq(kirq->irq_num, NULL, ksz_irq_thread_fn,
-				   IRQF_ONESHOT, kirq->name, kirq);
+				   flag, kirq->name, kirq);
 	if (ret)
 		goto out;
 
@@ -2048,7 +2049,7 @@  static int ksz_girq_setup(struct ksz_device *dev)
 
 	girq->irq_num = dev->irq;
 
-	return ksz_irq_common_setup(dev, girq);
+	return ksz_irq_common_setup(dev, girq, (IRQF_ONESHOT | IRQF_SHARED));
 }
 
 static int ksz_pirq_setup(struct ksz_device *dev, u8 p)
@@ -2064,7 +2065,7 @@  static int ksz_pirq_setup(struct ksz_device *dev, u8 p)
 	if (pirq->irq_num < 0)
 		return pirq->irq_num;
 
-	return ksz_irq_common_setup(dev, pirq);
+	return ksz_irq_common_setup(dev, pirq, IRQF_ONESHOT);
 }
 
 static int ksz_setup(struct dsa_switch *ds)