aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/alchemy/devboards/pb1200
diff options
context:
space:
mode:
authorManuel Lauss <manuel.lauss@googlemail.com>2009-10-04 08:55:25 -0400
committerRalf Baechle <ralf@linux-mips.org>2010-02-27 06:52:50 -0500
commit95a437966dba642870a93d16bf82af8926bb2082 (patch)
tree18e797fc543f9650f03fcb06aae29bf5ca20e585 /arch/mips/alchemy/devboards/pb1200
parent9bdcf336d0c061e77f4c45c7b2bc32e3ed6b57e3 (diff)
MIPS: Alchemy: devboards: factor out PB1200 IRQ cascade code.
Move the PB1200 IRQ cascade code out to the BCSR support code: upcoming DB1300 support can use it too. Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips/alchemy/devboards/pb1200')
-rw-r--r--arch/mips/alchemy/devboards/pb1200/irqmap.c71
1 files changed, 1 insertions, 70 deletions
diff --git a/arch/mips/alchemy/devboards/pb1200/irqmap.c b/arch/mips/alchemy/devboards/pb1200/irqmap.c
index f379b02213f1..3beb8046667b 100644
--- a/arch/mips/alchemy/devboards/pb1200/irqmap.c
+++ b/arch/mips/alchemy/devboards/pb1200/irqmap.c
@@ -45,69 +45,11 @@ struct au1xxx_irqmap __initdata au1xxx_irq_map[] = {
45 { AU1000_GPIO_7, IRQF_TRIGGER_LOW, 0 }, 45 { AU1000_GPIO_7, IRQF_TRIGGER_LOW, 0 },
46}; 46};
47 47
48static void __iomem *bcsr_virt;
49
50/*
51 * Support for External interrupts on the Pb1200 Development platform.
52 */
53
54static void pb1200_cascade_handler(unsigned int irq, struct irq_desc *d)
55{
56 unsigned short bisr = __raw_readw(bcsr_virt + BCSR_REG_INTSTAT);
57
58 for ( ; bisr; bisr &= bisr - 1)
59 generic_handle_irq(PB1200_INT_BEGIN + __ffs(bisr));
60}
61
62/* NOTE: both the enable and mask bits must be cleared, otherwise the
63 * CPLD generates tons of spurious interrupts (at least on the DB1200).
64 */
65static void pb1200_mask_irq(unsigned int irq_nr)
66{
67 unsigned short v = 1 << (irq_nr - PB1200_INT_BEGIN);
68 __raw_writew(v, bcsr_virt + BCSR_REG_INTCLR);
69 __raw_writew(v, bcsr_virt + BCSR_REG_MASKCLR);
70 wmb();
71}
72
73static void pb1200_maskack_irq(unsigned int irq_nr)
74{
75 unsigned short v = 1 << (irq_nr - PB1200_INT_BEGIN);
76 __raw_writew(v, bcsr_virt + BCSR_REG_INTCLR);
77 __raw_writew(v, bcsr_virt + BCSR_REG_MASKCLR);
78 __raw_writew(v, bcsr_virt + BCSR_REG_INTSTAT); /* ack */
79 wmb();
80}
81
82static void pb1200_unmask_irq(unsigned int irq_nr)
83{
84 unsigned short v = 1 << (irq_nr - PB1200_INT_BEGIN);
85 __raw_writew(v, bcsr_virt + BCSR_REG_INTSET);
86 __raw_writew(v, bcsr_virt + BCSR_REG_MASKSET);
87 wmb();
88}
89
90static struct irq_chip pb1200_cpld_irq_type = {
91#ifdef CONFIG_MIPS_PB1200
92 .name = "Pb1200 Ext",
93#endif
94#ifdef CONFIG_MIPS_DB1200
95 .name = "Db1200 Ext",
96#endif
97 .mask = pb1200_mask_irq,
98 .mask_ack = pb1200_maskack_irq,
99 .unmask = pb1200_unmask_irq,
100};
101
102void __init board_init_irq(void) 48void __init board_init_irq(void)
103{ 49{
104 unsigned int irq;
105
106 au1xxx_setup_irqmap(au1xxx_irq_map, ARRAY_SIZE(au1xxx_irq_map)); 50 au1xxx_setup_irqmap(au1xxx_irq_map, ARRAY_SIZE(au1xxx_irq_map));
107 51
108#ifdef CONFIG_MIPS_PB1200 52#ifdef CONFIG_MIPS_PB1200
109 bcsr_virt = (void __iomem *)KSEG1ADDR(PB1200_BCSR_PHYS_ADDR);
110
111 /* We have a problem with CPLD rev 3. */ 53 /* We have a problem with CPLD rev 3. */
112 if (BCSR_WHOAMI_CPLD(bcsr_read(BCSR_WHOAMI)) <= 3) { 54 if (BCSR_WHOAMI_CPLD(bcsr_read(BCSR_WHOAMI)) <= 3) {
113 printk(KERN_ERR "WARNING!!!\n"); 55 printk(KERN_ERR "WARNING!!!\n");
@@ -127,18 +69,7 @@ void __init board_init_irq(void)
127 printk(KERN_ERR "WARNING!!!\n"); 69 printk(KERN_ERR "WARNING!!!\n");
128 panic("Game over. Your score is 0."); 70 panic("Game over. Your score is 0.");
129 } 71 }
130#else
131 bcsr_virt = (void __iomem *)KSEG1ADDR(DB1200_BCSR_PHYS_ADDR);
132#endif 72#endif
133 73
134 /* mask & disable & ack all */ 74 bcsr_init_irq(PB1200_INT_BEGIN, PB1200_INT_END, AU1000_GPIO_7);
135 bcsr_write(BCSR_INTCLR, 0xffff);
136 bcsr_write(BCSR_MASKCLR, 0xffff);
137 bcsr_write(BCSR_INTSTAT, 0xffff);
138
139 for (irq = PB1200_INT_BEGIN; irq <= PB1200_INT_END; irq++)
140 set_irq_chip_and_handler_name(irq, &pb1200_cpld_irq_type,
141 handle_level_irq, "level");
142
143 set_irq_chained_handler(AU1000_GPIO_7, pb1200_cascade_handler);
144} 75}