Merge branch 'irq-cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'irq-cleanup-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: (23 commits) genirq: Expand generic show_interrupts() gpio: Fold irq_set_chip/irq_set_handler to irq_set_chip_and_handler gpio: Cleanup genirq namespace arm: ep93xx: Add basic interrupt info arm/gpio: Remove three copies of broken and racy debug code xtensa: Use generic show_interrupts() xtensa: Convert genirq namespace xtensa: Use generic IRQ Kconfig and set GENERIC_HARDIRQS_NO_DEPRECATED xtensa: Convert s6000 gpio irq_chip to new functions xtensa: Convert main irq_chip to new functions um: Use generic show_interrupts() um: Convert genirq namespace m32r: Use generic show_interrupts() m32r: Convert genirq namespace h8300: Use generic show_interrupts() h8300: Convert genirq namespace avr32: Cleanup eic_set_irq_type() avr32: Use generic show_interrupts() avr: Cleanup genirq namespace avr32: Use generic IRQ config, enable GENERIC_HARDIRQS_NO_DEPRECATED ... Fix up trivial conflict in drivers/gpio/timbgpio.c
This commit is contained in:
commit
0dd61be7ec
40 changed files with 283 additions and 602 deletions
|
@ -7,6 +7,9 @@ config ZONE_DMA
|
|||
config XTENSA
|
||||
def_bool y
|
||||
select HAVE_IDE
|
||||
select HAVE_GENERIC_HARDIRQS
|
||||
select GENERIC_IRQ_SHOW
|
||||
select GENERIC_HARDIRQS_NO_DEPRECATED
|
||||
help
|
||||
Xtensa processors are 32-bit RISC machines designed by Tensilica
|
||||
primarily for embedded systems. These processors are both
|
||||
|
@ -27,9 +30,6 @@ config GENERIC_FIND_BIT_LE
|
|||
config GENERIC_HWEIGHT
|
||||
def_bool y
|
||||
|
||||
config GENERIC_HARDIRQS
|
||||
def_bool y
|
||||
|
||||
config GENERIC_GPIO
|
||||
def_bool y
|
||||
|
||||
|
|
|
@ -35,7 +35,6 @@ atomic_t irq_err_count;
|
|||
asmlinkage void do_IRQ(int irq, struct pt_regs *regs)
|
||||
{
|
||||
struct pt_regs *old_regs = set_irq_regs(regs);
|
||||
struct irq_desc *desc = irq_desc + irq;
|
||||
|
||||
if (irq >= NR_IRQS) {
|
||||
printk(KERN_EMERG "%s: cannot handle IRQ %d\n",
|
||||
|
@ -57,104 +56,69 @@ asmlinkage void do_IRQ(int irq, struct pt_regs *regs)
|
|||
sp - sizeof(struct thread_info));
|
||||
}
|
||||
#endif
|
||||
desc->handle_irq(irq, desc);
|
||||
generic_handle_irq(irq);
|
||||
|
||||
irq_exit();
|
||||
set_irq_regs(old_regs);
|
||||
}
|
||||
|
||||
/*
|
||||
* Generic, controller-independent functions:
|
||||
*/
|
||||
|
||||
int show_interrupts(struct seq_file *p, void *v)
|
||||
int arch_show_interrupts(struct seq_file *p, int prec)
|
||||
{
|
||||
int i = *(loff_t *) v, j;
|
||||
struct irqaction * action;
|
||||
unsigned long flags;
|
||||
int j;
|
||||
|
||||
if (i == 0) {
|
||||
seq_printf(p, " ");
|
||||
for_each_online_cpu(j)
|
||||
seq_printf(p, "CPU%d ",j);
|
||||
seq_putc(p, '\n');
|
||||
}
|
||||
|
||||
if (i < NR_IRQS) {
|
||||
raw_spin_lock_irqsave(&irq_desc[i].lock, flags);
|
||||
action = irq_desc[i].action;
|
||||
if (!action)
|
||||
goto skip;
|
||||
seq_printf(p, "%3d: ",i);
|
||||
#ifndef CONFIG_SMP
|
||||
seq_printf(p, "%10u ", kstat_irqs(i));
|
||||
#else
|
||||
for_each_online_cpu(j)
|
||||
seq_printf(p, "%10u ", kstat_irqs_cpu(i, j));
|
||||
#endif
|
||||
seq_printf(p, " %14s", irq_desc[i].chip->name);
|
||||
seq_printf(p, " %s", action->name);
|
||||
|
||||
for (action=action->next; action; action = action->next)
|
||||
seq_printf(p, ", %s", action->name);
|
||||
|
||||
seq_putc(p, '\n');
|
||||
skip:
|
||||
raw_spin_unlock_irqrestore(&irq_desc[i].lock, flags);
|
||||
} else if (i == NR_IRQS) {
|
||||
seq_printf(p, "NMI: ");
|
||||
for_each_online_cpu(j)
|
||||
seq_printf(p, "%10u ", nmi_count(j));
|
||||
seq_putc(p, '\n');
|
||||
seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count));
|
||||
}
|
||||
seq_printf(p, "%*s: ", prec, "NMI");
|
||||
for_each_online_cpu(j)
|
||||
seq_printf(p, "%10u ", nmi_count(j));
|
||||
seq_putc(p, '\n');
|
||||
seq_printf(p, "%*s: ", prec, "ERR");
|
||||
seq_printf(p, "%10u\n", atomic_read(&irq_err_count));
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void xtensa_irq_mask(unsigned int irq)
|
||||
static void xtensa_irq_mask(struct irq_chip *d)
|
||||
{
|
||||
cached_irq_mask &= ~(1 << irq);
|
||||
cached_irq_mask &= ~(1 << d->irq);
|
||||
set_sr (cached_irq_mask, INTENABLE);
|
||||
}
|
||||
|
||||
static void xtensa_irq_unmask(unsigned int irq)
|
||||
static void xtensa_irq_unmask(struct irq_chip *d)
|
||||
{
|
||||
cached_irq_mask |= 1 << irq;
|
||||
cached_irq_mask |= 1 << d->irq;
|
||||
set_sr (cached_irq_mask, INTENABLE);
|
||||
}
|
||||
|
||||
static void xtensa_irq_enable(unsigned int irq)
|
||||
static void xtensa_irq_enable(struct irq_chip *d)
|
||||
{
|
||||
variant_irq_enable(irq);
|
||||
xtensa_irq_unmask(irq);
|
||||
variant_irq_enable(d->irq);
|
||||
xtensa_irq_unmask(d->irq);
|
||||
}
|
||||
|
||||
static void xtensa_irq_disable(unsigned int irq)
|
||||
static void xtensa_irq_disable(struct irq_chip *d)
|
||||
{
|
||||
xtensa_irq_mask(irq);
|
||||
variant_irq_disable(irq);
|
||||
xtensa_irq_mask(d->irq);
|
||||
variant_irq_disable(d->irq);
|
||||
}
|
||||
|
||||
static void xtensa_irq_ack(unsigned int irq)
|
||||
static void xtensa_irq_ack(struct irq_chip *d)
|
||||
{
|
||||
set_sr(1 << irq, INTCLEAR);
|
||||
set_sr(1 << d->irq, INTCLEAR);
|
||||
}
|
||||
|
||||
static int xtensa_irq_retrigger(unsigned int irq)
|
||||
static int xtensa_irq_retrigger(struct irq_chip *d)
|
||||
{
|
||||
set_sr (1 << irq, INTSET);
|
||||
set_sr (1 << d->irq, INTSET);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
static struct irq_chip xtensa_irq_chip = {
|
||||
.name = "xtensa",
|
||||
.enable = xtensa_irq_enable,
|
||||
.disable = xtensa_irq_disable,
|
||||
.mask = xtensa_irq_mask,
|
||||
.unmask = xtensa_irq_unmask,
|
||||
.ack = xtensa_irq_ack,
|
||||
.retrigger = xtensa_irq_retrigger,
|
||||
.irq_enable = xtensa_irq_enable,
|
||||
.irq_disable = xtensa_irq_disable,
|
||||
.irq_mask = xtensa_irq_mask,
|
||||
.irq_unmask = xtensa_irq_unmask,
|
||||
.irq_ack = xtensa_irq_ack,
|
||||
.irq_retrigger = xtensa_irq_retrigger,
|
||||
};
|
||||
|
||||
void __init init_IRQ(void)
|
||||
|
@ -165,25 +129,25 @@ void __init init_IRQ(void)
|
|||
int mask = 1 << index;
|
||||
|
||||
if (mask & XCHAL_INTTYPE_MASK_SOFTWARE)
|
||||
set_irq_chip_and_handler(index, &xtensa_irq_chip,
|
||||
irq_set_chip_and_handler(index, &xtensa_irq_chip,
|
||||
handle_simple_irq);
|
||||
|
||||
else if (mask & XCHAL_INTTYPE_MASK_EXTERN_EDGE)
|
||||
set_irq_chip_and_handler(index, &xtensa_irq_chip,
|
||||
irq_set_chip_and_handler(index, &xtensa_irq_chip,
|
||||
handle_edge_irq);
|
||||
|
||||
else if (mask & XCHAL_INTTYPE_MASK_EXTERN_LEVEL)
|
||||
set_irq_chip_and_handler(index, &xtensa_irq_chip,
|
||||
irq_set_chip_and_handler(index, &xtensa_irq_chip,
|
||||
handle_level_irq);
|
||||
|
||||
else if (mask & XCHAL_INTTYPE_MASK_TIMER)
|
||||
set_irq_chip_and_handler(index, &xtensa_irq_chip,
|
||||
irq_set_chip_and_handler(index, &xtensa_irq_chip,
|
||||
handle_edge_irq);
|
||||
|
||||
else /* XCHAL_INTTYPE_MASK_WRITE_ERROR */
|
||||
/* XCHAL_INTTYPE_MASK_NMI */
|
||||
|
||||
set_irq_chip_and_handler(index, &xtensa_irq_chip,
|
||||
irq_set_chip_and_handler(index, &xtensa_irq_chip,
|
||||
handle_level_irq);
|
||||
}
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ static int __init prepare_phy_irq(int pin)
|
|||
irq = gpio_to_irq(pin);
|
||||
if (irq < 0)
|
||||
goto free;
|
||||
if (set_irq_type(irq, IRQ_TYPE_LEVEL_LOW) < 0)
|
||||
if (irq_set_irq_type(irq, IRQ_TYPE_LEVEL_LOW) < 0)
|
||||
goto free;
|
||||
return irq;
|
||||
free:
|
||||
|
|
|
@ -85,30 +85,29 @@ int s6_gpio_init(u32 afsel)
|
|||
return gpiochip_add(&gpiochip);
|
||||
}
|
||||
|
||||
static void ack(unsigned int irq)
|
||||
static void ack(struct irq_data *d)
|
||||
{
|
||||
writeb(1 << (irq - IRQ_BASE), S6_REG_GPIO + S6_GPIO_IC);
|
||||
writeb(1 << (d->irq - IRQ_BASE), S6_REG_GPIO + S6_GPIO_IC);
|
||||
}
|
||||
|
||||
static void mask(unsigned int irq)
|
||||
static void mask(struct irq_data *d)
|
||||
{
|
||||
u8 r = readb(S6_REG_GPIO + S6_GPIO_IE);
|
||||
r &= ~(1 << (irq - IRQ_BASE));
|
||||
r &= ~(1 << (d->irq - IRQ_BASE));
|
||||
writeb(r, S6_REG_GPIO + S6_GPIO_IE);
|
||||
}
|
||||
|
||||
static void unmask(unsigned int irq)
|
||||
static void unmask(struct irq_data *d)
|
||||
{
|
||||
u8 m = readb(S6_REG_GPIO + S6_GPIO_IE);
|
||||
m |= 1 << (irq - IRQ_BASE);
|
||||
m |= 1 << (d->irq - IRQ_BASE);
|
||||
writeb(m, S6_REG_GPIO + S6_GPIO_IE);
|
||||
}
|
||||
|
||||
static int set_type(unsigned int irq, unsigned int type)
|
||||
static int set_type(struct irq_data *d, unsigned int type)
|
||||
{
|
||||
const u8 m = 1 << (irq - IRQ_BASE);
|
||||
const u8 m = 1 << (d->irq - IRQ_BASE);
|
||||
irq_flow_handler_t handler;
|
||||
struct irq_desc *desc;
|
||||
u8 reg;
|
||||
|
||||
if (type == IRQ_TYPE_PROBE) {
|
||||
|
@ -129,8 +128,7 @@ static int set_type(unsigned int irq, unsigned int type)
|
|||
handler = handle_edge_irq;
|
||||
}
|
||||
writeb(reg, S6_REG_GPIO + S6_GPIO_BANK(0) + S6_GPIO_IS);
|
||||
desc = irq_to_desc(irq);
|
||||
desc->handle_irq = handler;
|
||||
__irq_set_handler_locked(irq, handler);
|
||||
|
||||
reg = readb(S6_REG_GPIO + S6_GPIO_BANK(0) + S6_GPIO_IEV);
|
||||
if (type & (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_EDGE_RISING))
|
||||
|
@ -150,22 +148,23 @@ static int set_type(unsigned int irq, unsigned int type)
|
|||
|
||||
static struct irq_chip gpioirqs = {
|
||||
.name = "GPIO",
|
||||
.ack = ack,
|
||||
.mask = mask,
|
||||
.unmask = unmask,
|
||||
.set_type = set_type,
|
||||
.irq_ack = ack,
|
||||
.irq_mask = mask,
|
||||
.irq_unmask = unmask,
|
||||
.irq_set_type = set_type,
|
||||
};
|
||||
|
||||
static u8 demux_masks[4];
|
||||
|
||||
static void demux_irqs(unsigned int irq, struct irq_desc *desc)
|
||||
{
|
||||
u8 *mask = get_irq_desc_data(desc);
|
||||
struct irq_chip *chip = irq_desc_get_chip(desc);
|
||||
u8 *mask = irq_desc_get_handler_data(desc);
|
||||
u8 pending;
|
||||
int cirq;
|
||||
|
||||
desc->chip->mask(irq);
|
||||
desc->chip->ack(irq);
|
||||
chip->irq_mask(&desc->irq_data);
|
||||
chip->irq_ack(&desc->irq_data));
|
||||
pending = readb(S6_REG_GPIO + S6_GPIO_BANK(0) + S6_GPIO_MIS) & *mask;
|
||||
cirq = IRQ_BASE - 1;
|
||||
while (pending) {
|
||||
|
@ -174,7 +173,7 @@ static void demux_irqs(unsigned int irq, struct irq_desc *desc)
|
|||
pending >>= n;
|
||||
generic_handle_irq(cirq);
|
||||
}
|
||||
desc->chip->unmask(irq);
|
||||
chip->irq_unmask(&desc->irq_data));
|
||||
}
|
||||
|
||||
extern const signed char *platform_irq_mappings[XTENSA_NR_IRQS];
|
||||
|
@ -219,11 +218,11 @@ void __init variant_init_irq(void)
|
|||
i = ffs(mask);
|
||||
cirq += i;
|
||||
mask >>= i;
|
||||
set_irq_chip(cirq, &gpioirqs);
|
||||
set_irq_type(irq, IRQ_TYPE_LEVEL_LOW);
|
||||
irq_set_chip(cirq, &gpioirqs);
|
||||
irq_set_irq_type(irq, IRQ_TYPE_LEVEL_LOW);
|
||||
} while (mask);
|
||||
set_irq_data(irq, demux_masks + n);
|
||||
set_irq_chained_handler(irq, demux_irqs);
|
||||
irq_set_handler_data(irq, demux_masks + n);
|
||||
irq_set_chained_handler(irq, demux_irqs);
|
||||
if (++n == ARRAY_SIZE(demux_masks))
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue