Skip to contentSkip to conversation

ARM: integrator: cascaded IRQs on IM-PD1

PATCH New Linus Walleij 2 participants 9 messages Jan 22, 2014 – Feb 3, 2014

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

cover ARM: integrator: cascaded IRQs on IM-PD1

This series alters the VIC driver to allow for cascaded VICs off other IRQ parents, such as the VIC found on the IM-PD1 daughterboard on the Integrator/AP.

After this series I can start a fully working console on the UARTs on the IM-PD1 that report their IRQs in /proc/interrupts like this:

root at integrator:/ cat /proc/interrupts
CPU0

 17:        111       pic   1  uart-pl010
 18:          7       pic   2  uart-pl010
 22:       5377       pic   6  timer
 24:          0       pic   8  rtc-pl030
 33:          0       pic  17  PCIv3 error
 39:        102       VIC   1  uart-pl011
 40:          7       VIC   2  uart-pl011

Err: 0

(Dumped on the IM-PD1 UART.)

Linus Walleij (5):
irqchip: vic: update the base IRQ member correctly
irqchip: support cascaded VICs
ARM: integrator: use managed resources for the IM-PD1
ARM: integrator: register the IM-PD1 VIC
ARM: integrator: select AMBA bus and GPIO block

 arch/arm/mach-integrator/Kconfig |  4 ++
 arch/arm/mach-integrator/impd1.c | 81 +++++++++++++++++++++++-----------------
 arch/arm/mach-versatile/core.c   |  2 +-
 drivers/irqchip/irq-vic.c        | 59 +++++++++++++++++++++++++----
 include/linux/irqchip/arm-vic.h  |  6 ++-
 5 files changed, 107 insertions(+), 45 deletions(-)
Signature · 1 line
1.8.4.2
#1 lore raw

PATCH 1/5 irqchip: vic: update the base IRQ member correctly

When passing 0 as the irq base the VIC driver will dynamically allocate a number of consecutive interrupt descriptors at some available number range. Make sure this number is recorded in the state container rather than the passed-in zero argument in this case.

Cc Thomas Gleixner <[email protected]>

---
tglx: if you're happy with this pls ACK it so I can take this through the ARM SoC tree.

---
 drivers/irqchip/irq-vic.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/irqchip/irq-vic.c +5 -1
