irqchip: lpc32xx: add LPC32xx irqchip driver
Subsystems (5)
Vladimir Zapolskiy
maintainerv2 cover irqchip: lpc32xx: add LPC32xx irqchip driver
The change replaces legacy NXP LPC32xx irqchip driver with a new one.
Legacy LPC32xx interrupt controller driver was broken since commit 76ba59f8366f ("genirq: Add irq_domain-aware core IRQ handler"), which requires a private interrupt handler, otherwise any fired SIC1 generated interrupt (mapped to MIC hwirq 0) breaks the kernel with the message "unexpected IRQ trap at vector 00".
Summary of changes from v1 to v2:
* 2 of 10 from v1 changes are found in v4.6 and thus skipped from this series,
* removed all changes related to optional property 'wakeup-source', which will be needed later on to support interrupts as wakeup sources,
* removed introduced optional property 'interrupt-controller-name',
* moved DTS changes after new driver, new driver alone used with old DTS allows to boot LPC32xx boards,
* added a change which actually removes legacy driver,
* improvements in the driver based on a review findings from Marc.
* minor improvements all over the code.
v1 of the changeset can be found here:
http://www.spinics.net/lists/devicetree/msg103231.html
Vladimir Zapolskiy (4):
dt-bindings: interrupt-controllers: add description of SIC1 and SIC2
irqchip: add LPC32xx interrupt controller driver
arm: dts: lpc32xx: reparent SIC1 and SIC2 interrupts from MIC
ARM: lpc32xx: remove legacy irq controller driver
.../interrupt-controller/nxp,lpc3220-mic.txt | 70 +-- arch/arm/Kconfig | 2 + arch/arm/boot/dts/lpc32xx.dtsi | 58 ++- arch/arm/mach-lpc32xx/Makefile | 2 +- arch/arm/mach-lpc32xx/irq.c | 477 --------------------- arch/arm/mach-lpc32xx/phy3250.c | 1 - drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-lpc32xx.c | 238 ++++++++++ 8 files changed, 329 insertions(+), 520 deletions(-) delete mode 100644 arch/arm/mach-lpc32xx/irq.c create mode 100644 drivers/irqchip/irq-lpc32xx.c
Signature · 1 line
2.1.4
Vladimir Zapolskiy
maintainerPATCH v2 1/4 dt-bindings: interrupt-controllers: add description of SIC1 and SIC2
NXP LPC32xx has three interrupt controllers, namely root Main Interrupt Controller (MIC) and two supplementary Sub Interrupt Controllers (SIC1 and SIC2), four interrupt outputs from SIC1 and SIC2 are connected to MIC.
---
Changes from v1 to v2:
* removed introduced optional "interrupt-controller-name" property, for users the name of a controller will be constructed from mic/sic and controller physical address,
* removed introduced optional "wakeup-sources" property, a list of mappings between a hardware interrupt and its correspondent wakeup source to exit CPU STOP mode will be discussed later on,
* other negligible changes (rewording, small letters in unit address etc.)
.../interrupt-controller/nxp,lpc3220-mic.txt | 70 ++++++++++++++-------- 1 file changed, 46 insertions(+), 24 deletions(-)
Documentation/devicetree/bindings/interrupt-controller/nxp,lpc3220-mic.txt +46 -24
@@ -1,38 +1,60 @@ -* NXP LPC32xx Main Interrupt Controller - (MIC, including SIC1 and SIC2 secondary controllers) +* NXP LPC32xx MIC, SIC1 and SIC2 Interrupt Controllers Required properties: -- compatible: Should be "nxp,lpc3220-mic" -- interrupt-controller: Identifies the node as an interrupt controller. -- interrupt-parent: Empty for the interrupt controller itself -- #interrupt-cells: The number of cells to define the interrupts. Should be 2. - The first cell is the IRQ number - The second cell is used to specify mode: - 1 = low-to-high edge triggered - 2 = high-to-low edge triggered - 4 = active high level-sensitive - 8 = active low level-sensitive - Default for internal sources should be set to 4 (active high). -- reg: Should contain MIC registers location and length +- compatible: "nxp,lpc3220-mic" or "nxp,lpc3220-sic". +- reg: should contain IC registers location and length. +- interrupt-controller: identifies the node as an interrupt controller. +- #interrupt-cells: the number of cells to define an interrupt, should be 2. + The first cell is the IRQ number, the second cell is used to specify + one of the supported IRQ types: + IRQ_TYPE_EDGE_RISING = low-to-high edge triggered, + IRQ_TYPE_EDGE_FALLING = high-to-low edge triggered, + IRQ_TYPE_LEVEL_HIGH = active high level-sensitive, + IRQ_TYPE_LEVEL_LOW = active low level-sensitive. + Reset value is IRQ_TYPE_LEVEL_LOW. + +Optional properties: +- interrupt-parent: empty for MIC interrupt controller, link to parent + MIC interrupt controller for SIC1 and SIC2 +- interrupts: empty for MIC interrupt controller, cascaded MIC + hardware interrupts for SIC1 and SIC2 Examples: - /* - * MIC - */ + + /* LPC32xx MIC, SIC1 and SIC2 interrupt controllers */ mic: interrupt-controller at 40008000 { compatible = "nxp,lpc3220-mic"; + reg = <0x40008000 0x4000>; + interrupt-controller; + #interrupt-cells = <2>; + }; + + sic1: interrupt-controller at 4000c000 { + compatible = "nxp,lpc3220-sic"; + reg = <0x4000c000 0x4000>; interrupt-controller; - interrupt-parent; #interrupt-cells = <2>; - reg = <0x40008000 0xC000>; + + interrupt-parent = <&mic>; + interrupts = <0 IRQ_TYPE_LEVEL_LOW>, + <30 IRQ_TYPE_LEVEL_LOW>; }; - /* - * ADC - */ + sic2: interrupt-controller at 40010000 { + compatible = "nxp,lpc3220-sic"; + reg = <0x40010000 0x4000>; + interrupt-controller; + #interrupt-cells = <2>; + + interrupt-parent = <&mic>; + interrupts = <1 IRQ_TYPE_LEVEL_LOW>, + <31 IRQ_TYPE_LEVEL_LOW>; + }; + + /* ADC */ adc at 40048000 { compatible = "nxp,lpc3220-adc"; reg = <0x40048000 0x1000>; - interrupt-parent = <&mic>; - interrupts = <39 4>; + interrupt-parent = <&sic1>; + interrupts = <7 IRQ_TYPE_LEVEL_HIGH>; };
Signature · 1 line
2.1.4
Rob Herring
maintainerPATCH v2 1/4 dt-bindings: interrupt-controllers: add description of SIC1 and SIC2
Quoted 16 lines · Vladimir Zapolskiy
NXP LPC32xx has three interrupt controllers, namely root Main Interrupt Controller (MIC) and two supplementary Sub Interrupt Controllers (SIC1 and SIC2), four interrupt outputs from SIC1 and SIC2 are connected to MIC.
Signed-off-by Vladimir Zapolskiy <[email protected]>---
Changes from v1 to v2:
* removed introduced optional "interrupt-controller-name" property, for users the name of a controller will be constructed from mic/sic and controller physical address,
* removed introduced optional "wakeup-sources" property, a list of mappings between a hardware interrupt and its correspondent wakeup source to exit CPU STOP mode will be discussed later on,
* other negligible changes (rewording, small letters in unit address etc.)
Quoted 2 lines
.../interrupt-controller/nxp,lpc3220-mic.txt | 70 ++++++++++++++-------- 1 file changed, 46 insertions(+), 24 deletions(-)
PATCH v2 1/4 dt-bindings: interrupt-controllers: add description of SIC1 and SIC2
Quoted 17 lines · Rob Herring
Quoted 16 lines · Vladimir Zapolskiy
NXP LPC32xx has three interrupt controllers, namely root Main Interrupt Controller (MIC) and two supplementary Sub Interrupt Controllers (SIC1 and SIC2), four interrupt outputs from SIC1 and SIC2 are connected to MIC.
Signed-off-by Vladimir Zapolskiy <[email protected]>---
Changes from v1 to v2:
* removed introduced optional "interrupt-controller-name" property, for users the name of a controller will be constructed from mic/sic and controller physical address,
* removed introduced optional "wakeup-sources" property, a list of mappings between a hardware interrupt and its correspondent wakeup source to exit CPU STOP mode will be discussed later on,
* other negligible changes (rewording, small letters in unit address etc.)
Quoted 4 lines
Quoted 2 lines
.../interrupt-controller/nxp,lpc3220-mic.txt | 70 ++++++++++++++-------- 1 file changed, 46 insertions(+), 24 deletions(-)Acked-by Rob Herring <[email protected]>
Quoted 4 lines
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Vladimir Zapolskiy
maintainerPATCH v2 2/4 irqchip: add LPC32xx interrupt controller driver
In reply to Vladimir ZapolskiyThe change adds improved support of NXP LPC32xx MIC, SIC1 and SIC2 interrupt controllers.
This is a list of new features in comparison to the legacy driver:
* irq types are taken from device tree settings, no more need to hardcode them,
* old driver is based on irq_domain_add_legacy, which causes problems with handling MIC hardware interrupt 0 produced by SIC1,
* there is one driver for MIC, SIC1 and SIC2, no more need to handle them separately, e.g. have two separate handlers for SIC1 and SIC2,
* the driver does not have any dependencies on hardcoded register offsets,
* the driver is much simpler for maintenance,
* SPARSE_IRQS option is supported.
Legacy LPC32xx interrupt controller driver was broken since commit 76ba59f8366f ("genirq: Add irq_domain-aware core IRQ handler"), which requires a private interrupt handler, otherwise any SIC1 generated interrupt (mapped to MIC hwirq 0) breaks the kernel with the message "unexpected IRQ trap at vector 00".
The change disables compilation of a legacy driver found at arch/arm/mach-lpc32xx/irq.c, the file will be removed in a separate commit.
---
Changes from v1 to v2:
* added chained_irq_{enter,exit} for SIC chained handler,
* use {writel,readl}_relaxed flavour of io access functions,
* changed anchor data type to access iomem from struct irq_domain to private struct lpc32xx_irq_chip,
* do not read irq status register twice on every irq event,
* resource deallocation fixes on error path of irqchip driver init,
* removed handling of "interrupt-controller-name" property, name is constructed from mic/sic type and controller's physical address,
* minor improvements (renames, __ffs instead of ffs, etc.)
Many kudos to Marc for review of v1.
arch/arm/Kconfig | 2 + arch/arm/mach-lpc32xx/phy3250.c | 1 - drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-lpc32xx.c | 238 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 241 insertions(+), 1 deletion(-) create mode 100644 drivers/irqchip/irq-lpc32xx.c
arch/arm/Kconfig +2 -0
@@ -531,6 +531,8 @@ config ARCH_LPC32XX select COMMON_CLK select CPU_ARM926T select GENERIC_CLOCKEVENTS + select MULTI_IRQ_HANDLER + select SPARSE_IRQ select USE_OF help Support for the NXP LPC32XX family of processors
arch/arm/mach-lpc32xx/phy3250.c +0 -1
@@ -206,7 +206,6 @@ static const char *const lpc32xx_dt_compat[] __initconst = {DT_MACHINE_START (LPC32XX_DT ,"LPC32XX SoC (Flattened Device Tree)" ) .atag_offset = 0x100, .map_io = lpc32xx_map_io, - .init_irq = lpc32xx_init_irq, .init_machine = lpc3250_machine_init, .dt_compat = lpc32xx_dt_compat,MACHINE_END
drivers/irqchip/Makefile +1 -0
@@ -7,6 +7,7 @@ obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2835.o obj-$(CONFIG_ARCH_BCM2835) += irq-bcm2836.o obj-$(CONFIG_ARCH_EXYNOS) += exynos-combiner.o obj-$(CONFIG_ARCH_HIP04) += irq-hip04.o +obj-$(CONFIG_ARCH_LPC32XX) += irq-lpc32xx.o obj-$(CONFIG_ARCH_MMP) += irq-mmp.o obj-$(CONFIG_IRQ_MXS) += irq-mxs.o obj-$(CONFIG_ARCH_TEGRA) += irq-tegra.o
drivers/irqchip/irq-lpc32xx.c new file +238 -0
238 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH v2 2/4 irqchip: add LPC32xx interrupt controller driver
Hi Vladimir,
Quoted 38 lines · Vladimir Zapolskiy
The change adds improved support of NXP LPC32xx MIC, SIC1 and SIC2 interrupt controllers.
This is a list of new features in comparison to the legacy driver:
* irq types are taken from device tree settings, no more need to hardcode them,
* old driver is based onirq_domain_add_legacy, which causes problems with handling MIC hardware interrupt 0 produced by SIC1,
* there is one driver for MIC, SIC1 and SIC2, no more need to handle them separately, e.g. have two separate handlers for SIC1 and SIC2,
* the driver does not have any dependencies on hardcoded register offsets,
* the driver is much simpler for maintenance,
*SPARSE_IRQSoption is supported.Legacy LPC32xx interrupt controller driver was broken since commit
76ba59f8366f("genirq: Add irq_domain-aware core IRQ handler"), which requires a private interrupt handler, otherwise any SIC1 generated interrupt (mapped to MIC hwirq 0) breaks the kernel with the message "unexpected IRQ trap at vector 00".The change disables compilation of a legacy driver found at
arch/arm/mach-lpc32xx/irq.c, the file will be removed in a separate commit.Signed-off-by Vladimir Zapolskiy <[email protected]>---
Changes from v1 to v2:
* added chained_irq_{enter,exit} for SIC chained handler,
* use {writel,readl}_relaxed flavour of io access functions,
* changed anchor data type to access iomem from structirq_domainto private structlpc32xx_irq_chip,
* do not read irq status register twice on every irq event,
* resource deallocation fixes on error path of irqchip driver init,
* removed handling of "interrupt-controller-name" property, name is constructed from mic/sic type and controller's physical address,
* minor improvements (renames,__ffsinstead of ffs, etc.)
Quoted 9 lines
Many kudos to Marc for review of v1.
arch/arm/Kconfig | 2 + arch/arm/mach-lpc32xx/phy3250.c | 1 - drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-lpc32xx.c | 238 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 241 insertions(+), 1 deletion(-) create mode 100644 drivers/irqchip/irq-lpc32xx.c
I tested the driver on a custom LPC3250 board; I was having at least 1 interrupt generated from each source (MIC/SIC1/SIC2).
Vladimir Zapolskiy
maintainerPATCH v2 2/4 irqchip: add LPC32xx interrupt controller driver
Quoted 50 lines · Sylvain Lemieux
Hi Vladimir,
Quoted 38 lines · Vladimir Zapolskiy
The change adds improved support of NXP LPC32xx MIC, SIC1 and SIC2 interrupt controllers.
This is a list of new features in comparison to the legacy driver:
* irq types are taken from device tree settings, no more need to hardcode them,
* old driver is based onirq_domain_add_legacy, which causes problems with handling MIC hardware interrupt 0 produced by SIC1,
* there is one driver for MIC, SIC1 and SIC2, no more need to handle them separately, e.g. have two separate handlers for SIC1 and SIC2,
* the driver does not have any dependencies on hardcoded register offsets,
* the driver is much simpler for maintenance,
*SPARSE_IRQSoption is supported.Legacy LPC32xx interrupt controller driver was broken since commit
76ba59f8366f("genirq: Add irq_domain-aware core IRQ handler"), which requires a private interrupt handler, otherwise any SIC1 generated interrupt (mapped to MIC hwirq 0) breaks the kernel with the message "unexpected IRQ trap at vector 00".The change disables compilation of a legacy driver found at
arch/arm/mach-lpc32xx/irq.c, the file will be removed in a separate commit.Signed-off-by Vladimir Zapolskiy <[email protected]>---
Changes from v1 to v2:
* added chained_irq_{enter,exit} for SIC chained handler,
* use {writel,readl}_relaxed flavour of io access functions,
* changed anchor data type to access iomem from structirq_domainto private structlpc32xx_irq_chip,
* do not read irq status register twice on every irq event,
* resource deallocation fixes on error path of irqchip driver init,
* removed handling of "interrupt-controller-name" property, name is constructed from mic/sic type and controller's physical address,
* minor improvements (renames,__ffsinstead of ffs, etc.)Quoted 9 lines
Many kudos to Marc for review of v1.
arch/arm/Kconfig | 2 + arch/arm/mach-lpc32xx/phy3250.c | 1 - drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-lpc32xx.c | 238 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 241 insertions(+), 1 deletion(-) create mode 100644 drivers/irqchip/irq-lpc32xx.c
Quoted 5 lines
I tested the driver on a custom LPC3250 board; I was having at least 1 interrupt generated from each source (MIC/SIC1/SIC2).
Tested-by Sylvain Lemieux <[email protected]>
Thomas, Marc, Jason, Russell,
in your opinion would it be still possible to accept this change v2 2/4 for v4.7?
Thank you.
--
With best wishes,
Vladimir
PATCH v2 2/4 irqchip: add LPC32xx interrupt controller driver
Quoted 54 lines · Vladimir Zapolskiy
Quoted 53 lines · Sylvain Lemieux
Hi Vladimir,
Quoted 38 lines · Vladimir Zapolskiy
The change adds improved support of NXP LPC32xx MIC, SIC1 and SIC2 interrupt controllers.
This is a list of new features in comparison to the legacy driver:
* irq types are taken from device tree settings, no more need to hardcode them,
* old driver is based onirq_domain_add_legacy, which causes problems with handling MIC hardware interrupt 0 produced by SIC1,
* there is one driver for MIC, SIC1 and SIC2, no more need to handle them separately, e.g. have two separate handlers for SIC1 and SIC2,
* the driver does not have any dependencies on hardcoded register offsets,
* the driver is much simpler for maintenance,
*SPARSE_IRQSoption is supported.Legacy LPC32xx interrupt controller driver was broken since commit
76ba59f8366f("genirq: Add irq_domain-aware core IRQ handler"), which requires a private interrupt handler, otherwise any SIC1 generated interrupt (mapped to MIC hwirq 0) breaks the kernel with the message "unexpected IRQ trap at vector 00".The change disables compilation of a legacy driver found at
arch/arm/mach-lpc32xx/irq.c, the file will be removed in a separate commit.Signed-off-by Vladimir Zapolskiy <[email protected]>---
Changes from v1 to v2:
* added chained_irq_{enter,exit} for SIC chained handler,
* use {writel,readl}_relaxed flavour of io access functions,
* changed anchor data type to access iomem from structirq_domainto private structlpc32xx_irq_chip,
* do not read irq status register twice on every irq event,
* resource deallocation fixes on error path of irqchip driver init,
* removed handling of "interrupt-controller-name" property, name is constructed from mic/sic type and controller's physical address,
* minor improvements (renames,__ffsinstead of ffs, etc.)Quoted 9 lines
Many kudos to Marc for review of v1.
arch/arm/Kconfig | 2 + arch/arm/mach-lpc32xx/phy3250.c | 1 - drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-lpc32xx.c | 238 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 241 insertions(+), 1 deletion(-) create mode 100644 drivers/irqchip/irq-lpc32xx.cI tested the driver on a custom LPC3250 board; I was having at least 1 interrupt generated from each source (MIC/SIC1/SIC2).
Quoted 6 lines
Quoted 2 lines
Tested-by Sylvain Lemieux <[email protected]>Thomas, Marc, Jason, Russell,
in your opinion would it be still possible to accept this change v2 2/4 for v4.7?
I'll queue them.
Thanks,
M.
Signature · 1 line
Jazz is not dead. It just smells funny...
Vladimir Zapolskiy
maintainerPATCH v2 2/4 irqchip: add LPC32xx interrupt controller driver
Quoted 55 lines · Marc Zyngier
Quoted 54 lines · Vladimir Zapolskiy
Quoted 53 lines · Sylvain Lemieux
Hi Vladimir,
Quoted 38 lines · Vladimir Zapolskiy
The change adds improved support of NXP LPC32xx MIC, SIC1 and SIC2 interrupt controllers.
This is a list of new features in comparison to the legacy driver:
* irq types are taken from device tree settings, no more need to hardcode them,
* old driver is based onirq_domain_add_legacy, which causes problems with handling MIC hardware interrupt 0 produced by SIC1,
* there is one driver for MIC, SIC1 and SIC2, no more need to handle them separately, e.g. have two separate handlers for SIC1 and SIC2,
* the driver does not have any dependencies on hardcoded register offsets,
* the driver is much simpler for maintenance,
*SPARSE_IRQSoption is supported.Legacy LPC32xx interrupt controller driver was broken since commit
76ba59f8366f("genirq: Add irq_domain-aware core IRQ handler"), which requires a private interrupt handler, otherwise any SIC1 generated interrupt (mapped to MIC hwirq 0) breaks the kernel with the message "unexpected IRQ trap at vector 00".The change disables compilation of a legacy driver found at
arch/arm/mach-lpc32xx/irq.c, the file will be removed in a separate commit.Signed-off-by Vladimir Zapolskiy <[email protected]>---
Changes from v1 to v2:
* added chained_irq_{enter,exit} for SIC chained handler,
* use {writel,readl}_relaxed flavour of io access functions,
* changed anchor data type to access iomem from structirq_domainto private structlpc32xx_irq_chip,
* do not read irq status register twice on every irq event,
* resource deallocation fixes on error path of irqchip driver init,
* removed handling of "interrupt-controller-name" property, name is constructed from mic/sic type and controller's physical address,
* minor improvements (renames,__ffsinstead of ffs, etc.)Quoted 9 lines
Many kudos to Marc for review of v1.
arch/arm/Kconfig | 2 + arch/arm/mach-lpc32xx/phy3250.c | 1 - drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-lpc32xx.c | 238 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 241 insertions(+), 1 deletion(-) create mode 100644 drivers/irqchip/irq-lpc32xx.cI tested the driver on a custom LPC3250 board; I was having at least 1 interrupt generated from each source (MIC/SIC1/SIC2).
Quoted 9 lines
Quoted 6 lines
Quoted 2 lines
Tested-by Sylvain Lemieux <[email protected]>Thomas, Marc, Jason, Russell,
in your opinion would it be still possible to accept this change v2 2/4 for v4.7?
I'll queue them.
Marc, thank you in advance, please note that I ask to review/pick up only 2/4 for v4.7 ("irqchip: add LPC32xx interrupt controller driver"), DT changes are merged through arm-soc and the last 4/4 clean-up can be deferred till v4.8.
--
With best wishes,
Vladimir
PATCH v2 2/4 irqchip: add LPC32xx interrupt controller driver
Quoted 63 lines · Vladimir Zapolskiy
Quoted 62 lines · Marc Zyngier
Quoted 60 lines · Vladimir Zapolskiy
Quoted 50 lines · Sylvain Lemieux
Hi Vladimir,
Quoted 38 lines · Vladimir Zapolskiy
The change adds improved support of NXP LPC32xx MIC, SIC1 and SIC2 interrupt controllers.
This is a list of new features in comparison to the legacy driver:
* irq types are taken from device tree settings, no more need to hardcode them,
* old driver is based onirq_domain_add_legacy, which causes problems with handling MIC hardware interrupt 0 produced by SIC1,
* there is one driver for MIC, SIC1 and SIC2, no more need to handle them separately, e.g. have two separate handlers for SIC1 and SIC2,
* the driver does not have any dependencies on hardcoded register offsets,
* the driver is much simpler for maintenance,
*SPARSE_IRQSoption is supported.Legacy LPC32xx interrupt controller driver was broken since commit
76ba59f8366f("genirq: Add irq_domain-aware core IRQ handler"), which requires a private interrupt handler, otherwise any SIC1 generated interrupt (mapped to MIC hwirq 0) breaks the kernel with the message "unexpected IRQ trap at vector 00".The change disables compilation of a legacy driver found at
arch/arm/mach-lpc32xx/irq.c, the file will be removed in a separate commit.Signed-off-by Vladimir Zapolskiy <[email protected]>---
Changes from v1 to v2:
* added chained_irq_{enter,exit} for SIC chained handler,
* use {writel,readl}_relaxed flavour of io access functions,
* changed anchor data type to access iomem from structirq_domainto private structlpc32xx_irq_chip,
* do not read irq status register twice on every irq event,
* resource deallocation fixes on error path of irqchip driver init,
* removed handling of "interrupt-controller-name" property, name is constructed from mic/sic type and controller's physical address,
* minor improvements (renames,__ffsinstead of ffs, etc.)Quoted 9 lines
Many kudos to Marc for review of v1.
arch/arm/Kconfig | 2 + arch/arm/mach-lpc32xx/phy3250.c | 1 - drivers/irqchip/Makefile | 1 + drivers/irqchip/irq-lpc32xx.c | 238 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 241 insertions(+), 1 deletion(-) create mode 100644 drivers/irqchip/irq-lpc32xx.cQuoted 5 lines
I tested the driver on a custom LPC3250 board; I was having at least 1 interrupt generated from each source (MIC/SIC1/SIC2).
Tested-by Sylvain Lemieux <[email protected]>Thomas, Marc, Jason, Russell,
in your opinion would it be still possible to accept this change v2 2/4 for v4.7?
Quoted 7 lines
Quoted 2 lines
I'll queue them.
Marc, thank you in advance, please note that I ask to review/pick up only 2/4 for v4.7 ("irqchip: add LPC32xx interrupt controller driver"), DT changes are merged through arm-soc and the last 4/4 clean-up can be deferred till v4.8.
Right. I'll drop patch 1/4 then.
Thanks,
M.
Signature · 1 line
Jazz is not dead. It just smells funny...
Vladimir Zapolskiy
maintainerPATCH v2 3/4 arm: dts: lpc32xx: reparent SIC1 and SIC2 interrupts from MIC
In reply to Vladimir ZapolskiyThe change adds separate device nodes for SIC1 and SIC2 interrupt controllers and reparents all defined SIC1 and SIC2 interrupt producers to the correspondent interrupt controller, this is needed to perform switching to a new LPC32xx MIC/SIC interrupt controller driver.
---
Changes from v1 to v2:
* squashed two step change in lpc32xx.dtsi - new irqchip driver can be used (i.e. board boots with access to userspace) with old DTS file, so there is no need to fix DTS firstly and then switch to a new driver,
* removed "interrupt-controller-name" and "wakeup-sources" properties from all interrupt controllers,
* removed outdated comment.
arch/arm/boot/dts/lpc32xx.dtsi | 58 +++++++++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 17 deletions(-)
arch/arm/boot/dts/lpc32xx.dtsi +41 -17
@@ -92,7 +92,8 @@ ohci: ohci at 0 { compatible = "nxp,ohci-nxp", "usb-ohci"; reg = <0x0 0x300>; - interrupts = <59 IRQ_TYPE_LEVEL_HIGH>; + interrupt-parent = <&sic1>; + interrupts = <27 IRQ_TYPE_LEVEL_HIGH>; clocks = <&usbclk LPC32XX_USB_CLK_HOST>; status = "disabled"; };
@@ -100,10 +101,11 @@ usbd: usbd at 0 { compatible = "nxp,lpc3220-udc"; reg = <0x0 0x300>; - interrupts = <61 IRQ_TYPE_LEVEL_HIGH>, - <62 IRQ_TYPE_LEVEL_HIGH>, - <60 IRQ_TYPE_LEVEL_HIGH>, - <58 IRQ_TYPE_LEVEL_LOW>; + interrupt-parent = <&sic1>; + interrupts = <29 IRQ_TYPE_LEVEL_HIGH>, + <30 IRQ_TYPE_LEVEL_HIGH>, + <28 IRQ_TYPE_LEVEL_HIGH>, + <26 IRQ_TYPE_LEVEL_LOW>; clocks = <&usbclk LPC32XX_USB_CLK_DEVICE>; status = "disabled"; };
@@ -111,7 +113,8 @@ i2cusb: i2c at 300 { compatible = "nxp,pnx-i2c"; reg = <0x300 0x100>; - interrupts = <63 IRQ_TYPE_LEVEL_HIGH>; + interrupt-parent = <&sic1>; + interrupts = <31 IRQ_TYPE_LEVEL_HIGH>; clocks = <&usbclk LPC32XX_USB_CLK_I2C>; #address-cells = <1>; #size-cells = <0>;
@@ -263,7 +266,8 @@ i2c1: i2c at 400A0000 { compatible = "nxp,pnx-i2c"; reg = <0x400A0000 0x100>; - interrupts = <51 IRQ_TYPE_LEVEL_LOW>; + interrupt-parent = <&sic1>; + interrupts = <19 IRQ_TYPE_LEVEL_LOW>; #address-cells = <1>; #size-cells = <0>; pnx,timeout = <0x64>;
@@ -273,7 +277,8 @@ i2c2: i2c at 400A8000 { compatible = "nxp,pnx-i2c"; reg = <0x400A8000 0x100>; - interrupts = <50 IRQ_TYPE_LEVEL_LOW>; + interrupt-parent = <&sic1>; + interrupts = <18 IRQ_TYPE_LEVEL_LOW>; #address-cells = <1>; #size-cells = <0>; pnx,timeout = <0x64>;
@@ -314,12 +319,6 @@ }; }; - /* - * MIC Interrupt controller includes: - * MIC @40008000 - * SIC1 @4000C000 - * SIC2 @40010000 - */ mic: interrupt-controller at 40008000 { compatible = "nxp,lpc3220-mic"; interrupt-controller;
@@ -327,6 +326,28 @@ #interrupt-cells = <2>; }; + sic1: interrupt-controller at 4000c000 { + compatible = "nxp,lpc3220-sic"; + reg = <0x4000c000 0x4000>; + interrupt-controller; + #interrupt-cells = <2>; + + interrupt-parent = <&mic>; + interrupts = <0 IRQ_TYPE_LEVEL_LOW>, + <30 IRQ_TYPE_LEVEL_LOW>; + }; + + sic2: interrupt-controller at 40010000 { + compatible = "nxp,lpc3220-sic"; + reg = <0x40010000 0x4000>; + interrupt-controller; + #interrupt-cells = <2>; + + interrupt-parent = <&mic>; + interrupts = <1 IRQ_TYPE_LEVEL_LOW>, + <31 IRQ_TYPE_LEVEL_LOW>; + }; + uart1: serial at 40014000 { compatible = "nxp,lpc3220-hsuart"; reg = <0x40014000 0x1000>;
@@ -351,7 +372,8 @@ rtc: rtc at 40024000 { compatible = "nxp,lpc3220-rtc"; reg = <0x40024000 0x1000>; - interrupts = <52 IRQ_TYPE_LEVEL_HIGH>; + interrupt-parent = <&sic1>; + interrupts = <20 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clk LPC32XX_CLK_RTC>; };
@@ -404,7 +426,8 @@ adc: adc at 40048000 { compatible = "nxp,lpc3220-adc"; reg = <0x40048000 0x1000>; - interrupts = <39 IRQ_TYPE_LEVEL_HIGH>; + interrupt-parent = <&sic1>; + interrupts = <7 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clk LPC32XX_CLK_ADC>; status = "disabled"; };
@@ -412,7 +435,8 @@ tsc: tsc at 40048000 { compatible = "nxp,lpc3220-tsc"; reg = <0x40048000 0x1000>; - interrupts = <39 IRQ_TYPE_LEVEL_HIGH>; + interrupt-parent = <&sic1>; + interrupts = <7 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clk LPC32XX_CLK_ADC>; status = "disabled"; };
Signature · 1 line
2.1.4
PATCH v2 3/4 arm: dts: lpc32xx: reparent SIC1 and SIC2 interrupts from MIC
Hi Vladimir,
Quoted 23 lines · Vladimir Zapolskiy
The change adds separate device nodes for SIC1 and SIC2 interrupt controllers and reparents all defined SIC1 and SIC2 interrupt producers to the correspondent interrupt controller, this is needed to perform switching to a new LPC32xx MIC/SIC interrupt controller driver.
Signed-off-by Vladimir Zapolskiy <[email protected]>---
Changes from v1 to v2:
* squashed two step change inlpc32xx.dtsi- new irqchip driver can be used (i.e. board boots with access to userspace) with old DTS file, so there is no need to fix DTS firstly and then switch to a new driver,
* removed "interrupt-controller-name" and "wakeup-sources" properties from all interrupt controllers,
* removed outdated comment.arch/arm/boot/dts/lpc32xx.dtsi | 58 +++++++++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 17 deletions(-)arch/arm/boot/dts/lpc32xx.dtsi +0
-0@@ -92,7 +92,8 @@
...
arch/arm/boot/dts/lpc32xx.dtsi
Quoted 11 lines
arch/arm/boot/dts/lpc32xx.dtsi +0
-6- /* - * MIC Interrupt controller includes: - * MIC @40008000 - * SIC1 @4000C000 - * SIC2 @40010000 - */ mic: interrupt-controller at 40008000 { compatible = "nxp,lpc3220-mic"; interrupt-controller;@@ -327,6 +326,28 @@
I think your are missing one change in your patch, the mic register range should be 0x4000, not 0xC000.
Everything else is OK.
Quoted 15 lines
arch/arm/boot/dts/lpc32xx.dtsi +12
-0#interrupt-cells = <2>; }; + sic1: interrupt-controller at 4000c000 { + compatible = "nxp,lpc3220-sic"; + reg = <0x4000c000 0x4000>; + interrupt-controller; + #interrupt-cells = <2>; + + interrupt-parent = <&mic>; + interrupts = <0 IRQ_TYPE_LEVEL_LOW>, + <30 IRQ_TYPE_LEVEL_LOW>; + }; + + sic2: interrupt-controller at 40010000 {
arch/arm/boot/dts/lpc32xx.dtsi line 350
Quoted 10 lines
arch/arm/boot/dts/lpc32xx.dtsi +10
-0+ compatible = "nxp,lpc3220-sic"; + reg = <0x40010000 0x4000>; + interrupt-controller; + #interrupt-cells = <2>; + + interrupt-parent = <&mic>; + interrupts = <1 IRQ_TYPE_LEVEL_LOW>, + <31 IRQ_TYPE_LEVEL_LOW>; + }; +
...
Sylvain
Vladimir Zapolskiy
maintainerPATCH v2 3/4 arm: dts: lpc32xx: reparent SIC1 and SIC2 interrupts from MIC
Hi Sylvain,
Quoted 43 lines · Sylvain Lemieux
Hi Vladimir,
Quoted 23 lines · Vladimir Zapolskiy
The change adds separate device nodes for SIC1 and SIC2 interrupt controllers and reparents all defined SIC1 and SIC2 interrupt producers to the correspondent interrupt controller, this is needed to perform switching to a new LPC32xx MIC/SIC interrupt controller driver.
Signed-off-by Vladimir Zapolskiy <[email protected]>---
Changes from v1 to v2:
* squashed two step change inlpc32xx.dtsi- new irqchip driver can be used (i.e. board boots with access to userspace) with old DTS file, so there is no need to fix DTS firstly and then switch to a new driver,
* removed "interrupt-controller-name" and "wakeup-sources" properties from all interrupt controllers,
* removed outdated comment.arch/arm/boot/dts/lpc32xx.dtsi | 58 +++++++++++++++++++++++++++++------------- 1 file changed, 41 insertions(+), 17 deletions(-)arch/arm/boot/dts/lpc32xx.dtsi +0
-0@@ -92,7 +92,8 @@...
arch/arm/boot/dts/lpc32xx.dtsi
Quoted 11 lines
arch/arm/boot/dts/lpc32xx.dtsi +0
-6- /* - * MIC Interrupt controller includes: - * MIC @40008000 - * SIC1 @4000C000 - * SIC2 @40010000 - */ mic: interrupt-controller at 40008000 { compatible = "nxp,lpc3220-mic"; interrupt-controller;@@ -327,6 +326,28 @@I think your are missing one change in your patch, the mic register range should be
0x4000, not0xC000.
Quoted 1 line
Everything else is OK.
Good catch, thank you for pointing it out, and let me fix it immediately. Fortunately it is corrected in an example from v2 1/4.
Quoted 18 lines
Quoted 18 lines
arch/arm/boot/dts/lpc32xx.dtsi +15
-0#interrupt-cells = <2>; }; + sic1: interrupt-controller at 4000c000 { + compatible = "nxp,lpc3220-sic"; + reg = <0x4000c000 0x4000>; + interrupt-controller; + #interrupt-cells = <2>; + + interrupt-parent = <&mic>; + interrupts = <0 IRQ_TYPE_LEVEL_LOW>, + <30 IRQ_TYPE_LEVEL_LOW>; + }; + + sic2: interrupt-controller at 40010000 { + compatible = "nxp,lpc3220-sic"; + reg = <0x40010000 0x4000>; + interrupt-controller;
Quoted 9 lines
Quoted 7 lines
arch/arm/boot/dts/lpc32xx.dtsi +7
-0+ #interrupt-cells = <2>; + + interrupt-parent = <&mic>; + interrupts = <1 IRQ_TYPE_LEVEL_LOW>, + <31 IRQ_TYPE_LEVEL_LOW>; + }; +...
--
With best wishes,
Vladimir
Vladimir Zapolskiy
maintainerPATCH v3 3/4 arm: dts: lpc32xx: reparent SIC1 and SIC2 interrupts from MIC
In reply to Vladimir ZapolskiyThe change adds separate device nodes for SIC1 and SIC2 interrupt controllers and reparents all defined SIC1 and SIC2 interrupt producers to the correspondent interrupt controller, this is needed to perform switching to a new LPC32xx MIC/SIC interrupt controller driver.
---
Changes from v2 to v3:
* fix io region size for MIC controller after moving SIC1/SIC2 controllers out,
* move MIC 'reg' property up to follow 'compatible' property.
Changes from v1 to v2:
* squashed two step change in lpc32xx.dtsi - new irqchip driver can be used (i.e. board boots with access to userspace) with old DTS file, so there is no need to fix DTS firstly and then switch to a new driver,
* removed "interrupt-controller-name" and "wakeup-sources" properties from all interrupt controllers,
* removed outdated comment.
arch/arm/boot/dts/lpc32xx.dtsi | 60 +++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 18 deletions(-)
arch/arm/boot/dts/lpc32xx.dtsi +42 -18
@@ -92,7 +92,8 @@ ohci: ohci at 0 { compatible = "nxp,ohci-nxp", "usb-ohci"; reg = <0x0 0x300>; - interrupts = <59 IRQ_TYPE_LEVEL_HIGH>; + interrupt-parent = <&sic1>; + interrupts = <27 IRQ_TYPE_LEVEL_HIGH>; clocks = <&usbclk LPC32XX_USB_CLK_HOST>; status = "disabled"; };
@@ -100,10 +101,11 @@ usbd: usbd at 0 { compatible = "nxp,lpc3220-udc"; reg = <0x0 0x300>; - interrupts = <61 IRQ_TYPE_LEVEL_HIGH>, - <62 IRQ_TYPE_LEVEL_HIGH>, - <60 IRQ_TYPE_LEVEL_HIGH>, - <58 IRQ_TYPE_LEVEL_LOW>; + interrupt-parent = <&sic1>; + interrupts = <29 IRQ_TYPE_LEVEL_HIGH>, + <30 IRQ_TYPE_LEVEL_HIGH>, + <28 IRQ_TYPE_LEVEL_HIGH>, + <26 IRQ_TYPE_LEVEL_LOW>; clocks = <&usbclk LPC32XX_USB_CLK_DEVICE>; status = "disabled"; };
@@ -111,7 +113,8 @@ i2cusb: i2c at 300 { compatible = "nxp,pnx-i2c"; reg = <0x300 0x100>; - interrupts = <63 IRQ_TYPE_LEVEL_HIGH>; + interrupt-parent = <&sic1>; + interrupts = <31 IRQ_TYPE_LEVEL_HIGH>; clocks = <&usbclk LPC32XX_USB_CLK_I2C>; #address-cells = <1>; #size-cells = <0>;
@@ -263,7 +266,8 @@ i2c1: i2c at 400A0000 { compatible = "nxp,pnx-i2c"; reg = <0x400A0000 0x100>; - interrupts = <51 IRQ_TYPE_LEVEL_LOW>; + interrupt-parent = <&sic1>; + interrupts = <19 IRQ_TYPE_LEVEL_LOW>; #address-cells = <1>; #size-cells = <0>; pnx,timeout = <0x64>;
@@ -273,7 +277,8 @@ i2c2: i2c at 400A8000 { compatible = "nxp,pnx-i2c"; reg = <0x400A8000 0x100>; - interrupts = <50 IRQ_TYPE_LEVEL_LOW>; + interrupt-parent = <&sic1>; + interrupts = <18 IRQ_TYPE_LEVEL_LOW>; #address-cells = <1>; #size-cells = <0>; pnx,timeout = <0x64>;
@@ -314,19 +319,35 @@ }; }; - /* - * MIC Interrupt controller includes: - * MIC @40008000 - * SIC1 @4000C000 - * SIC2 @40010000 - */ mic: interrupt-controller at 40008000 { compatible = "nxp,lpc3220-mic"; + reg = <0x40008000 0x4000>; interrupt-controller; - reg = <0x40008000 0xC000>; #interrupt-cells = <2>; }; + sic1: interrupt-controller at 4000c000 { + compatible = "nxp,lpc3220-sic"; + reg = <0x4000c000 0x4000>; + interrupt-controller; + #interrupt-cells = <2>; + + interrupt-parent = <&mic>; + interrupts = <0 IRQ_TYPE_LEVEL_LOW>, + <30 IRQ_TYPE_LEVEL_LOW>; + }; + + sic2: interrupt-controller at 40010000 { + compatible = "nxp,lpc3220-sic"; + reg = <0x40010000 0x4000>; + interrupt-controller; + #interrupt-cells = <2>; + + interrupt-parent = <&mic>; + interrupts = <1 IRQ_TYPE_LEVEL_LOW>, + <31 IRQ_TYPE_LEVEL_LOW>; + }; + uart1: serial at 40014000 { compatible = "nxp,lpc3220-hsuart"; reg = <0x40014000 0x1000>;
@@ -351,7 +372,8 @@ rtc: rtc at 40024000 { compatible = "nxp,lpc3220-rtc"; reg = <0x40024000 0x1000>; - interrupts = <52 IRQ_TYPE_LEVEL_HIGH>; + interrupt-parent = <&sic1>; + interrupts = <20 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clk LPC32XX_CLK_RTC>; };
@@ -404,7 +426,8 @@ adc: adc at 40048000 { compatible = "nxp,lpc3220-adc"; reg = <0x40048000 0x1000>; - interrupts = <39 IRQ_TYPE_LEVEL_HIGH>; + interrupt-parent = <&sic1>; + interrupts = <7 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clk LPC32XX_CLK_ADC>; status = "disabled"; };
@@ -412,7 +435,8 @@ tsc: tsc at 40048000 { compatible = "nxp,lpc3220-tsc"; reg = <0x40048000 0x1000>; - interrupts = <39 IRQ_TYPE_LEVEL_HIGH>; + interrupt-parent = <&sic1>; + interrupts = <7 IRQ_TYPE_LEVEL_HIGH>; clocks = <&clk LPC32XX_CLK_ADC>; status = "disabled"; };
Signature · 1 line
2.1.4
PATCH v3 3/4 arm: dts: lpc32xx: reparent SIC1 and SIC2 interrupts from MIC
Hi Vladimir,
Quoted 20 lines · Vladimir Zapolskiy
The change adds separate device nodes for SIC1 and SIC2 interrupt controllers and reparents all defined SIC1 and SIC2 interrupt producers to the correspondent interrupt controller, this is needed to perform switching to a new LPC32xx MIC/SIC interrupt controller driver.
Signed-off-by Vladimir Zapolskiy <[email protected]>---
Changes from v2 to v3:
* fix io region size for MIC controller after moving SIC1/SIC2 controllers out,
* move MIC 'reg' property up to follow 'compatible' property.Changes from v1 to v2:
* squashed two step change inlpc32xx.dtsi- new irqchip driver can be used (i.e. board boots with access to userspace) with old DTS file, so there is no need to fix DTS firstly and then switch to a new driver,
* removed "interrupt-controller-name" and "wakeup-sources" properties from all interrupt controllers,
* removed outdated comment.
Quoted 3 lines
arch/arm/boot/dts/lpc32xx.dtsi | 60 +++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 18 deletions(-)
Please use capital letter for the word ARM in the patch title.
Vladimir Zapolskiy
maintainerPATCH v3 3/4 arm: dts: lpc32xx: reparent SIC1 and SIC2 interrupts from MIC
Hi Sylvain,
Quoted 23 lines · Sylvain Lemieux
Hi Vladimir,
Quoted 20 lines · Vladimir Zapolskiy
The change adds separate device nodes for SIC1 and SIC2 interrupt controllers and reparents all defined SIC1 and SIC2 interrupt producers to the correspondent interrupt controller, this is needed to perform switching to a new LPC32xx MIC/SIC interrupt controller driver.
Signed-off-by Vladimir Zapolskiy <[email protected]>---
Changes from v2 to v3:
* fix io region size for MIC controller after moving SIC1/SIC2 controllers out,
* move MIC 'reg' property up to follow 'compatible' property.Changes from v1 to v2:
* squashed two step change inlpc32xx.dtsi- new irqchip driver can be used (i.e. board boots with access to userspace) with old DTS file, so there is no need to fix DTS firstly and then switch to a new driver,
* removed "interrupt-controller-name" and "wakeup-sources" properties from all interrupt controllers,
* removed outdated comment.
Quoted 4 lines
Quoted 3 lines
arch/arm/boot/dts/lpc32xx.dtsi | 60 +++++++++++++++++++++++++++++------------- 1 file changed, 42 insertions(+), 18 deletions(-)Please use capital letter for the word ARM in the patch title.
right, I'll change it on application, thank you for review.
Quoted 2 lines
Acked-by Sylvain Lemieux <[email protected]>
--
With best wishes,
Vladimir
Vladimir Zapolskiy
maintainerPATCH v2 4/4 ARM: lpc32xx: remove legacy irq controller driver
In reply to Vladimir ZapolskiyNew NXP LPC32xx irq chip driver is used instead of a legacy one.
---
Changes from v1 to v2:
* none, this is a new change
arch/arm/mach-lpc32xx/Makefile | 2 +- arch/arm/mach-lpc32xx/irq.c | 477 ----------------------------------------- 2 files changed, 1 insertion(+), 478 deletions(-) delete mode 100644 arch/arm/mach-lpc32xx/irq.c
arch/arm/mach-lpc32xx/Makefile +1 -1
@@ -2,6 +2,6 @@ # Makefile for the linux kernel. # -obj-y := irq.o common.o serial.o +obj-y := common.o serial.o obj-y += pm.o suspend.o obj-y += phy3250.o
arch/arm/mach-lpc32xx/irq.c deleted +0 -477
477 lines not on this page · raw message
Signature · 1 line
2.1.4
PATCH v2 4/4 ARM: lpc32xx: remove legacy irq controller driver
Quoted 12 lines · Vladimir Zapolskiy
New NXP LPC32xx irq chip driver is used instead of a legacy one.
Signed-off-by Vladimir Zapolskiy <[email protected]>---
Changes from v1 to v2:
* none, this is a new changearch/arm/mach-lpc32xx/Makefile | 2 +- arch/arm/mach-lpc32xx/irq.c | 477 ----------------------------------------- 2 files changed, 1 insertion(+), 478 deletions(-) delete mode 100644 arch/arm/mach-lpc32xx/irq.c