Commit fc6bd7b8 authored by Mike Frysinger's avatar Mike Frysinger

Blackfin: clean up irq ifdef logic a bit

Prefer MMR named checks over part-specific lists, condense duplicated
code across different #ifdef branches, simplify CONFIG_PM ifdefs, and
drop unused kgdb header.
Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
parent 3086fd27
...@@ -19,9 +19,6 @@ ...@@ -19,9 +19,6 @@
#ifdef CONFIG_IPIPE #ifdef CONFIG_IPIPE
#include <linux/ipipe.h> #include <linux/ipipe.h>
#endif #endif
#ifdef CONFIG_KGDB
#include <linux/kgdb.h>
#endif
#include <asm/traps.h> #include <asm/traps.h>
#include <asm/blackfin.h> #include <asm/blackfin.h>
#include <asm/gpio.h> #include <asm/gpio.h>
...@@ -153,24 +150,22 @@ static void bfin_core_unmask_irq(struct irq_data *d) ...@@ -153,24 +150,22 @@ static void bfin_core_unmask_irq(struct irq_data *d)
static void bfin_internal_mask_irq(unsigned int irq) static void bfin_internal_mask_irq(unsigned int irq)
{ {
unsigned long flags; unsigned long flags = hard_local_irq_save();
#ifdef CONFIG_BF53x #ifdef SIC_IMASK0
flags = hard_local_irq_save(); unsigned mask_bank = SIC_SYSIRQ(irq) / 32;
bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() & unsigned mask_bit = SIC_SYSIRQ(irq) % 32;
~(1 << SIC_SYSIRQ(irq)));
#else
unsigned mask_bank, mask_bit;
flags = hard_local_irq_save();
mask_bank = SIC_SYSIRQ(irq) / 32;
mask_bit = SIC_SYSIRQ(irq) % 32;
bfin_write_SIC_IMASK(mask_bank, bfin_read_SIC_IMASK(mask_bank) & bfin_write_SIC_IMASK(mask_bank, bfin_read_SIC_IMASK(mask_bank) &
~(1 << mask_bit)); ~(1 << mask_bit));
#ifdef CONFIG_SMP # ifdef CONFIG_SMP
bfin_write_SICB_IMASK(mask_bank, bfin_read_SICB_IMASK(mask_bank) & bfin_write_SICB_IMASK(mask_bank, bfin_read_SICB_IMASK(mask_bank) &
~(1 << mask_bit)); ~(1 << mask_bit));
# endif
#else
bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() &
~(1 << SIC_SYSIRQ(irq)));
#endif #endif
#endif
hard_local_irq_restore(flags); hard_local_irq_restore(flags);
} }
...@@ -186,30 +181,28 @@ static void bfin_internal_unmask_irq_affinity(unsigned int irq, ...@@ -186,30 +181,28 @@ static void bfin_internal_unmask_irq_affinity(unsigned int irq,
static void bfin_internal_unmask_irq(unsigned int irq) static void bfin_internal_unmask_irq(unsigned int irq)
#endif #endif
{ {
unsigned long flags; unsigned long flags = hard_local_irq_save();
#ifdef CONFIG_BF53x #ifdef SIC_IMASK0
flags = hard_local_irq_save(); unsigned mask_bank = SIC_SYSIRQ(irq) / 32;
bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() | unsigned mask_bit = SIC_SYSIRQ(irq) % 32;
(1 << SIC_SYSIRQ(irq))); # ifdef CONFIG_SMP
#else
unsigned mask_bank, mask_bit;
flags = hard_local_irq_save();
mask_bank = SIC_SYSIRQ(irq) / 32;
mask_bit = SIC_SYSIRQ(irq) % 32;
#ifdef CONFIG_SMP
if (cpumask_test_cpu(0, affinity)) if (cpumask_test_cpu(0, affinity))
#endif # endif
bfin_write_SIC_IMASK(mask_bank, bfin_write_SIC_IMASK(mask_bank,
bfin_read_SIC_IMASK(mask_bank) | bfin_read_SIC_IMASK(mask_bank) |
(1 << mask_bit)); (1 << mask_bit));
#ifdef CONFIG_SMP # ifdef CONFIG_SMP
if (cpumask_test_cpu(1, affinity)) if (cpumask_test_cpu(1, affinity))
bfin_write_SICB_IMASK(mask_bank, bfin_write_SICB_IMASK(mask_bank,
bfin_read_SICB_IMASK(mask_bank) | bfin_read_SICB_IMASK(mask_bank) |
(1 << mask_bit)); (1 << mask_bit));
# endif
#else
bfin_write_SIC_IMASK(bfin_read_SIC_IMASK() |
(1 << SIC_SYSIRQ(irq)));
#endif #endif
#endif
hard_local_irq_restore(flags); hard_local_irq_restore(flags);
} }
...@@ -292,6 +285,8 @@ static int bfin_internal_set_wake_chip(struct irq_data *d, unsigned int state) ...@@ -292,6 +285,8 @@ static int bfin_internal_set_wake_chip(struct irq_data *d, unsigned int state)
{ {
return bfin_internal_set_wake(d->irq, state); return bfin_internal_set_wake(d->irq, state);
} }
#else
# define bfin_internal_set_wake_chip NULL
#endif #endif
static struct irq_chip bfin_core_irqchip = { static struct irq_chip bfin_core_irqchip = {
...@@ -312,9 +307,7 @@ static struct irq_chip bfin_internal_irqchip = { ...@@ -312,9 +307,7 @@ static struct irq_chip bfin_internal_irqchip = {
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
.irq_set_affinity = bfin_internal_set_affinity, .irq_set_affinity = bfin_internal_set_affinity,
#endif #endif
#ifdef CONFIG_PM
.irq_set_wake = bfin_internal_set_wake_chip, .irq_set_wake = bfin_internal_set_wake_chip,
#endif
}; };
static void bfin_handle_irq(unsigned irq) static void bfin_handle_irq(unsigned irq)
...@@ -508,6 +501,8 @@ int bfin_mac_status_set_wake(struct irq_data *d, unsigned int state) ...@@ -508,6 +501,8 @@ int bfin_mac_status_set_wake(struct irq_data *d, unsigned int state)
return bfin_internal_set_wake(IRQ_MAC_ERROR, state); return bfin_internal_set_wake(IRQ_MAC_ERROR, state);
#endif #endif
} }
#else
# define bfin_mac_status_set_wake NULL
#endif #endif
static struct irq_chip bfin_mac_status_irqchip = { static struct irq_chip bfin_mac_status_irqchip = {
...@@ -516,9 +511,7 @@ static struct irq_chip bfin_mac_status_irqchip = { ...@@ -516,9 +511,7 @@ static struct irq_chip bfin_mac_status_irqchip = {
.irq_mask_ack = bfin_mac_status_mask_irq, .irq_mask_ack = bfin_mac_status_mask_irq,
.irq_mask = bfin_mac_status_mask_irq, .irq_mask = bfin_mac_status_mask_irq,
.irq_unmask = bfin_mac_status_unmask_irq, .irq_unmask = bfin_mac_status_unmask_irq,
#ifdef CONFIG_PM
.irq_set_wake = bfin_mac_status_set_wake, .irq_set_wake = bfin_mac_status_set_wake,
#endif
}; };
static void bfin_demux_mac_status_irq(unsigned int int_err_irq, static void bfin_demux_mac_status_irq(unsigned int int_err_irq,
...@@ -681,6 +674,8 @@ int bfin_gpio_set_wake(struct irq_data *d, unsigned int state) ...@@ -681,6 +674,8 @@ int bfin_gpio_set_wake(struct irq_data *d, unsigned int state)
{ {
return gpio_pm_wakeup_ctrl(irq_to_gpio(d->irq), state); return gpio_pm_wakeup_ctrl(irq_to_gpio(d->irq), state);
} }
#else
# define bfin_gpio_set_wake NULL
#endif #endif
static void bfin_demux_gpio_irq(unsigned int inta_irq, static void bfin_demux_gpio_irq(unsigned int inta_irq,
...@@ -699,7 +694,7 @@ static void bfin_demux_gpio_irq(unsigned int inta_irq, ...@@ -699,7 +694,7 @@ static void bfin_demux_gpio_irq(unsigned int inta_irq,
irq = IRQ_PH0; irq = IRQ_PH0;
break; break;
# endif # endif
#elif defined(CONFIG_BF538) || defined(CONFIG_BF539) #elif defined(BF538_FAMILY)
case IRQ_PORTF_INTA: case IRQ_PORTF_INTA:
irq = IRQ_PF0; irq = IRQ_PF0;
break; break;
...@@ -1036,6 +1031,8 @@ void bfin_pm_restore(void) ...@@ -1036,6 +1031,8 @@ void bfin_pm_restore(void)
} }
} }
} }
#else
# define bfin_gpio_set_wake NULL
#endif #endif
static void bfin_demux_gpio_irq(unsigned int inta_irq, static void bfin_demux_gpio_irq(unsigned int inta_irq,
...@@ -1088,9 +1085,7 @@ static struct irq_chip bfin_gpio_irqchip = { ...@@ -1088,9 +1085,7 @@ static struct irq_chip bfin_gpio_irqchip = {
.irq_set_type = bfin_gpio_irq_type, .irq_set_type = bfin_gpio_irq_type,
.irq_startup = bfin_gpio_irq_startup, .irq_startup = bfin_gpio_irq_startup,
.irq_shutdown = bfin_gpio_irq_shutdown, .irq_shutdown = bfin_gpio_irq_shutdown,
#ifdef CONFIG_PM
.irq_set_wake = bfin_gpio_set_wake, .irq_set_wake = bfin_gpio_set_wake,
#endif
}; };
void __cpuinit init_exception_vectors(void) void __cpuinit init_exception_vectors(void)
...@@ -1124,12 +1119,12 @@ int __init init_arch_irq(void) ...@@ -1124,12 +1119,12 @@ int __init init_arch_irq(void)
{ {
int irq; int irq;
unsigned long ilat = 0; unsigned long ilat = 0;
/* Disable all the peripheral intrs - page 4-29 HW Ref manual */ /* Disable all the peripheral intrs - page 4-29 HW Ref manual */
#if defined(CONFIG_BF54x) || defined(CONFIG_BF52x) || defined(CONFIG_BF561) \ #ifdef SIC_IMASK0
|| defined(BF538_FAMILY) || defined(CONFIG_BF51x)
bfin_write_SIC_IMASK0(SIC_UNMASK_ALL); bfin_write_SIC_IMASK0(SIC_UNMASK_ALL);
bfin_write_SIC_IMASK1(SIC_UNMASK_ALL); bfin_write_SIC_IMASK1(SIC_UNMASK_ALL);
# ifdef CONFIG_BF54x # ifdef SIC_IMASK2
bfin_write_SIC_IMASK2(SIC_UNMASK_ALL); bfin_write_SIC_IMASK2(SIC_UNMASK_ALL);
# endif # endif
# ifdef CONFIG_SMP # ifdef CONFIG_SMP
...@@ -1183,7 +1178,7 @@ int __init init_arch_irq(void) ...@@ -1183,7 +1178,7 @@ int __init init_arch_irq(void)
case IRQ_PROG0_INTA: case IRQ_PROG0_INTA:
case IRQ_PROG1_INTA: case IRQ_PROG1_INTA:
case IRQ_PROG2_INTA: case IRQ_PROG2_INTA:
#elif defined(CONFIG_BF538) || defined(CONFIG_BF539) #elif defined(BF538_FAMILY)
case IRQ_PORTF_INTA: case IRQ_PORTF_INTA:
#endif #endif
irq_set_chained_handler(irq, bfin_demux_gpio_irq); irq_set_chained_handler(irq, bfin_demux_gpio_irq);
...@@ -1210,11 +1205,10 @@ int __init init_arch_irq(void) ...@@ -1210,11 +1205,10 @@ int __init init_arch_irq(void)
case IRQ_CORETMR: case IRQ_CORETMR:
# ifdef CONFIG_SMP # ifdef CONFIG_SMP
irq_set_handler(irq, handle_percpu_irq); irq_set_handler(irq, handle_percpu_irq);
break;
# else # else
irq_set_handler(irq, handle_simple_irq); irq_set_handler(irq, handle_simple_irq);
break;
# endif # endif
break;
#endif #endif
#ifdef CONFIG_TICKSOURCE_GPTMR0 #ifdef CONFIG_TICKSOURCE_GPTMR0
...@@ -1223,15 +1217,13 @@ int __init init_arch_irq(void) ...@@ -1223,15 +1217,13 @@ int __init init_arch_irq(void)
break; break;
#endif #endif
#ifdef CONFIG_IPIPE
default: default:
#ifdef CONFIG_IPIPE
irq_set_handler(irq, handle_level_irq); irq_set_handler(irq, handle_level_irq);
break; #else
#else /* !CONFIG_IPIPE */
default:
irq_set_handler(irq, handle_simple_irq); irq_set_handler(irq, handle_simple_irq);
#endif
break; break;
#endif /* !CONFIG_IPIPE */
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment