* Re: [PATCH 1/9] ARM: Kirkwood: Add interrupt controller support for DT boards
[not found] ` <1339324322-29388-2-git-send-email-andrew-g2DYL2Zd6BY@public.gmane.org>
@ 2012-06-10 16:48 ` Jason Cooper
2012-06-10 21:21 ` Michael Walle
` (2 subsequent siblings)
3 siblings, 0 replies; 7+ messages in thread
From: Jason Cooper @ 2012-06-10 16:48 UTC (permalink / raw)
To: Andrew Lunn
Cc: grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
rob.herring-bsGFqQB8/DxBDgjK7y7TUQ,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r,
machael-QKn5cuLxLXY
On Sun, Jun 10, 2012 at 12:31:53PM +0200, Andrew Lunn wrote:
> Signed-off-by: Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>
> ---
> .../devicetree/bindings/arm/mrvl/intc.txt | 20 ++++++++++++++++++
> arch/arm/boot/dts/kirkwood.dtsi | 9 ++++++++
> arch/arm/mach-kirkwood/board-dt.c | 22 +++++++++++++++++++-
> 3 files changed, 50 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/arm/mrvl/intc.txt b/Documentation/devicetree/bindings/arm/mrvl/intc.txt
> index 80b9a94..612536e 100644
> --- a/Documentation/devicetree/bindings/arm/mrvl/intc.txt
> +++ b/Documentation/devicetree/bindings/arm/mrvl/intc.txt
> @@ -38,3 +38,23 @@ Example:
> reg-names = "mux status", "mux mask";
> mrvl,intc-nr-irqs = <2>;
> };
> +
> +* Marvell Orion Interrupt controller
> +
> +Required properties
> +- compatible : Should be "marvell,orion-intc"
> +- #interrupt-cells: Specifies the number of cells needed to encode an
> + interrupt source. Supported value is <1>
> +- interrupt-controller : So that its clear its an interrupt controller.
nit. "Declare this node to be an interrupt controller." If you end up
doing a v2 for other reasons, go ahead and add this. Otherwise, don't
worry about it.
> +Optional properties
> +- reg : Not used yet, but will contain the interrupt mask address
> +
> +Example:
> +
> + intc: interrupt-controller {
> + compatible = "marvell,orion-intc", "marvell,intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + reg = <0xfed20204 0x04>,
> + <0xfed20214 0x04>;
> + };
> diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi
> index 926528b..8eab7c4 100644
> --- a/arch/arm/boot/dts/kirkwood.dtsi
> +++ b/arch/arm/boot/dts/kirkwood.dtsi
> @@ -2,6 +2,15 @@
>
> / {
> compatible = "mrvl,kirkwood";
> + interrupt-parent = <&intc>;
> +
> + intc: interrupt-controller {
> + compatible = "marvell,orion-intc", "marvell,intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + reg = <0xfed20204 0x04>,
> + <0xfed20214 0x04>;
> + };
>
> ocp@f1000000 {
> compatible = "simple-bus";
> diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
> index edc3f8a..fa51586 100644
> --- a/arch/arm/mach-kirkwood/board-dt.c
> +++ b/arch/arm/mach-kirkwood/board-dt.c
> @@ -14,6 +14,7 @@
> #include <linux/init.h>
> #include <linux/of.h>
> #include <linux/of_platform.h>
> +#include <linux/of_irq.h>
> #include <linux/kexec.h>
> #include <asm/mach/arch.h>
> #include <asm/mach/map.h>
> @@ -80,11 +81,30 @@ static const char *kirkwood_dt_board_compat[] = {
> NULL
> };
>
> +static int __init kirkwood_add_irq_domain(struct device_node *np,
> + struct device_node *interrupt_parent)
> +{
> + kirkwood_init_irq();
> + irq_domain_add_legacy(np, 64, 0, 0, &irq_domain_simple_ops, NULL);
> + return 0;
> +}
> +
> +static const struct of_device_id kirkwood_irq_match[] = {
> + { .compatible = "marvell,orion-intc",
> + .data = kirkwood_add_irq_domain, },
> + {},
> +};
> +
> +static void __init kirkwood_dt_init_irq(void)
> +{
> + of_irq_init(kirkwood_irq_match);
> +}
> +
> DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)")
> /* Maintainer: Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org> */
> .map_io = kirkwood_map_io,
> .init_early = kirkwood_init_early,
> - .init_irq = kirkwood_init_irq,
> + .init_irq = kirkwood_dt_init_irq,
> .timer = &kirkwood_timer,
> .init_machine = kirkwood_dt_init,
> .restart = kirkwood_restart,
> --
> 1.7.10
>
Looks good.
Acked-by: Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>
I'll add Tested-by: once I get a chance.
thx,
Jason.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/9] ARM: Kirkwood: Add interrupt controller support for DT boards
[not found] ` <1339324322-29388-2-git-send-email-andrew-g2DYL2Zd6BY@public.gmane.org>
2012-06-10 16:48 ` Jason Cooper
@ 2012-06-10 21:21 ` Michael Walle
2012-06-11 12:49 ` Rob Herring
2012-06-14 8:12 ` Arnd Bergmann
3 siblings, 0 replies; 7+ messages in thread
From: Michael Walle @ 2012-06-10 21:21 UTC (permalink / raw)
To: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ
Cc: Andrew Lunn, jason-NLaQJdtUoK4Be96aLqz0jA,
rob.herring-bsGFqQB8/DxBDgjK7y7TUQ,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Am Sonntag 10 Juni 2012, 12:31:53 schrieb Andrew Lunn:
> Signed-off-by: Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>
> ---
> .../devicetree/bindings/arm/mrvl/intc.txt | 20
> ++++++++++++++++++ arch/arm/boot/dts/kirkwood.dtsi |
> 9 ++++++++ arch/arm/mach-kirkwood/board-dt.c | 22
> +++++++++++++++++++- 3 files changed, 50 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/arm/mrvl/intc.txt
> b/Documentation/devicetree/bindings/arm/mrvl/intc.txt index
> 80b9a94..612536e 100644
> --- a/Documentation/devicetree/bindings/arm/mrvl/intc.txt
> +++ b/Documentation/devicetree/bindings/arm/mrvl/intc.txt
> @@ -38,3 +38,23 @@ Example:
> reg-names = "mux status", "mux mask";
> mrvl,intc-nr-irqs = <2>;
> };
> +
> +* Marvell Orion Interrupt controller
> +
> +Required properties
> +- compatible : Should be "marvell,orion-intc"
> +- #interrupt-cells: Specifies the number of cells needed to encode an
> + interrupt source. Supported value is <1>
> +- interrupt-controller : So that its clear its an interrupt controller.
> +Optional properties
> +- reg : Not used yet, but will contain the interrupt mask address
> +
> +Example:
> +
> + intc: interrupt-controller {
> + compatible = "marvell,orion-intc", "marvell,intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + reg = <0xfed20204 0x04>,
> + <0xfed20214 0x04>;
> + };
please fix whitespaces/tabs
> diff --git a/arch/arm/boot/dts/kirkwood.dtsi
> b/arch/arm/boot/dts/kirkwood.dtsi index 926528b..8eab7c4 100644
> --- a/arch/arm/boot/dts/kirkwood.dtsi
> +++ b/arch/arm/boot/dts/kirkwood.dtsi
> @@ -2,6 +2,15 @@
>
> / {
> compatible = "mrvl,kirkwood";
> + interrupt-parent = <&intc>;
> +
> + intc: interrupt-controller {
> + compatible = "marvell,orion-intc", "marvell,intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + reg = <0xfed20204 0x04>,
> + <0xfed20214 0x04>;
> + };
ditto
--
Michael
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/9] ARM: Kirkwood: Add interrupt controller support for DT boards
[not found] ` <1339324322-29388-2-git-send-email-andrew-g2DYL2Zd6BY@public.gmane.org>
2012-06-10 16:48 ` Jason Cooper
2012-06-10 21:21 ` Michael Walle
@ 2012-06-11 12:49 ` Rob Herring
2012-06-14 8:12 ` Arnd Bergmann
3 siblings, 0 replies; 7+ messages in thread
From: Rob Herring @ 2012-06-11 12:49 UTC (permalink / raw)
To: Andrew Lunn
Cc: jason-NLaQJdtUoK4Be96aLqz0jA,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
machael-QKn5cuLxLXY,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
On 06/10/2012 05:31 AM, Andrew Lunn wrote:
> Signed-off-by: Andrew Lunn <andrew-g2DYL2Zd6BY@public.gmane.org>
> ---
> .../devicetree/bindings/arm/mrvl/intc.txt | 20 ++++++++++++++++++
> arch/arm/boot/dts/kirkwood.dtsi | 9 ++++++++
> arch/arm/mach-kirkwood/board-dt.c | 22 +++++++++++++++++++-
> 3 files changed, 50 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/arm/mrvl/intc.txt b/Documentation/devicetree/bindings/arm/mrvl/intc.txt
> index 80b9a94..612536e 100644
> --- a/Documentation/devicetree/bindings/arm/mrvl/intc.txt
> +++ b/Documentation/devicetree/bindings/arm/mrvl/intc.txt
> @@ -38,3 +38,23 @@ Example:
> reg-names = "mux status", "mux mask";
> mrvl,intc-nr-irqs = <2>;
> };
> +
> +* Marvell Orion Interrupt controller
> +
> +Required properties
> +- compatible : Should be "marvell,orion-intc"
> +- #interrupt-cells: Specifies the number of cells needed to encode an
> + interrupt source. Supported value is <1>
> +- interrupt-controller : So that its clear its an interrupt controller.
> +Optional properties
> +- reg : Not used yet, but will contain the interrupt mask address
> +
> +Example:
> +
> + intc: interrupt-controller {
> + compatible = "marvell,orion-intc", "marvell,intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + reg = <0xfed20204 0x04>,
> + <0xfed20214 0x04>;
> + };
> diff --git a/arch/arm/boot/dts/kirkwood.dtsi b/arch/arm/boot/dts/kirkwood.dtsi
> index 926528b..8eab7c4 100644
> --- a/arch/arm/boot/dts/kirkwood.dtsi
> +++ b/arch/arm/boot/dts/kirkwood.dtsi
> @@ -2,6 +2,15 @@
>
> / {
> compatible = "mrvl,kirkwood";
> + interrupt-parent = <&intc>;
> +
> + intc: interrupt-controller {
> + compatible = "marvell,orion-intc", "marvell,intc";
> + interrupt-controller;
> + #interrupt-cells = <1>;
> + reg = <0xfed20204 0x04>,
> + <0xfed20214 0x04>;
> + };
>
> ocp@f1000000 {
> compatible = "simple-bus";
> diff --git a/arch/arm/mach-kirkwood/board-dt.c b/arch/arm/mach-kirkwood/board-dt.c
> index edc3f8a..fa51586 100644
> --- a/arch/arm/mach-kirkwood/board-dt.c
> +++ b/arch/arm/mach-kirkwood/board-dt.c
> @@ -14,6 +14,7 @@
> #include <linux/init.h>
> #include <linux/of.h>
> #include <linux/of_platform.h>
> +#include <linux/of_irq.h>
> #include <linux/kexec.h>
> #include <asm/mach/arch.h>
> #include <asm/mach/map.h>
> @@ -80,11 +81,30 @@ static const char *kirkwood_dt_board_compat[] = {
> NULL
> };
>
> +static int __init kirkwood_add_irq_domain(struct device_node *np,
> + struct device_node *interrupt_parent)
> +{
> + kirkwood_init_irq();
> + irq_domain_add_legacy(np, 64, 0, 0, &irq_domain_simple_ops, NULL);
The irqdomain should really be integrated into the interrupt controller
itself rather than bolted on top and doesn't need to be DT only. In the
process, use irq_data.hwirq rather than fixed Linux virq to hwirq
conversion.
Once all interrupts are bound using DT, a linear domain should be used.
But that may take some time.
Rob
> + return 0;
> +}rob.herring-bsGFqQB8/DxBDgjK7y7TUQ@public.gmane.org
> +
> +static const struct of_device_id kirkwood_irq_match[] = {
> + { .compatible = "marvell,orion-intc",
> + .data = kirkwood_add_irq_domain, },
> + {},
> +};
> +
> +static void __init kirkwood_dt_init_irq(void)
> +{
> + of_irq_init(kirkwood_irq_match);
> +}
> +
> DT_MACHINE_START(KIRKWOOD_DT, "Marvell Kirkwood (Flattened Device Tree)")
> /* Maintainer: Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org> */
> .map_io = kirkwood_map_io,
> .init_early = kirkwood_init_early,
> - .init_irq = kirkwood_init_irq,
> + .init_irq = kirkwood_dt_init_irq,
> .timer = &kirkwood_timer,
> .init_machine = kirkwood_dt_init,
> .restart = kirkwood_restart,
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH 1/9] ARM: Kirkwood: Add interrupt controller support for DT boards
[not found] ` <1339324322-29388-2-git-send-email-andrew-g2DYL2Zd6BY@public.gmane.org>
` (2 preceding siblings ...)
2012-06-11 12:49 ` Rob Herring
@ 2012-06-14 8:12 ` Arnd Bergmann
[not found] ` <201206140812.34399.arnd-r2nGTMty4D4@public.gmane.org>
3 siblings, 1 reply; 7+ messages in thread
From: Arnd Bergmann @ 2012-06-14 8:12 UTC (permalink / raw)
To: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r
Cc: Andrew Lunn, jason-NLaQJdtUoK4Be96aLqz0jA,
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
rob.herring-bsGFqQB8/DxBDgjK7y7TUQ,
grant.likely-s3s/WqlpOiPyB63q8FvJNQ,
linux-i2c-u79uwXL29TY76Z2rM5mHXA,
spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f,
machael-QKn5cuLxLXY
On Sunday 10 June 2012, Andrew Lunn wrote:
> +static int __init kirkwood_add_irq_domain(struct device_node *np,
> + struct device_node *interrupt_parent)
> +{
> + kirkwood_init_irq();
> + irq_domain_add_legacy(np, 64, 0, 0, &irq_domain_simple_ops, NULL);
> + return 0;
> +}
> +
> +static const struct of_device_id kirkwood_irq_match[] = {
> + { .compatible = "marvell,orion-intc",
> + .data = kirkwood_add_irq_domain, },
> + {},
> +};
> +
> +static void __init kirkwood_dt_init_irq(void)
> +{
> + of_irq_init(kirkwood_irq_match);
> +}
> +
I think if you compute the number of interrupts in the domain from the number of
registers that are described in the device tree, call orion_irq_init()
based on those registers, and use irq domains for the gpio stuff as Rob suggested,
this init_irq function can become completely generic to all orion platforms.
That is what I tried to do with an earlier patch, which was flawed for other reasons.
Arnd
^ permalink raw reply [flat|nested] 7+ messages in thread