index 8e21ae0bab46..70108c1491bc 100644
@@ -273,7 +273,6 @@ static void __init vic_register(void __iomem *base, unsigned int irq,
 	v->base = base;
 	v->valid_sources = valid_sources;
 	v->resume_sources = resume_sources;
-	v->irq = irq;
 	set_handle_irq(vic_handle_irq);
 	vic_id++;
 	v->domain = irq_domain_add_simple(node, fls(valid_sources), irq,
@@ -282,6 +281,11 @@ static void __init vic_register(void __iomem *base, unsigned int irq,
 	for (i = 0; i < fls(valid_sources); i++)
 		if (valid_sources & (1 << i))
 			irq_create_mapping(v->domain, i);
+	/* If no base IRQ was passed, figure out our allocated base */
+	if (irq)
+		v->irq = irq;
+	else
+		v->irq = irq_find_mapping(v->domain, 0);
 }
 
 static void vic_ack_irq(struct irq_data *d)
Signature · 1 line
1.8.4.2
#2 lore raw

PATCH 1/5 irqchip: vic: update the base IRQ member correctly

Quoted 11 lines · Linus Walleij

When passing 0 as the irq base the VIC driver will dynamically allocate a number of consecutive interrupt descriptors at some available number range. Make sure this number is recorded in the state container rather than the passed-in zero argument in this case.

Cc Thomas Gleixner <[email protected]>

---
tglx: if you're happy with this pls ACK it so I can take this through the ARM SoC tree.

Ping on this.
Wanna queue up some stuff in ARM SoC.

Yours,
Linus Walleij

#3 lore raw

PATCH 2/5 irqchip: support cascaded VICs

In reply to Linus Walleij

This adds support for a VIC to be cascaded off another IRQ. On the Integrator/AP logical module IM-PD1 there is a VIC cascaded off the central FPGA IRQ controller so this is needed for that to work out.

In order for the plug-in board to be able to register all the devices with their IRQs relative to the offset of the base obtained for the cascaded VIC, the base IRQ number is passed back to the caller.

Cc Thomas Gleixner <[email protected]>

---
tglx: if you're happy with this pls ACK it so I can take this through the ARM SoC tree.

---
 arch/arm/mach-versatile/core.c  |  2 +-
 drivers/irqchip/irq-vic.c       | 53 ++++++++++++++++++++++++++++++++++++-----
 include/linux/irqchip/arm-vic.h |  6 +++--
 3 files changed, 52 insertions(+), 9 deletions(-)
arch/arm/mach-versatile/core.c +1 -1
index 3b0572f30d56..36b97212d554 100644
@@ -108,7 +108,7 @@ void __init versatile_init_irq(void)
 
 	np = of_find_matching_node_by_address(NULL, vic_of_match,
 					      VERSATILE_VIC_BASE);
-	__vic_init(VA_VIC_BASE, IRQ_VIC_START, ~0, 0, np);
+	__vic_init(VA_VIC_BASE, 0, IRQ_VIC_START, ~0, 0, np);
 
 	writel(~0, VA_SIC_BASE + SIC_IRQ_ENABLE_CLEAR);
 
drivers/irqchip/irq-vic.c +47 -6

109 lines not on this page · raw message

include/linux/irqchip/arm-vic.h +4 -2
index e3c82dc95756..ba46c794b4e5 100644
@@ -29,8 +29,10 @@
 struct device_node;
 struct pt_regs;
 
-void __vic_init(void __iomem *base, int irq_start, u32 vic_sources,
-		u32 resume_sources, struct device_node *node);
+void __vic_init(void __iomem *base, int parent_irq, int irq_start,
+		u32 vic_sources, u32 resume_sources, struct device_node *node);
 void vic_init(void __iomem *base, unsigned int irq_start, u32 vic_sources, u32 resume_sources);
+int vic_init_cascaded(void __iomem *base, unsigned int parent_irq,
+		      u32 vic_sources, u32 resume_sources);
 
 #endif
Signature · 1 line
1.8.4.2
#4 lore raw

PATCH 2/5 irqchip: support cascaded VICs

Quoted 10 lines · Linus Walleij

This adds support for a VIC to be cascaded off another IRQ. On the Integrator/AP logical module IM-PD1 there is a VIC cascaded off the central FPGA IRQ controller so this is needed for that to work out.

In order for the plug-in board to be able to register all the devices with their IRQs relative to the offset of the base obtained for the cascaded VIC, the base IRQ number is passed back to the caller.

Quoted 5 lines
Cc Thomas Gleixner <[email protected]>

---
tglx: if you're happy with this pls ACK it so I can take this through the ARM SoC tree.

Ping on this, too.

Yours,
Linus Walleij

#5 lore raw

PATCH 3/5 ARM: integrator: use managed resources for the IM-PD1

In reply to Linus Walleij

Switch the IM-PD1 driver to use managed resources and cut down on boilerplate.

---
 arch/arm/mach-integrator/impd1.c | 36 ++++++++++--------------------------
 1 file changed, 10 insertions(+), 26 deletions(-)
arch/arm/mach-integrator/impd1.c +10 -26
index 9f82f9dcbb98..aeeae0d79a18 100644
@@ -307,25 +307,23 @@ static struct impd1_device impd1_devs[] = {
 static int impd1_probe(struct lm_device *dev)
 {
 	struct impd1_module *impd1;
-	int i, ret;
+	int i;
 
 	if (dev->id != module_id)
 		return -EINVAL;
 
-	if (!request_mem_region(dev->resource.start, SZ_4K, "LM registers"))
+	if (!devm_request_mem_region(&dev->dev, dev->resource.start,
+				     SZ_4K, "LM registers"))
 		return -EBUSY;
 
-	impd1 = kzalloc(sizeof(struct impd1_module), GFP_KERNEL);
-	if (!impd1) {
-		ret = -ENOMEM;
-		goto release_lm;
-	}
+	impd1 = devm_kzalloc(&dev->dev, sizeof(struct impd1_module),
+			     GFP_KERNEL);
+	if (!impd1)
+		return -ENOMEM;
 
-	impd1->base = ioremap(dev->resource.start, SZ_4K);
-	if (!impd1->base) {
-		ret = -ENOMEM;
-		goto free_impd1;
-	}
+	impd1->base = devm_ioremap(&dev->dev, dev->resource.start, SZ_4K);
+	if (!impd1->base)
+		return -ENOMEM;
 
 	lm_set_drvdata(dev, impd1);
 
@@ -353,14 +351,6 @@ static int impd1_probe(struct lm_device *dev)
 	}
 
 	return 0;
-
- free_impd1:
-	if (impd1 && impd1->base)
-		iounmap(impd1->base);
-	kfree(impd1);
- release_lm:
-	release_mem_region(dev->resource.start, SZ_4K);
-	return ret;
 }
 
 static int impd1_remove_one(struct device *dev, void *data)
@@ -371,16 +361,10 @@ static int impd1_remove_one(struct device *dev, void *data)
 
 static void impd1_remove(struct lm_device *dev)
 {
-	struct impd1_module *impd1 = lm_get_drvdata(dev);
-
 	device_for_each_child(&dev->dev, NULL, impd1_remove_one);
 	integrator_impd1_clk_exit(dev->id);
 
 	lm_set_drvdata(dev, NULL);
-
-	iounmap(impd1->base);
-	kfree(impd1);
-	release_mem_region(dev->resource.start, SZ_4K);
 }
 
 static struct lm_driver impd1_driver = {
Signature · 1 line
1.8.4.2
#6 lore raw

PATCH 4/5 ARM: integrator: register the IM-PD1 VIC

In reply to Linus Walleij

The peripherals on the IM-PD1 has never really been able to properly fire their IRQs to the main FPGA IRQ controller. Cascade it properly and register interrupts for all the devices in the array.

---
 arch/arm/mach-integrator/Kconfig |  1 +
 arch/arm/mach-integrator/impd1.c | 45 ++++++++++++++++++++++++++++++++--------
 2 files changed, 37 insertions(+), 9 deletions(-)
arch/arm/mach-integrator/Kconfig +1 -0
index abeff25532ab..46be99007529 100644
@@ -30,6 +30,7 @@ config ARCH_CINTEGRATOR
 config INTEGRATOR_IMPD1
 	tristate "Include support for Integrator/IM-PD1"
 	depends on ARCH_INTEGRATOR_AP
+	select ARM_VIC
 	help
 	  The IM-PD1 is an add-on logic module for the Integrator which
 	  allows ARM(R) Ltd PrimeCells to be developed and evaluated.
arch/arm/mach-integrator/impd1.c +36 -9

89 lines not on this page · raw message

Signature · 1 line
1.8.4.2
#7 lore raw

PATCH 5/5 ARM: integrator: select AMBA bus and GPIO block

In reply to Linus Walleij

The Integrator/AP can be used with a logical module called IM-PD1, which contains a few AMBA PrimeCell devices, one of which is the PL061 GPIO controller. As the lines from this GPIO controller are looped back to devices on the board itself and provides resources back to it, we need to always have GPIO and the PL061 driver available for other devices to work.

---
 arch/arm/mach-integrator/Kconfig | 3 +++
 1 file changed, 3 insertions(+)
arch/arm/mach-integrator/Kconfig +3 -0
index 46be99007529..b61e962ef992 100644
@@ -30,7 +30,10 @@ config ARCH_CINTEGRATOR
 config INTEGRATOR_IMPD1
 	tristate "Include support for Integrator/IM-PD1"
 	depends on ARCH_INTEGRATOR_AP
+	select ARCH_REQUIRE_GPIOLIB
+	select ARM_AMBA
 	select ARM_VIC
+	select GPIO_PL061 if GPIOLIB
 	help
 	  The IM-PD1 is an add-on logic module for the Integrator which
 	  allows ARM(R) Ltd PrimeCells to be developed and evaluated.
Signature · 1 line
1.8.4.2
#8 lore raw

PATCH 5/5 ARM: integrator: select AMBA bus and GPIO block

Quoted 1 line · Linus Walleij

The Integrator/AP can be used with a logical module called

logic module

arch/arm/mach-integrator/Kconfig config ARCH_CINTEGRATOR · line 34

Quoted 11 lines

IM-PD1, which contains a few AMBA PrimeCell devices, one of which is the PL061 GPIO controller. As the lines from this GPIO controller are looped back to devices on the board itself and provides resources back to it, we need to always have GPIO and the PL061 driver available for other devices to work.

config INTEGRATOR_IMPD1

arch/arm/mach-integrator/Kconfig +2 -0
 	tristate "Include support for Integrator/IM-PD1"
 	depends on ARCH_INTEGRATOR_AP
+	select ARCH_REQUIRE_GPIOLIB
+	select ARM_AMBA

Doesn't ARCH_INTEGRATOR already select ARM_AMBA, which this option already depends on?

Signature · 3 lines
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up.  Estimation
in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad.
Estimate before purchase was "up to 13.2Mbit".