diff options
Diffstat (limited to 'arch/mips/au1000/pb1200/irqmap.c')
-rw-r--r-- | arch/mips/au1000/pb1200/irqmap.c | 100 |
1 files changed, 56 insertions, 44 deletions
diff --git a/arch/mips/au1000/pb1200/irqmap.c b/arch/mips/au1000/pb1200/irqmap.c index bdf00e2a35e4..c096be4ed4e7 100644 --- a/arch/mips/au1000/pb1200/irqmap.c +++ b/arch/mips/au1000/pb1200/irqmap.c | |||
@@ -94,51 +94,41 @@ inline void pb1200_disable_irq(unsigned int irq_nr) | |||
94 | bcsr->intclr = 1<<(irq_nr - PB1200_INT_BEGIN); | 94 | bcsr->intclr = 1<<(irq_nr - PB1200_INT_BEGIN); |
95 | } | 95 | } |
96 | 96 | ||
97 | static unsigned int pb1200_startup_irq( unsigned int irq_nr ) | 97 | static unsigned int pb1200_setup_cascade(void) |
98 | { | 98 | { |
99 | if (++pb1200_cascade_en == 1) | 99 | int err; |
100 | { | 100 | |
101 | request_irq(AU1000_GPIO_7, &pb1200_cascade_handler, | 101 | err = request_irq(AU1000_GPIO_7, &pb1200_cascade_handler, |
102 | 0, "Pb1200 Cascade", (void *)&pb1200_cascade_handler ); | 102 | 0, "Pb1200 Cascade", &pb1200_cascade_handler); |
103 | #ifdef CONFIG_MIPS_PB1200 | 103 | if (err) |
104 | /* We have a problem with CPLD rev3. Enable a workaround */ | 104 | return err; |
105 | if( ((bcsr->whoami & BCSR_WHOAMI_CPLD)>>4) <= 3) | 105 | |
106 | { | ||
107 | printk("\nWARNING!!!\n"); | ||
108 | printk("\nWARNING!!!\n"); | ||
109 | printk("\nWARNING!!!\n"); | ||
110 | printk("\nWARNING!!!\n"); | ||
111 | printk("\nWARNING!!!\n"); | ||
112 | printk("\nWARNING!!!\n"); | ||
113 | printk("Pb1200 must be at CPLD rev4. Please have Pb1200\n"); | ||
114 | printk("updated to latest revision. This software will not\n"); | ||
115 | printk("work on anything less than CPLD rev4\n"); | ||
116 | printk("\nWARNING!!!\n"); | ||
117 | printk("\nWARNING!!!\n"); | ||
118 | printk("\nWARNING!!!\n"); | ||
119 | printk("\nWARNING!!!\n"); | ||
120 | printk("\nWARNING!!!\n"); | ||
121 | printk("\nWARNING!!!\n"); | ||
122 | while(1); | ||
123 | } | ||
124 | #endif | ||
125 | } | ||
126 | pb1200_enable_irq(irq_nr); | ||
127 | return 0; | 106 | return 0; |
128 | } | 107 | } |
129 | 108 | ||
130 | static void pb1200_shutdown_irq( unsigned int irq_nr ) | 109 | static unsigned int pb1200_startup_irq(unsigned int irq) |
131 | { | 110 | { |
132 | pb1200_disable_irq(irq_nr); | 111 | if (++pb1200_cascade_en == 1) { |
133 | if (--pb1200_cascade_en == 0) | 112 | int res; |
134 | { | 113 | |
135 | free_irq(AU1000_GPIO_7, &pb1200_cascade_handler ); | 114 | res = pb1200_setup_cascade(); |
115 | if (res) | ||
116 | return res; | ||
136 | } | 117 | } |
137 | return; | 118 | |
119 | pb1200_enable_irq(irq); | ||
120 | |||
121 | return 0; | ||
138 | } | 122 | } |
139 | 123 | ||
140 | static struct irq_chip external_irq_type = | 124 | static void pb1200_shutdown_irq(unsigned int irq) |
141 | { | 125 | { |
126 | pb1200_disable_irq(irq); | ||
127 | if (--pb1200_cascade_en == 0) | ||
128 | free_irq(AU1000_GPIO_7, &pb1200_cascade_handler); | ||
129 | } | ||
130 | |||
131 | static struct irq_chip external_irq_type = { | ||
142 | #ifdef CONFIG_MIPS_PB1200 | 132 | #ifdef CONFIG_MIPS_PB1200 |
143 | .name = "Pb1200 Ext", | 133 | .name = "Pb1200 Ext", |
144 | #endif | 134 | #endif |
@@ -155,16 +145,38 @@ static struct irq_chip external_irq_type = | |||
155 | 145 | ||
156 | void _board_init_irq(void) | 146 | void _board_init_irq(void) |
157 | { | 147 | { |
158 | int irq_nr; | 148 | unsigned int irq; |
159 | 149 | ||
160 | for (irq_nr = PB1200_INT_BEGIN; irq_nr <= PB1200_INT_END; irq_nr++) | 150 | #ifdef CONFIG_MIPS_PB1200 |
161 | { | 151 | /* We have a problem with CPLD rev3. Enable a workaround */ |
162 | set_irq_chip_and_handler(irq_nr, &external_irq_type, | 152 | if (((bcsr->whoami & BCSR_WHOAMI_CPLD) >> 4) <= 3) { |
153 | printk("\nWARNING!!!\n"); | ||
154 | printk("\nWARNING!!!\n"); | ||
155 | printk("\nWARNING!!!\n"); | ||
156 | printk("\nWARNING!!!\n"); | ||
157 | printk("\nWARNING!!!\n"); | ||
158 | printk("\nWARNING!!!\n"); | ||
159 | printk("Pb1200 must be at CPLD rev4. Please have Pb1200\n"); | ||
160 | printk("updated to latest revision. This software will not\n"); | ||
161 | printk("work on anything less than CPLD rev4\n"); | ||
162 | printk("\nWARNING!!!\n"); | ||
163 | printk("\nWARNING!!!\n"); | ||
164 | printk("\nWARNING!!!\n"); | ||
165 | printk("\nWARNING!!!\n"); | ||
166 | printk("\nWARNING!!!\n"); | ||
167 | printk("\nWARNING!!!\n"); | ||
168 | panic("Game over. Your score is 0."); | ||
169 | } | ||
170 | #endif | ||
171 | |||
172 | for (irq = PB1200_INT_BEGIN; irq <= PB1200_INT_END; irq++) { | ||
173 | set_irq_chip_and_handler(irq, &external_irq_type, | ||
163 | handle_level_irq); | 174 | handle_level_irq); |
164 | pb1200_disable_irq(irq_nr); | 175 | pb1200_disable_irq(irq); |
165 | } | 176 | } |
166 | 177 | ||
167 | /* GPIO_7 can not be hooked here, so it is hooked upon first | 178 | /* |
168 | request of any source attached to the cascade */ | 179 | * GPIO_7 can not be hooked here, so it is hooked upon first |
180 | * request of any source attached to the cascade | ||
181 | */ | ||
169 | } | 182 | } |
170 | |||