]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ARM: at91: fix at91_extern_irq usage for non-dt boards
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Sat, 1 Jun 2013 14:40:11 +0000 (16:40 +0200)
committerNicolas Ferre <nicolas.ferre@atmel.com>
Fri, 21 Jun 2013 14:35:26 +0000 (16:35 +0200)
Since 4b68520dc0ec96153bc0d87bca5ffba508edfcf
ARM: at91: add AIC5 support

we allocate the at91_extern_irq.

This patch makes it static and stores the non-dt extern irq in the soc
structure. It is then possible to use a at91_get_extern_irq() function
to get the value for outside of the irq driver. It is useful for passing
its value to at91_aic_init().

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Acked-by: Ludovic Desroches <ludovic.desroches@atmel.com>
[nicolas.ferre@atmel.com: rework commit message]
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
12 files changed:
arch/arm/mach-at91/at91rm9200.c
arch/arm/mach-at91/at91sam9260.c
arch/arm/mach-at91/at91sam9261.c
arch/arm/mach-at91/at91sam9263.c
arch/arm/mach-at91/at91sam9g45.c
arch/arm/mach-at91/at91sam9rl.c
arch/arm/mach-at91/at91x40.c
arch/arm/mach-at91/generic.h
arch/arm/mach-at91/irq.c
arch/arm/mach-at91/pm.c
arch/arm/mach-at91/setup.c
arch/arm/mach-at91/soc.h

