Commit 020af266 authored by Ben Dooks's avatar Ben Dooks Committed by Russell King

[ARM PATCH] 2373/1: S3C2410 - fix possible loop in irq macro

Patch from Ben Dooks

If we read the INTPEND register and get the wrong
result (details below) then it looks like a possible
loop to go back and re-read it after calculating
the possible correct value for it.

It seems that the INTPEND register, which should
show the unique number of the interrupt that we
need to handle. However, it seems that this register
can show the wrong interrupt under certain conditions.

Shannon's research shows that it is very possible that
the occurence of an external interrupt can end up
merging with the base interrupt number, causing
the wrong result in the register.

This patch also fixes the end position of the #ifdef
block and ensures as many registers as possible are
stacked before calling printk() for debug.

Original patch for 2.6.9 by Shannon Holland re-written
for 2.6.10 by Ben Dooks.

Signed-off-by: Shannon Holland                             
Signed-off-by: Ben Dooks                                 
Signed-off-by: Russell King
parent 167bfb35
...@@ -8,11 +8,12 @@ ...@@ -8,11 +8,12 @@
* warranty of any kind, whether express or implied. * warranty of any kind, whether express or implied.
*/ */
.macro get_irqnr_and_base, irqnr, irqstat, base, tmp .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
30000:
mov \tmp, #S3C2410_VA_IRQ mov \tmp, #S3C2410_VA_IRQ
ldr \irqnr, [ \tmp, #0x14 ] @ get irq no ldr \irqnr, [ \tmp, #0x14 ] @ get irq no
30000:
teq \irqnr, #4 teq \irqnr, #4
teqne \irqnr, #5 teqne \irqnr, #5
beq 1002f @ external irq reg beq 1002f @ external irq reg
...@@ -29,15 +30,17 @@ ...@@ -29,15 +30,17 @@
tst \irqstat, #1 tst \irqstat, #1
bne 20002f bne 20002f
/* debug/warning if we get an invalud response from the
* INTOFFSET register */
#if 1 #if 1
stmfd r13!, { r0 - r4 , r14 } stmfd r13!, { r0 - r4 , r8-r12, r14 }
ldr r1, [ \tmp, #0x14 ] @ intoffset ldr r1, [ \tmp, #0x14 ] @ INTOFFSET
ldr r2, [ \tmp, #0x10 ] @ INTPND ldr r2, [ \tmp, #0x10 ] @ INTPND
ldr r3, [ \tmp, #0x00 ] @ SRCPND ldr r3, [ \tmp, #0x00 ] @ SRCPND
adr r0, 20003f adr r0, 20003f
bl printk bl printk
b 20004f b 20004f
#endif
20003: 20003:
.ascii "<7>irq: err - bad offset %d, intpnd=%08x, srcpnd=%08x\n" .ascii "<7>irq: err - bad offset %d, intpnd=%08x, srcpnd=%08x\n"
.byte 0 .byte 0
...@@ -45,7 +48,8 @@ ...@@ -45,7 +48,8 @@
20004: 20004:
mov r1, #1 mov r1, #1
mov \tmp, #S3C2410_VA_IRQ mov \tmp, #S3C2410_VA_IRQ
ldmfd r13!, { r0 - r4 , r14 } ldmfd r13!, { r0 - r4 , r8-r12, r14 }
#endif
@ try working out interript number for ourselves @ try working out interript number for ourselves
mov \irqnr, #0 mov \irqnr, #0
......
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