aboutsummaryrefslogtreecommitdiffstats
path: root/arch/powerpc/sysdev/mpic.c
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2007-09-07 15:13:19 -0400
committerPaul Mackerras <paulus@samba.org>2007-09-13 11:33:25 -0400
commit0d72ba930cbc9140a584af7e4e65041b6c7a7d18 (patch)
tree8dd36503702183fb15f5e783249433c9880e45ee /arch/powerpc/sysdev/mpic.c
parent2099172d61abda1b793b499bb8edcaac4de2cdae (diff)
[POWERPC] Add workaround for MPICs with broken register reads
Some versions of PWRficient 1682M have an interrupt controller in which the first register in each pair for interrupt sources doesn't always read with the right polarity/sense values. To work around this, keep a software copy of the register instead. Since it's not modified from the mpic itself, it's a feasible solution. Still, keep it under a config option to avoid wasting memory on other platforms. Signed-off-by: Olof Johansson <olof@lixom.net> Signed-off-by: Paul Mackerras <paulus@samba.org>
Diffstat (limited to 'arch/powerpc/sysdev/mpic.c')
-rw-r--r--arch/powerpc/sysdev/mpic.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 25a81f73cecf..8de29f28b4c7 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -228,8 +228,13 @@ static inline u32 _mpic_irq_read(struct mpic *mpic, unsigned int src_no, unsigne
228 unsigned int isu = src_no >> mpic->isu_shift; 228 unsigned int isu = src_no >> mpic->isu_shift;
229 unsigned int idx = src_no & mpic->isu_mask; 229 unsigned int idx = src_no & mpic->isu_mask;
230 230
231 return _mpic_read(mpic->reg_type, &mpic->isus[isu], 231#ifdef CONFIG_MPIC_BROKEN_REGREAD
232 reg + (idx * MPIC_INFO(IRQ_STRIDE))); 232 if (reg == 0)
233 return mpic->isu_reg0_shadow[idx];
234 else
235#endif
236 return _mpic_read(mpic->reg_type, &mpic->isus[isu],
237 reg + (idx * MPIC_INFO(IRQ_STRIDE)));
233} 238}
234 239
235static inline void _mpic_irq_write(struct mpic *mpic, unsigned int src_no, 240static inline void _mpic_irq_write(struct mpic *mpic, unsigned int src_no,
@@ -240,6 +245,11 @@ static inline void _mpic_irq_write(struct mpic *mpic, unsigned int src_no,
240 245
241 _mpic_write(mpic->reg_type, &mpic->isus[isu], 246 _mpic_write(mpic->reg_type, &mpic->isus[isu],
242 reg + (idx * MPIC_INFO(IRQ_STRIDE)), value); 247 reg + (idx * MPIC_INFO(IRQ_STRIDE)), value);
248
249#ifdef CONFIG_MPIC_BROKEN_REGREAD
250 if (reg == 0)
251 mpic->isu_reg0_shadow[idx] = value;
252#endif
243} 253}
244 254
245#define mpic_read(b,r) _mpic_read(mpic->reg_type,&(b),(r)) 255#define mpic_read(b,r) _mpic_read(mpic->reg_type,&(b),(r))