index d193a409bc4519d291f71a4225c59e7e6cb0d60d..9eb574397ee12adeeb71263f7136d17ca3db3346 100644 (file)
@@ -332,10 +332,6 @@ static void __init at91rm9200_initialize(void)
 {
        arm_pm_idle = at91rm9200_idle;
        arm_pm_restart = at91rm9200_restart;
-       at91_extern_irq = (1 << AT91RM9200_ID_IRQ0) | (1 << AT91RM9200_ID_IRQ1)
-                       | (1 << AT91RM9200_ID_IRQ2) | (1 << AT91RM9200_ID_IRQ3)
-                       | (1 << AT91RM9200_ID_IRQ4) | (1 << AT91RM9200_ID_IRQ5)
-                       | (1 << AT91RM9200_ID_IRQ6);
 
        /* Initialize GPIO subsystem */
        at91_gpio_init(at91rm9200_gpio,
@@ -388,6 +384,10 @@ static unsigned int at91rm9200_default_irq_priority[NR_AIC_IRQS] __initdata = {
 AT91_SOC_START(at91rm9200)
        .map_io = at91rm9200_map_io,
        .default_irq_priority = at91rm9200_default_irq_priority,
+       .extern_irq = (1 << AT91RM9200_ID_IRQ0) | (1 << AT91RM9200_ID_IRQ1)
+                   | (1 << AT91RM9200_ID_IRQ2) | (1 << AT91RM9200_ID_IRQ3)
+                   | (1 << AT91RM9200_ID_IRQ4) | (1 << AT91RM9200_ID_IRQ5)
+                   | (1 << AT91RM9200_ID_IRQ6),
        .ioremap_registers = at91rm9200_ioremap_registers,
        .register_clocks = at91rm9200_register_clocks,
        .init = at91rm9200_initialize,
index a8ce24538da62ea8c5dd9fa1d89a2214508ae996..5de6074b4f4f3681d308cfb34a8554a05550b2f2 100644 (file)
@@ -348,8 +348,6 @@ static void __init at91sam9260_initialize(void)
 {
        arm_pm_idle = at91sam9_idle;
        arm_pm_restart = at91sam9_alt_restart;
-       at91_extern_irq = (1 << AT91SAM9260_ID_IRQ0) | (1 << AT91SAM9260_ID_IRQ1)
-                       | (1 << AT91SAM9260_ID_IRQ2);
 
        /* Register GPIO subsystem */
        at91_gpio_init(at91sam9260_gpio, 3);
@@ -400,6 +398,8 @@ static unsigned int at91sam9260_default_irq_priority[NR_AIC_IRQS] __initdata = {
 AT91_SOC_START(at91sam9260)
        .map_io = at91sam9260_map_io,
        .default_irq_priority = at91sam9260_default_irq_priority,
+       .extern_irq = (1 << AT91SAM9260_ID_IRQ0) | (1 << AT91SAM9260_ID_IRQ1)
+                   | (1 << AT91SAM9260_ID_IRQ2),
        .ioremap_registers = at91sam9260_ioremap_registers,
        .register_clocks = at91sam9260_register_clocks,
        .init = at91sam9260_initialize,
index 25efb5ac30f14b6f76326f236f961c18055145c0..0e0793241ab7e1938dc4ec3fd961557344342369 100644 (file)
@@ -290,8 +290,6 @@ static void __init at91sam9261_initialize(void)
 {
        arm_pm_idle = at91sam9_idle;
        arm_pm_restart = at91sam9_alt_restart;
-       at91_extern_irq = (1 << AT91SAM9261_ID_IRQ0) | (1 << AT91SAM9261_ID_IRQ1)
-                       | (1 << AT91SAM9261_ID_IRQ2);
 
        /* Register GPIO subsystem */
        at91_gpio_init(at91sam9261_gpio, 3);
@@ -342,6 +340,8 @@ static unsigned int at91sam9261_default_irq_priority[NR_AIC_IRQS] __initdata = {
 AT91_SOC_START(at91sam9261)
        .map_io = at91sam9261_map_io,
        .default_irq_priority = at91sam9261_default_irq_priority,
+       .extern_irq = (1 << AT91SAM9261_ID_IRQ0) | (1 << AT91SAM9261_ID_IRQ1)
+                   | (1 << AT91SAM9261_ID_IRQ2),
        .ioremap_registers = at91sam9261_ioremap_registers,
        .register_clocks = at91sam9261_register_clocks,
        .init = at91sam9261_initialize,
index f44ffd2105a728895f3f8c0907acb0eaab5caa17..6ce7d18508934a428ea2ac94ab51162b683b43d1 100644 (file)
@@ -327,7 +327,6 @@ static void __init at91sam9263_initialize(void)
 {
        arm_pm_idle = at91sam9_idle;
        arm_pm_restart = at91sam9_alt_restart;
-       at91_extern_irq = (1 << AT91SAM9263_ID_IRQ0) | (1 << AT91SAM9263_ID_IRQ1);
 
        /* Register GPIO subsystem */
        at91_gpio_init(at91sam9263_gpio, 5);
@@ -378,6 +377,7 @@ static unsigned int at91sam9263_default_irq_priority[NR_AIC_IRQS] __initdata = {
 AT91_SOC_START(at91sam9263)
        .map_io = at91sam9263_map_io,
        .default_irq_priority = at91sam9263_default_irq_priority,
+       .extern_irq = (1 << AT91SAM9263_ID_IRQ0) | (1 << AT91SAM9263_ID_IRQ1),
        .ioremap_registers = at91sam9263_ioremap_registers,
        .register_clocks = at91sam9263_register_clocks,
        .init = at91sam9263_initialize,
index 8b7fce06765232b38e914571624fbe8da2bbb332..fda502691686ff81eb6598288ea3fd99c947b24e 100644 (file)
@@ -374,7 +374,6 @@ static void __init at91sam9g45_initialize(void)
 {
        arm_pm_idle = at91sam9_idle;
        arm_pm_restart = at91sam9g45_restart;
-       at91_extern_irq = (1 << AT91SAM9G45_ID_IRQ0);
 
        /* Register GPIO subsystem */
        at91_gpio_init(at91sam9g45_gpio, 5);
@@ -425,6 +424,7 @@ static unsigned int at91sam9g45_default_irq_priority[NR_AIC_IRQS] __initdata = {
 AT91_SOC_START(at91sam9g45)
        .map_io = at91sam9g45_map_io,
        .default_irq_priority = at91sam9g45_default_irq_priority,
+       .extern_irq = (1 << AT91SAM9G45_ID_IRQ0),
        .ioremap_registers = at91sam9g45_ioremap_registers,
        .register_clocks = at91sam9g45_register_clocks,
        .init = at91sam9g45_initialize,
index f77fae5591bc449600a9d5a8c0d66510454ca5e1..d4ec0d9a9872660e22f2e3c95fc2e8c154cf38e6 100644 (file)
@@ -293,7 +293,6 @@ static void __init at91sam9rl_initialize(void)
 {
        arm_pm_idle = at91sam9_idle;
        arm_pm_restart = at91sam9_alt_restart;
-       at91_extern_irq = (1 << AT91SAM9RL_ID_IRQ0);
 
        /* Register GPIO subsystem */
        at91_gpio_init(at91sam9rl_gpio, 4);
@@ -344,6 +343,7 @@ static unsigned int at91sam9rl_default_irq_priority[NR_AIC_IRQS] __initdata = {
 AT91_SOC_START(at91sam9rl)
        .map_io = at91sam9rl_map_io,
        .default_irq_priority = at91sam9rl_default_irq_priority,
+       .extern_irq = (1 << AT91SAM9RL_ID_IRQ0),
        .ioremap_registers = at91sam9rl_ioremap_registers,
        .register_clocks = at91sam9rl_register_clocks,
        .init = at91sam9rl_initialize,
index 19ca793969053b6015699be6f0a6b060589ef310..bad94b84a46f7b72c9fe5bc182c1c0fbd19861b1 100644 (file)
@@ -55,8 +55,6 @@ static void at91x40_idle(void)
 void __init at91x40_initialize(unsigned long main_clock)
 {
        arm_pm_idle = at91x40_idle;
-       at91_extern_irq = (1 << AT91X40_ID_IRQ0) | (1 << AT91X40_ID_IRQ1)
-                       | (1 << AT91X40_ID_IRQ2);
 }
 
 /*
@@ -86,9 +84,10 @@ static unsigned int at91x40_default_irq_priority[NR_AIC_IRQS] __initdata = {
 
 void __init at91x40_init_interrupts(unsigned int priority[NR_AIC_IRQS])
 {
+       u32  extern_irq = (1 << AT91X40_ID_IRQ0) | (1 << AT91X40_ID_IRQ1)
+                       | (1 << AT91X40_ID_IRQ2);
        if (!priority)
                priority = at91x40_default_irq_priority;
 
-       at91_aic_init(priority, at91_extern_irq);
+       at91_aic_init(priority, extern_irq);
 }
-
index 78ab06548658d7eb0c705022053a86f0ccee539f..f6de36aefe8544e5efdbe5ea6287fa90b0b3e3d2 100644 (file)
@@ -85,4 +85,4 @@ extern void __init at91_gpio_irq_setup(void);
 extern int  __init at91_gpio_of_irq_setup(struct device_node *node,
                                          struct device_node *parent);
 
-extern int at91_extern_irq;
+extern u32 at91_get_extern_irq(void);
index e0ca59171022fb8f2cee7a488cc2ee622c238384..3d192c5aee665e60b24e5fae09171e6315b32b19 100644 (file)
@@ -232,7 +232,14 @@ static void __maybe_unused at91_aic5_eoi(struct irq_data *d)
        at91_aic_write(AT91_AIC5_EOICR, 0);
 }
 
-unsigned long *at91_extern_irq;
+static unsigned long *at91_extern_irq;
+
+u32 at91_get_extern_irq(void)
+{
+       if (!at91_extern_irq)
+               return 0;
+       return *at91_extern_irq;
+}
 
 #define is_extern_irq(hwirq) test_bit(hwirq, at91_extern_irq)
 
index 530db304ec5eb9b2fdca8d3a446789bc89334884..15afb5d9271f2237e3c61acd920b2f9c6d6e0a78 100644 (file)
@@ -212,7 +212,7 @@ static int at91_pm_enter(suspend_state_t state)
                        (at91_pmc_read(AT91_PMC_PCSR)
                                        | (1 << AT91_ID_FIQ)
                                        | (1 << AT91_ID_SYS)
-                                       | (at91_extern_irq))
+                                       | (at91_get_extern_irq()))
                                & at91_aic_read(AT91_AIC_IMR),
                        state);
 
index 942dc00f12275893dd1ae2eb0257fbef2f396f85..b17fbcf4d9e8f34dbd876ea96af334dae4780efc 100644 (file)
@@ -48,7 +48,7 @@ void __init at91_init_irq_default(void)
 void __init at91_init_interrupts(unsigned int *priority)
 {
        /* Initialize the AIC interrupt controller */
-       at91_aic_init(priority, at91_extern_irq);
+       at91_aic_init(priority, at91_boot_soc.extern_irq);
 
        /* Enable GPIO interrupts */
        at91_gpio_irq_setup();
index 43a225f9e71334757a3a4a1817ca60f804404fd1..a1e1482c6da860536e3e44980a501274527990d9 100644 (file)
@@ -6,6 +6,7 @@
 
 struct at91_init_soc {
        int builtin;
+       u32 extern_irq;
        unsigned int *default_irq_priority;
        void (*map_io)(void);
        void (*ioremap_registers)(void);