* [PATCH 1/6] gpio/mxs: adopt irq_domain support for mxs gpio driver
2012-08-20 14:19 [PATCH 0/6] Enable SPARSE_IRQ for mach-mxs Shawn Guo
@ 2012-08-20 14:19 ` Shawn Guo
2012-08-21 13:01 ` Linus Walleij
2012-08-23 21:49 ` Linus Walleij
2012-08-20 14:19 ` [PATCH 2/6] ARM: mxs: retrieve timer irq from device tree Shawn Guo
` (4 subsequent siblings)
5 siblings, 2 replies; 15+ messages in thread
From: Shawn Guo @ 2012-08-20 14:19 UTC (permalink / raw)
To: linux-arm-kernel
Remove irq_domain_add_legacy call from mach-mxs.c and have the gpio
driver adopt irqdomain support, so that we can have the mapping
between gpio and irq number available without using virtual_irq_start
and MXS_GPIO_IRQ_START.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
Cc: Linus Walleij <linus.walleij@linaro.org>
---
arch/arm/mach-mxs/mach-mxs.c | 12 ----------
drivers/gpio/gpio-mxs.c | 48 ++++++++++++++++++++++++++---------------
2 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c
index 3b0d9c6..9f8406e 100644
--- a/arch/arm/mach-mxs/mach-mxs.c
+++ b/arch/arm/mach-mxs/mach-mxs.c
@@ -149,20 +149,8 @@ static int __init mxs_icoll_add_irq_domain(struct device_node *np,
return 0;
}
-static int __init mxs_gpio_add_irq_domain(struct device_node *np,
- struct device_node *interrupt_parent)
-{
- static int gpio_irq_base = MXS_GPIO_IRQ_START;
-
- irq_domain_add_legacy(np, 32, gpio_irq_base, 0, &irq_domain_simple_ops, NULL);
- gpio_irq_base += 32;
-
- return 0;
-}
-
static const struct of_device_id mxs_irq_match[] __initconst = {
{ .compatible = "fsl,mxs-icoll", .data = mxs_icoll_add_irq_domain, },
- { .compatible = "fsl,mxs-gpio", .data = mxs_gpio_add_irq_domain, },
{ /* sentinel */ }
};
diff --git a/drivers/gpio/gpio-mxs.c b/drivers/gpio/gpio-mxs.c
index 39e4956..796fb13 100644
--- a/drivers/gpio/gpio-mxs.c
+++ b/drivers/gpio/gpio-mxs.c
@@ -24,6 +24,7 @@
#include <linux/interrupt.h>
#include <linux/io.h>
#include <linux/irq.h>
+#include <linux/irqdomain.h>
#include <linux/gpio.h>
#include <linux/of.h>
#include <linux/of_address.h>
@@ -52,8 +53,6 @@
#define GPIO_INT_LEV_MASK (1 << 0)
#define GPIO_INT_POL_MASK (1 << 1)
-#define irq_to_gpio(irq) ((irq) - MXS_GPIO_IRQ_START)
-
enum mxs_gpio_id {
IMX23_GPIO,
IMX28_GPIO,
@@ -63,7 +62,7 @@ struct mxs_gpio_port {
void __iomem *base;
int id;
int irq;
- int virtual_irq_start;
+ struct irq_domain *domain;
struct bgpio_chip bgc;
enum mxs_gpio_id devid;
};
@@ -82,8 +81,7 @@ static inline int is_imx28_gpio(struct mxs_gpio_port *port)
static int mxs_gpio_set_irq_type(struct irq_data *d, unsigned int type)
{
- u32 gpio = irq_to_gpio(d->irq);
- u32 pin_mask = 1 << (gpio & 31);
+ u32 pin_mask = 1 << d->hwirq;
struct irq_chip_generic *gc = irq_data_get_irq_chip_data(d);
struct mxs_gpio_port *port = gc->private;
void __iomem *pin_addr;
@@ -120,7 +118,7 @@ static int mxs_gpio_set_irq_type(struct irq_data *d, unsigned int type)
else
writel(pin_mask, pin_addr + MXS_CLR);
- writel(1 << (gpio & 0x1f),
+ writel(pin_mask,
port->base + PINCTRL_IRQSTAT(port) + MXS_CLR);
return 0;
@@ -131,7 +129,6 @@ static void mxs_gpio_irq_handler(u32 irq, struct irq_desc *desc)
{
u32 irq_stat;
struct mxs_gpio_port *port = irq_get_handler_data(irq);
- u32 gpio_irq_no_base = port->virtual_irq_start;
desc->irq_data.chip->irq_ack(&desc->irq_data);
@@ -140,7 +137,7 @@ static void mxs_gpio_irq_handler(u32 irq, struct irq_desc *desc)
while (irq_stat != 0) {
int irqoffset = fls(irq_stat) - 1;
- generic_handle_irq(gpio_irq_no_base + irqoffset);
+ generic_handle_irq(irq_find_mapping(port->domain, irqoffset));
irq_stat &= ~(1 << irqoffset);
}
}
@@ -167,12 +164,12 @@ static int mxs_gpio_set_wake_irq(struct irq_data *d, unsigned int enable)
return 0;
}
-static void __init mxs_gpio_init_gc(struct mxs_gpio_port *port)
+static void __init mxs_gpio_init_gc(struct mxs_gpio_port *port, int irq_base)
{
struct irq_chip_generic *gc;
struct irq_chip_type *ct;
- gc = irq_alloc_generic_chip("gpio-mxs", 1, port->virtual_irq_start,
+ gc = irq_alloc_generic_chip("gpio-mxs", 1, irq_base,
port->base, handle_level_irq);
gc->private = port;
@@ -194,7 +191,7 @@ static int mxs_gpio_to_irq(struct gpio_chip *gc, unsigned offset)
struct mxs_gpio_port *port =
container_of(bgc, struct mxs_gpio_port, bgc);
- return port->virtual_irq_start + offset;
+ return irq_find_mapping(port->domain, offset);
}
static struct platform_device_id mxs_gpio_ids[] = {
@@ -226,6 +223,7 @@ static int __devinit mxs_gpio_probe(struct platform_device *pdev)
static void __iomem *base;
struct mxs_gpio_port *port;
struct resource *iores = NULL;
+ int irq_base;
int err;
port = devm_kzalloc(&pdev->dev, sizeof(*port), GFP_KERNEL);
@@ -241,7 +239,6 @@ static int __devinit mxs_gpio_probe(struct platform_device *pdev)
port->id = pdev->id;
port->devid = pdev->id_entry->driver_data;
}
- port->virtual_irq_start = MXS_GPIO_IRQ_START + port->id * 32;
port->irq = platform_get_irq(pdev, 0);
if (port->irq < 0)
@@ -275,8 +272,19 @@ static int __devinit mxs_gpio_probe(struct platform_device *pdev)
/* clear address has to be used to clear IRQSTAT bits */
writel(~0U, port->base + PINCTRL_IRQSTAT(port) + MXS_CLR);
+ irq_base = irq_alloc_descs(-1, 0, 32, numa_node_id());
+ if (irq_base < 0)
+ return irq_base;
+
+ port->domain = irq_domain_add_legacy(np, 32, irq_base, 0,
+ &irq_domain_simple_ops, NULL);
+ if (!port->domain) {
+ err = -ENODEV;
+ goto out_irqdesc_free;
+ }
+
/* gpio-mxs can be a generic irq chip */
- mxs_gpio_init_gc(port);
+ mxs_gpio_init_gc(port, irq_base);
/* setup one handler for each entry */
irq_set_chained_handler(port->irq, mxs_gpio_irq_handler);
@@ -287,18 +295,22 @@ static int __devinit mxs_gpio_probe(struct platform_device *pdev)
port->base + PINCTRL_DOUT(port), NULL,
port->base + PINCTRL_DOE(port), NULL, 0);
if (err)
- return err;
+ goto out_irqdesc_free;
port->bgc.gc.to_irq = mxs_gpio_to_irq;
port->bgc.gc.base = port->id * 32;
err = gpiochip_add(&port->bgc.gc);
- if (err) {
- bgpio_remove(&port->bgc);
- return err;
- }
+ if (err)
+ goto out_bgpio_remove;
return 0;
+
+out_bgpio_remove:
+ bgpio_remove(&port->bgc);
+out_irqdesc_free:
+ irq_free_descs(irq_base, 32);
+ return err;
}
static struct platform_driver mxs_gpio_driver = {
--
1.7.5.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 1/6] gpio/mxs: adopt irq_domain support for mxs gpio driver
2012-08-20 14:19 ` [PATCH 1/6] gpio/mxs: adopt irq_domain support for mxs gpio driver Shawn Guo
@ 2012-08-21 13:01 ` Linus Walleij
2012-08-21 13:16 ` Rob Herring
2012-08-23 21:49 ` Linus Walleij
1 sibling, 1 reply; 15+ messages in thread
From: Linus Walleij @ 2012-08-21 13:01 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Aug 20, 2012 at 4:19 PM, Shawn Guo <shawn.guo@linaro.org> wrote:
> Remove irq_domain_add_legacy call from mach-mxs.c and have the gpio
> driver adopt irqdomain support, so that we can have the mapping
> between gpio and irq number available without using virtual_irq_start
> and MXS_GPIO_IRQ_START.
Seems like a good thing to do, but with Grant and Rob being better at
irqdomain than me I'd prefer one of them to have a look at this too.
> + irq_base = irq_alloc_descs(-1, 0, 32, numa_node_id());
> + if (irq_base < 0)
> + return irq_base;
> +
> + port->domain = irq_domain_add_legacy(np, 32, irq_base, 0,
> + &irq_domain_simple_ops, NULL);
For example I want to understand if it'd be possible to use a
linear domain here.
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 1/6] gpio/mxs: adopt irq_domain support for mxs gpio driver
2012-08-21 13:01 ` Linus Walleij
@ 2012-08-21 13:16 ` Rob Herring
2012-08-22 2:14 ` Shawn Guo
0 siblings, 1 reply; 15+ messages in thread
From: Rob Herring @ 2012-08-21 13:16 UTC (permalink / raw)
To: linux-arm-kernel
On 08/21/2012 08:01 AM, Linus Walleij wrote:
> On Mon, Aug 20, 2012 at 4:19 PM, Shawn Guo <shawn.guo@linaro.org> wrote:
>
>> Remove irq_domain_add_legacy call from mach-mxs.c and have the gpio
>> driver adopt irqdomain support, so that we can have the mapping
>> between gpio and irq number available without using virtual_irq_start
>> and MXS_GPIO_IRQ_START.
>
> Seems like a good thing to do, but with Grant and Rob being better at
> irqdomain than me I'd prefer one of them to have a look at this too.
>
>> + irq_base = irq_alloc_descs(-1, 0, 32, numa_node_id());
>> + if (irq_base < 0)
>> + return irq_base;
>> +
>> + port->domain = irq_domain_add_legacy(np, 32, irq_base, 0,
>> + &irq_domain_simple_ops, NULL);
>
> For example I want to understand if it'd be possible to use a
> linear domain here.
Unfortunately, not if you care about your irq base and need sequential
irq numbers which is the case for non-DT.
Rob
>
> Yours,
> Linus Walleij
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 1/6] gpio/mxs: adopt irq_domain support for mxs gpio driver
2012-08-21 13:16 ` Rob Herring
@ 2012-08-22 2:14 ` Shawn Guo
0 siblings, 0 replies; 15+ messages in thread
From: Shawn Guo @ 2012-08-22 2:14 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Aug 21, 2012 at 08:16:37AM -0500, Rob Herring wrote:
> On 08/21/2012 08:01 AM, Linus Walleij wrote:
> > On Mon, Aug 20, 2012 at 4:19 PM, Shawn Guo <shawn.guo@linaro.org> wrote:
> >
> >> Remove irq_domain_add_legacy call from mach-mxs.c and have the gpio
> >> driver adopt irqdomain support, so that we can have the mapping
> >> between gpio and irq number available without using virtual_irq_start
> >> and MXS_GPIO_IRQ_START.
> >
> > Seems like a good thing to do, but with Grant and Rob being better at
> > irqdomain than me I'd prefer one of them to have a look at this too.
> >
> >> + irq_base = irq_alloc_descs(-1, 0, 32, numa_node_id());
> >> + if (irq_base < 0)
> >> + return irq_base;
> >> +
> >> + port->domain = irq_domain_add_legacy(np, 32, irq_base, 0,
> >> + &irq_domain_simple_ops, NULL);
> >
> > For example I want to understand if it'd be possible to use a
> > linear domain here.
>
> Unfortunately, not if you care about your irq base and need sequential
> irq numbers which is the case for non-DT.
>
Right. For for this particular case, it's more because generic-chip
currently does not cope with the driver using linear domain.
--
Regards,
Shawn
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 1/6] gpio/mxs: adopt irq_domain support for mxs gpio driver
2012-08-20 14:19 ` [PATCH 1/6] gpio/mxs: adopt irq_domain support for mxs gpio driver Shawn Guo
2012-08-21 13:01 ` Linus Walleij
@ 2012-08-23 21:49 ` Linus Walleij
2012-08-24 1:09 ` Shawn Guo
1 sibling, 1 reply; 15+ messages in thread
From: Linus Walleij @ 2012-08-23 21:49 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Aug 20, 2012 at 4:19 PM, Shawn Guo <shawn.guo@linaro.org> wrote:
> Remove irq_domain_add_legacy call from mach-mxs.c and have the gpio
> driver adopt irqdomain support, so that we can have the mapping
> between gpio and irq number available without using virtual_irq_start
> and MXS_GPIO_IRQ_START.
>
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> Cc: Linus Walleij <linus.walleij@linaro.org>
OK patch applied, thanks!
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 1/6] gpio/mxs: adopt irq_domain support for mxs gpio driver
2012-08-23 21:49 ` Linus Walleij
@ 2012-08-24 1:09 ` Shawn Guo
2012-08-31 22:28 ` Linus Walleij
0 siblings, 1 reply; 15+ messages in thread
From: Shawn Guo @ 2012-08-24 1:09 UTC (permalink / raw)
To: linux-arm-kernel
On Thu, Aug 23, 2012 at 11:49:50PM +0200, Linus Walleij wrote:
> On Mon, Aug 20, 2012 at 4:19 PM, Shawn Guo <shawn.guo@linaro.org> wrote:
>
> > Remove irq_domain_add_legacy call from mach-mxs.c and have the gpio
> > driver adopt irqdomain support, so that we can have the mapping
> > between gpio and irq number available without using virtual_irq_start
> > and MXS_GPIO_IRQ_START.
> >
> > Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
> > Cc: Linus Walleij <linus.walleij@linaro.org>
>
> OK patch applied, thanks!
>
I was planning to have the patch to go via arm-soc tree with your ACK.
But it also works to have it on gpio tree and I ask arm-soc people to
pull gpio tree into arm-soc, but you need to ensure the branch is
stable (no rebase).
--
Regards,
Shawn
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 1/6] gpio/mxs: adopt irq_domain support for mxs gpio driver
2012-08-24 1:09 ` Shawn Guo
@ 2012-08-31 22:28 ` Linus Walleij
2012-09-03 0:28 ` Shawn Guo
0 siblings, 1 reply; 15+ messages in thread
From: Linus Walleij @ 2012-08-31 22:28 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Aug 24, 2012 at 3:09 AM, Shawn Guo <shawn.guo@linaro.org> wrote:
> On Thu, Aug 23, 2012 at 11:49:50PM +0200, Linus Walleij wrote:
>> On Mon, Aug 20, 2012 at 4:19 PM, Shawn Guo <shawn.guo@linaro.org> wrote:
>>
>> > Remove irq_domain_add_legacy call from mach-mxs.c and have the gpio
>> > driver adopt irqdomain support, so that we can have the mapping
>> > between gpio and irq number available without using virtual_irq_start
>> > and MXS_GPIO_IRQ_START.
>> >
>> > Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
>> > Cc: Linus Walleij <linus.walleij@linaro.org>
>>
>> OK patch applied, thanks!
>>
> I was planning to have the patch to go via arm-soc tree with your ACK.
> But it also works to have it on gpio tree and I ask arm-soc people to
> pull gpio tree into arm-soc, but you need to ensure the branch is
> stable (no rebase).
OK sorry (and sorry for the delay) I took the patch out again, please take
this through your tree as needed.
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Yours.
Linus Walleij
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH 2/6] ARM: mxs: retrieve timer irq from device tree
2012-08-20 14:19 [PATCH 0/6] Enable SPARSE_IRQ for mach-mxs Shawn Guo
2012-08-20 14:19 ` [PATCH 1/6] gpio/mxs: adopt irq_domain support for mxs gpio driver Shawn Guo
@ 2012-08-20 14:19 ` Shawn Guo
2012-08-20 14:19 ` [PATCH 3/6] ARM: mxs: select MULTI_IRQ_HANDLER Shawn Guo
` (3 subsequent siblings)
5 siblings, 0 replies; 15+ messages in thread
From: Shawn Guo @ 2012-08-20 14:19 UTC (permalink / raw)
To: linux-arm-kernel
Rather than using the static timer irq definition, we should retrieve
timer irq from device tree for better.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
arch/arm/boot/dts/imx23.dtsi | 3 ++-
arch/arm/boot/dts/imx28.dtsi | 3 ++-
arch/arm/mach-mxs/include/mach/common.h | 2 +-
arch/arm/mach-mxs/timer.c | 13 ++++++++++++-
drivers/clk/mxs/clk-imx23.c | 2 +-
drivers/clk/mxs/clk-imx28.c | 2 +-
6 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi
index 9700872..2672dcf 100644
--- a/arch/arm/boot/dts/imx23.dtsi
+++ b/arch/arm/boot/dts/imx23.dtsi
@@ -400,8 +400,9 @@
};
timrot at 80068000 {
+ compatible = "fsl,imx23-timrot", "fsl,timrot";
reg = <0x80068000 0x2000>;
- status = "disabled";
+ interrupts = <28 29 30 31>;
};
auart0: serial at 8006c000 {
diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
index e2240da..f8b145a 100644
--- a/arch/arm/boot/dts/imx28.dtsi
+++ b/arch/arm/boot/dts/imx28.dtsi
@@ -686,8 +686,9 @@
};
timrot at 80068000 {
+ compatible = "fsl,imx28-timrot", "fsl,timrot";
reg = <0x80068000 0x2000>;
- status = "disabled";
+ interrupts = <48 49 50 51>;
};
auart0: serial at 8006a000 {
diff --git a/arch/arm/mach-mxs/include/mach/common.h b/arch/arm/mach-mxs/include/mach/common.h
index 4dec795..6798be5 100644
--- a/arch/arm/mach-mxs/include/mach/common.h
+++ b/arch/arm/mach-mxs/include/mach/common.h
@@ -13,7 +13,7 @@
extern const u32 *mxs_get_ocotp(void);
extern int mxs_reset_block(void __iomem *);
-extern void mxs_timer_init(int);
+extern void mxs_timer_init(void);
extern void mxs_restart(char, const char *);
extern int mxs_saif_clkmux_select(unsigned int clkmux);
diff --git a/arch/arm/mach-mxs/timer.c b/arch/arm/mach-mxs/timer.c
index 02d36de..7c37926 100644
--- a/arch/arm/mach-mxs/timer.c
+++ b/arch/arm/mach-mxs/timer.c
@@ -25,6 +25,8 @@
#include <linux/irq.h>
#include <linux/clockchips.h>
#include <linux/clk.h>
+#include <linux/of.h>
+#include <linux/of_irq.h>
#include <asm/mach/time.h>
#include <mach/mxs.h>
@@ -244,9 +246,17 @@ static int __init mxs_clocksource_init(struct clk *timer_clk)
return 0;
}
-void __init mxs_timer_init(int irq)
+void __init mxs_timer_init(void)
{
+ struct device_node *np;
struct clk *timer_clk;
+ int irq;
+
+ np = of_find_compatible_node(NULL, NULL, "fsl,timrot");
+ if (!np) {
+ pr_err("%s: failed find timrot node\n", __func__);
+ return;
+ }
timer_clk = clk_get_sys("timrot", NULL);
if (IS_ERR(timer_clk)) {
@@ -295,5 +305,6 @@ void __init mxs_timer_init(int irq)
mxs_clockevent_init(timer_clk);
/* Make irqs happen */
+ irq = irq_of_parse_and_map(np, 0);
setup_irq(irq, &mxs_timer_irq);
}
diff --git a/drivers/clk/mxs/clk-imx23.c b/drivers/clk/mxs/clk-imx23.c
index 844043ad0..e0dc3f8 100644
--- a/drivers/clk/mxs/clk-imx23.c
+++ b/drivers/clk/mxs/clk-imx23.c
@@ -200,7 +200,7 @@ int __init mx23_clocks_init(void)
for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
clk_prepare_enable(clks[clks_init_on[i]]);
- mxs_timer_init(MX23_INT_TIMER0);
+ mxs_timer_init();
return 0;
}
diff --git a/drivers/clk/mxs/clk-imx28.c b/drivers/clk/mxs/clk-imx28.c
index e3aab67..9df864d 100644
--- a/drivers/clk/mxs/clk-imx28.c
+++ b/drivers/clk/mxs/clk-imx28.c
@@ -337,7 +337,7 @@ int __init mx28_clocks_init(void)
for (i = 0; i < ARRAY_SIZE(clks_init_on); i++)
clk_prepare_enable(clks[clks_init_on[i]]);
- mxs_timer_init(MX28_INT_TIMER0);
+ mxs_timer_init();
return 0;
}
--
1.7.5.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 3/6] ARM: mxs: select MULTI_IRQ_HANDLER
2012-08-20 14:19 [PATCH 0/6] Enable SPARSE_IRQ for mach-mxs Shawn Guo
2012-08-20 14:19 ` [PATCH 1/6] gpio/mxs: adopt irq_domain support for mxs gpio driver Shawn Guo
2012-08-20 14:19 ` [PATCH 2/6] ARM: mxs: retrieve timer irq from device tree Shawn Guo
@ 2012-08-20 14:19 ` Shawn Guo
2012-08-20 14:19 ` [PATCH 4/6] ARM: mxs: adopt irq_domain support for icoll driver Shawn Guo
` (2 subsequent siblings)
5 siblings, 0 replies; 15+ messages in thread
From: Shawn Guo @ 2012-08-20 14:19 UTC (permalink / raw)
To: linux-arm-kernel
As part of multi-platform effort, let's enable MULTI_IRQ_HANDLER for
mach-mxs and remove entry-macro.S.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
arch/arm/Kconfig | 1 +
arch/arm/mach-mxs/icoll.c | 18 ++++++++++++-
arch/arm/mach-mxs/include/mach/common.h | 1 +
arch/arm/mach-mxs/include/mach/entry-macro.S | 35 --------------------------
arch/arm/mach-mxs/mach-mxs.c | 2 +
5 files changed, 21 insertions(+), 36 deletions(-)
delete mode 100644 arch/arm/mach-mxs/include/mach/entry-macro.S
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index e91c7cd..7207086 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -489,6 +489,7 @@ config ARCH_MXS
select CLKSRC_MMIO
select COMMON_CLK
select HAVE_CLK_PREPARE
+ select MULTI_IRQ_HANDLER
select PINCTRL
select USE_OF
help
diff --git a/arch/arm/mach-mxs/icoll.c b/arch/arm/mach-mxs/icoll.c
index 23ca9d0..a11b618 100644
--- a/arch/arm/mach-mxs/icoll.c
+++ b/arch/arm/mach-mxs/icoll.c
@@ -20,13 +20,14 @@
#include <linux/init.h>
#include <linux/irq.h>
#include <linux/io.h>
-
+#include <asm/exception.h>
#include <mach/mxs.h>
#include <mach/common.h>
#define HW_ICOLL_VECTOR 0x0000
#define HW_ICOLL_LEVELACK 0x0010
#define HW_ICOLL_CTRL 0x0020
+#define HW_ICOLL_STAT_OFFSET 0x0070
#define HW_ICOLL_INTERRUPTn_SET(n) (0x0124 + (n) * 0x10)
#define HW_ICOLL_INTERRUPTn_CLR(n) (0x0128 + (n) * 0x10)
#define BM_ICOLL_INTERRUPTn_ENABLE 0x00000004
@@ -63,6 +64,21 @@ static struct irq_chip mxs_icoll_chip = {
.irq_unmask = icoll_unmask_irq,
};
+asmlinkage void __exception_irq_entry icoll_handle_irq(struct pt_regs *regs)
+{
+ u32 irqnr;
+
+ do {
+ irqnr = __raw_readl(icoll_base + HW_ICOLL_STAT_OFFSET);
+ if (irqnr != 0x7f) {
+ __raw_writel(irqnr, icoll_base + HW_ICOLL_VECTOR);
+ handle_IRQ(irqnr, regs);
+ continue;
+ }
+ break;
+ } while (1);
+}
+
void __init icoll_init_irq(void)
{
int i;
diff --git a/arch/arm/mach-mxs/include/mach/common.h b/arch/arm/mach-mxs/include/mach/common.h
index 6798be5..be5a9c9 100644
--- a/arch/arm/mach-mxs/include/mach/common.h
+++ b/arch/arm/mach-mxs/include/mach/common.h
@@ -24,5 +24,6 @@ extern int mx28_clocks_init(void);
extern void mx28_map_io(void);
extern void icoll_init_irq(void);
+extern void icoll_handle_irq(struct pt_regs *);
#endif /* __MACH_MXS_COMMON_H__ */
diff --git a/arch/arm/mach-mxs/include/mach/entry-macro.S b/arch/arm/mach-mxs/include/mach/entry-macro.S
deleted file mode 100644
index 0c14259..0000000
--- a/arch/arm/mach-mxs/include/mach/entry-macro.S
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Low-level IRQ helper macros for Freescale MXS-based
- *
- * Copyright (C) 2009-2010 Freescale Semiconductor, Inc. All Rights Reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include <mach/mxs.h>
-
-#define MXS_ICOLL_VBASE MXS_IO_ADDRESS(MXS_ICOLL_BASE_ADDR)
-#define HW_ICOLL_STAT_OFFSET 0x70
-
- .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
- ldr \irqnr, [\base, #HW_ICOLL_STAT_OFFSET]
- cmp \irqnr, #0x7F
- strne \irqnr, [\base]
- moveqs \irqnr, #0
- .endm
-
- .macro get_irqnr_preamble, base, tmp
- ldr \base, =MXS_ICOLL_VBASE
- .endm
diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c
index 9f8406e..d238eb0 100644
--- a/arch/arm/mach-mxs/mach-mxs.c
+++ b/arch/arm/mach-mxs/mach-mxs.c
@@ -413,6 +413,7 @@ static const char *imx28_dt_compat[] __initdata = {
DT_MACHINE_START(IMX23, "Freescale i.MX23 (Device Tree)")
.map_io = mx23_map_io,
.init_irq = mxs_dt_init_irq,
+ .handle_irq = icoll_handle_irq,
.timer = &imx23_timer,
.init_machine = mxs_machine_init,
.dt_compat = imx23_dt_compat,
@@ -422,6 +423,7 @@ MACHINE_END
DT_MACHINE_START(IMX28, "Freescale i.MX28 (Device Tree)")
.map_io = mx28_map_io,
.init_irq = mxs_dt_init_irq,
+ .handle_irq = icoll_handle_irq,
.timer = &imx28_timer,
.init_machine = mxs_machine_init,
.dt_compat = imx28_dt_compat,
--
1.7.5.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 4/6] ARM: mxs: adopt irq_domain support for icoll driver
2012-08-20 14:19 [PATCH 0/6] Enable SPARSE_IRQ for mach-mxs Shawn Guo
` (2 preceding siblings ...)
2012-08-20 14:19 ` [PATCH 3/6] ARM: mxs: select MULTI_IRQ_HANDLER Shawn Guo
@ 2012-08-20 14:19 ` Shawn Guo
2012-08-20 14:19 ` [PATCH 5/6] ARM: mxs: select SPARSE_IRQ Shawn Guo
2012-08-20 14:20 ` [PATCH 6/6] ARM: mxs: remove mach/irqs.h Shawn Guo
5 siblings, 0 replies; 15+ messages in thread
From: Shawn Guo @ 2012-08-20 14:19 UTC (permalink / raw)
To: linux-arm-kernel
Remove irq_domain_add_legacy call from mach-mxs.c and have icoll adopt
irq_domain support in the driver.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
arch/arm/boot/dts/imx23.dtsi | 2 +-
arch/arm/boot/dts/imx28.dtsi | 2 +-
arch/arm/mach-mxs/icoll.c | 45 ++++++++++++++++++++++++++++++++++-------
arch/arm/mach-mxs/mach-mxs.c | 25 +---------------------
4 files changed, 41 insertions(+), 33 deletions(-)
diff --git a/arch/arm/boot/dts/imx23.dtsi b/arch/arm/boot/dts/imx23.dtsi
index 2672dcf..8de4eb2 100644
--- a/arch/arm/boot/dts/imx23.dtsi
+++ b/arch/arm/boot/dts/imx23.dtsi
@@ -43,7 +43,7 @@
ranges;
icoll: interrupt-controller at 80000000 {
- compatible = "fsl,imx23-icoll", "fsl,mxs-icoll";
+ compatible = "fsl,imx23-icoll", "fsl,icoll";
interrupt-controller;
#interrupt-cells = <1>;
reg = <0x80000000 0x2000>;
diff --git a/arch/arm/boot/dts/imx28.dtsi b/arch/arm/boot/dts/imx28.dtsi
index f8b145a..bed5c48 100644
--- a/arch/arm/boot/dts/imx28.dtsi
+++ b/arch/arm/boot/dts/imx28.dtsi
@@ -50,7 +50,7 @@
ranges;
icoll: interrupt-controller at 80000000 {
- compatible = "fsl,imx28-icoll", "fsl,mxs-icoll";
+ compatible = "fsl,imx28-icoll", "fsl,icoll";
interrupt-controller;
#interrupt-cells = <1>;
reg = <0x80000000 0x2000>;
diff --git a/arch/arm/mach-mxs/icoll.c b/arch/arm/mach-mxs/icoll.c
index a11b618..8fb23af 100644
--- a/arch/arm/mach-mxs/icoll.c
+++ b/arch/arm/mach-mxs/icoll.c
@@ -19,7 +19,10 @@
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/irq.h>
+#include <linux/irqdomain.h>
#include <linux/io.h>
+#include <linux/of.h>
+#include <linux/of_irq.h>
#include <asm/exception.h>
#include <mach/mxs.h>
#include <mach/common.h>
@@ -33,7 +36,10 @@
#define BM_ICOLL_INTERRUPTn_ENABLE 0x00000004
#define BV_ICOLL_LEVELACK_IRQLEVELACK__LEVEL0 0x1
+#define ICOLL_NUM_IRQS 128
+
static void __iomem *icoll_base = MXS_IO_ADDRESS(MXS_ICOLL_BASE_ADDR);
+static struct irq_domain *icoll_domain;
static void icoll_ack_irq(struct irq_data *d)
{
@@ -49,13 +55,13 @@ static void icoll_ack_irq(struct irq_data *d)
static void icoll_mask_irq(struct irq_data *d)
{
__raw_writel(BM_ICOLL_INTERRUPTn_ENABLE,
- icoll_base + HW_ICOLL_INTERRUPTn_CLR(d->irq));
+ icoll_base + HW_ICOLL_INTERRUPTn_CLR(d->hwirq));
}
static void icoll_unmask_irq(struct irq_data *d)
{
__raw_writel(BM_ICOLL_INTERRUPTn_ENABLE,
- icoll_base + HW_ICOLL_INTERRUPTn_SET(d->irq));
+ icoll_base + HW_ICOLL_INTERRUPTn_SET(d->hwirq));
}
static struct irq_chip mxs_icoll_chip = {
@@ -72,6 +78,7 @@ asmlinkage void __exception_irq_entry icoll_handle_irq(struct pt_regs *regs)
irqnr = __raw_readl(icoll_base + HW_ICOLL_STAT_OFFSET);
if (irqnr != 0x7f) {
__raw_writel(irqnr, icoll_base + HW_ICOLL_VECTOR);
+ irqnr = irq_find_mapping(icoll_domain, irqnr);
handle_IRQ(irqnr, regs);
continue;
}
@@ -79,18 +86,40 @@ asmlinkage void __exception_irq_entry icoll_handle_irq(struct pt_regs *regs)
} while (1);
}
-void __init icoll_init_irq(void)
+static int icoll_irq_domain_map(struct irq_domain *d, unsigned int virq,
+ irq_hw_number_t hw)
{
- int i;
+ irq_set_chip_and_handler(virq, &mxs_icoll_chip, handle_level_irq);
+ set_irq_flags(virq, IRQF_VALID);
+
+ return 0;
+}
+static struct irq_domain_ops icoll_irq_domain_ops = {
+ .map = icoll_irq_domain_map,
+ .xlate = irq_domain_xlate_onecell,
+};
+
+void __init icoll_of_init(struct device_node *np,
+ struct device_node *interrupt_parent)
+{
/*
* Interrupt Collector reset, which initializes the priority
* for each irq to level 0.
*/
mxs_reset_block(icoll_base + HW_ICOLL_CTRL);
- for (i = 0; i < MXS_INTERNAL_IRQS; i++) {
- irq_set_chip_and_handler(i, &mxs_icoll_chip, handle_level_irq);
- set_irq_flags(i, IRQF_VALID);
- }
+ icoll_domain = irq_domain_add_linear(np, ICOLL_NUM_IRQS,
+ &icoll_irq_domain_ops, NULL);
+ WARN_ON(!icoll_domain);
+}
+
+static const struct of_device_id icoll_of_match[] __initconst = {
+ {.compatible = "fsl,icoll", .data = icoll_of_init},
+ { /* sentinel */ }
+};
+
+void __init icoll_init_irq(void)
+{
+ of_irq_init(icoll_of_match);
}
diff --git a/arch/arm/mach-mxs/mach-mxs.c b/arch/arm/mach-mxs/mach-mxs.c
index d238eb0..a1fb04d 100644
--- a/arch/arm/mach-mxs/mach-mxs.c
+++ b/arch/arm/mach-mxs/mach-mxs.c
@@ -17,10 +17,8 @@
#include <linux/err.h>
#include <linux/gpio.h>
#include <linux/init.h>
-#include <linux/irqdomain.h>
#include <linux/micrel_phy.h>
#include <linux/mxsfb.h>
-#include <linux/of_irq.h>
#include <linux/of_platform.h>
#include <linux/phy.h>
#include <linux/pinctrl/consumer.h>
@@ -141,25 +139,6 @@ static struct of_dev_auxdata mxs_auxdata_lookup[] __initdata = {
{ /* sentinel */ }
};
-static int __init mxs_icoll_add_irq_domain(struct device_node *np,
- struct device_node *interrupt_parent)
-{
- irq_domain_add_legacy(np, 128, 0, 0, &irq_domain_simple_ops, NULL);
-
- return 0;
-}
-
-static const struct of_device_id mxs_irq_match[] __initconst = {
- { .compatible = "fsl,mxs-icoll", .data = mxs_icoll_add_irq_domain, },
- { /* sentinel */ }
-};
-
-static void __init mxs_dt_init_irq(void)
-{
- icoll_init_irq();
- of_irq_init(mxs_irq_match);
-}
-
static void __init imx23_timer_init(void)
{
mx23_clocks_init();
@@ -412,7 +391,7 @@ static const char *imx28_dt_compat[] __initdata = {
DT_MACHINE_START(IMX23, "Freescale i.MX23 (Device Tree)")
.map_io = mx23_map_io,
- .init_irq = mxs_dt_init_irq,
+ .init_irq = icoll_init_irq,
.handle_irq = icoll_handle_irq,
.timer = &imx23_timer,
.init_machine = mxs_machine_init,
@@ -422,7 +401,7 @@ MACHINE_END
DT_MACHINE_START(IMX28, "Freescale i.MX28 (Device Tree)")
.map_io = mx28_map_io,
- .init_irq = mxs_dt_init_irq,
+ .init_irq = icoll_init_irq,
.handle_irq = icoll_handle_irq,
.timer = &imx28_timer,
.init_machine = mxs_machine_init,
--
1.7.5.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 5/6] ARM: mxs: select SPARSE_IRQ
2012-08-20 14:19 [PATCH 0/6] Enable SPARSE_IRQ for mach-mxs Shawn Guo
` (3 preceding siblings ...)
2012-08-20 14:19 ` [PATCH 4/6] ARM: mxs: adopt irq_domain support for icoll driver Shawn Guo
@ 2012-08-20 14:19 ` Shawn Guo
2012-08-20 14:24 ` Shawn Guo
2012-08-20 14:20 ` [PATCH 6/6] ARM: mxs: remove mach/irqs.h Shawn Guo
5 siblings, 1 reply; 15+ messages in thread
From: Shawn Guo @ 2012-08-20 14:19 UTC (permalink / raw)
To: linux-arm-kernel
With icoll and gpio interrupt controllers adopt irqdomain support and
all interrupt nubmers are retrieved from device tree, it's save to
select SPARSE_IRQ for mxs now.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
arch/arm/Kconfig | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 7207086..58bffb3 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -491,6 +491,7 @@ config ARCH_MXS
select HAVE_CLK_PREPARE
select MULTI_IRQ_HANDLER
select PINCTRL
+ select SPARSE_IRQ
select USE_OF
help
Support for Freescale MXS-based family of processors
--
1.7.5.4
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH 6/6] ARM: mxs: remove mach/irqs.h
2012-08-20 14:19 [PATCH 0/6] Enable SPARSE_IRQ for mach-mxs Shawn Guo
` (4 preceding siblings ...)
2012-08-20 14:19 ` [PATCH 5/6] ARM: mxs: select SPARSE_IRQ Shawn Guo
@ 2012-08-20 14:20 ` Shawn Guo
5 siblings, 0 replies; 15+ messages in thread
From: Shawn Guo @ 2012-08-20 14:20 UTC (permalink / raw)
To: linux-arm-kernel
With SPARSE_IRQ adopted for mach-mxs, header mach/irqs.h is needed
nowhere now, so remove it.
Signed-off-by: Shawn Guo <shawn.guo@linaro.org>
---
arch/arm/mach-mxs/include/mach/irqs.h | 32 --------------------------------
1 files changed, 0 insertions(+), 32 deletions(-)
delete mode 100644 arch/arm/mach-mxs/include/mach/irqs.h
diff --git a/arch/arm/mach-mxs/include/mach/irqs.h b/arch/arm/mach-mxs/include/mach/irqs.h
deleted file mode 100644
index f771039..0000000
--- a/arch/arm/mach-mxs/include/mach/irqs.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
- */
-
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#ifndef __MACH_MXS_IRQS_H__
-#define __MACH_MXS_IRQS_H__
-
-#define MXS_INTERNAL_IRQS 128
-
-#define MXS_GPIO_IRQ_START MXS_INTERNAL_IRQS
-
-/* the maximum for MXS-based */
-#define MXS_GPIO_IRQS (32 * 5)
-
-/*
- * The next 16 interrupts are for board specific purposes. Since
- * the kernel can only run on one machine at a time, we can re-use
- * these. If you need more, increase MXS_BOARD_IRQS, but keep it
- * within sensible limits.
- */
-#define MXS_BOARD_IRQ_START (MXS_GPIO_IRQ_START + MXS_GPIO_IRQS)
-#define MXS_BOARD_IRQS 16
-
-#define NR_IRQS (MXS_BOARD_IRQ_START + MXS_BOARD_IRQS)
-
-#endif /* __MACH_MXS_IRQS_H__ */
--
1.7.5.4
^ permalink raw reply related [flat|nested] 15+ messages in thread