Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 130566
b: refs/heads/master
c: 4aa0f4d
h: refs/heads/master
v: v3
  • Loading branch information
Phil Sutter authored and Ralf Baechle committed Jan 30, 2009
1 parent 108c6c3 commit c85e457
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: fb91e2cb7d3d44356bb92411d6d6b7cb51ce156c
refs/heads/master: 4aa0f4d7264bc4f54603de5db1ffcaf8912ddd23
3 changes: 3 additions & 0 deletions trunk/arch/mips/include/asm/mach-rc32434/irq.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,7 @@
#define ETH0_RX_OVR_IRQ (GROUP3_IRQ_BASE + 9)
#define ETH0_TX_UND_IRQ (GROUP3_IRQ_BASE + 10)

#define GPIO_MAPPED_IRQ_BASE GROUP4_IRQ_BASE
#define GPIO_MAPPED_IRQ_GROUP 4

#endif /* __ASM_RC32434_IRQ_H */
27 changes: 27 additions & 0 deletions trunk/arch/mips/rb532/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
#include <asm/system.h>

#include <asm/mach-rc32434/irq.h>
#include <asm/mach-rc32434/gpio.h>

struct intr_group {
u32 mask; /* mask of valid bits in pending/mask registers */
Expand Down Expand Up @@ -150,6 +151,9 @@ static void rb532_disable_irq(unsigned int irq_nr)
mask |= intr_bit;
WRITE_MASK(addr, mask);

if (group == GPIO_MAPPED_IRQ_GROUP)
rb532_gpio_set_istat(0, irq_nr - GPIO_MAPPED_IRQ_BASE);

/*
* if there are no more interrupts enabled in this
* group, disable corresponding IP
Expand All @@ -165,12 +169,35 @@ static void rb532_mask_and_ack_irq(unsigned int irq_nr)
ack_local_irq(group_to_ip(irq_to_group(irq_nr)));
}

static int rb532_set_type(unsigned int irq_nr, unsigned type)
{
int gpio = irq_nr - GPIO_MAPPED_IRQ_BASE;
int group = irq_to_group(irq_nr);

if (group != GPIO_MAPPED_IRQ_GROUP)
return (type == IRQ_TYPE_LEVEL_HIGH) ? 0 : -EINVAL;

switch (type) {
case IRQ_TYPE_LEVEL_HIGH:
rb532_gpio_set_ilevel(1, gpio);
break;
case IRQ_TYPE_LEVEL_LOW:
rb532_gpio_set_ilevel(0, gpio);
break;
default:
return -EINVAL;
}

return 0;
}

static struct irq_chip rc32434_irq_type = {
.name = "RB532",
.ack = rb532_disable_irq,
.mask = rb532_disable_irq,
.mask_ack = rb532_mask_and_ack_irq,
.unmask = rb532_enable_irq,
.set_type = rb532_set_type,
};

void __init arch_init_irq(void)
Expand Down

0 comments on commit c85e457

Please sign in to comment.