Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=0d72ba930cbc9140a584af7e4e65041b6c7a7d18
Commit:     0d72ba930cbc9140a584af7e4e65041b6c7a7d18
Parent:     2099172d61abda1b793b499bb8edcaac4de2cdae
Author:     Olof Johansson <[EMAIL PROTECTED]>
AuthorDate: Sat Sep 8 05:13:19 2007 +1000
Committer:  Paul Mackerras <[EMAIL PROTECTED]>
CommitDate: Fri Sep 14 01:33:25 2007 +1000

    [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 <[EMAIL PROTECTED]>
    Signed-off-by: Paul Mackerras <[EMAIL PROTECTED]>
---
 arch/powerpc/platforms/Kconfig        |   10 ++++++++++
 arch/powerpc/platforms/pasemi/Kconfig |    1 +
 arch/powerpc/sysdev/mpic.c            |   14 ++++++++++++--
 include/asm-powerpc/mpic.h            |    4 ++++
 4 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 065f3b1..78a7eda 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -137,6 +137,16 @@ config MPIC_U3_HT_IRQS
        depends on PPC_MAPLE
        default y
 
+config MPIC_BROKEN_REGREAD
+       bool
+       depends on MPIC
+       help
+         This option enables a MPIC driver workaround for some chips
+         that have a bug that causes some interrupt source information
+         to not read back properly. It is safe to use on other chips as
+         well, but enabling it uses about 8KB of memory to keep copies
+         of the register contents in software.
+
 config IBMVIO
        depends on PPC_PSERIES || PPC_ISERIES
        bool
diff --git a/arch/powerpc/platforms/pasemi/Kconfig 
b/arch/powerpc/platforms/pasemi/Kconfig
index 95cd90f..117d90a 100644
--- a/arch/powerpc/platforms/pasemi/Kconfig
+++ b/arch/powerpc/platforms/pasemi/Kconfig
@@ -5,6 +5,7 @@ config PPC_PASEMI
        select MPIC
        select PPC_UDBG_16550
        select PPC_NATIVE
+       select MPIC_BROKEN_REGREAD
        help
          This option enables support for PA Semi's PWRficient line
          of SoC processors, including PA6T-1682M
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 25a81f7..8de29f2 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
        unsigned int    isu = src_no >> mpic->isu_shift;
        unsigned int    idx = src_no & mpic->isu_mask;
 
-       return _mpic_read(mpic->reg_type, &mpic->isus[isu],
-                         reg + (idx * MPIC_INFO(IRQ_STRIDE)));
+#ifdef CONFIG_MPIC_BROKEN_REGREAD
+       if (reg == 0)
+               return mpic->isu_reg0_shadow[idx];
+       else
+#endif
+               return _mpic_read(mpic->reg_type, &mpic->isus[isu],
+                                 reg + (idx * MPIC_INFO(IRQ_STRIDE)));
 }
 
 static 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,
 
        _mpic_write(mpic->reg_type, &mpic->isus[isu],
                    reg + (idx * MPIC_INFO(IRQ_STRIDE)), value);
+
+#ifdef CONFIG_MPIC_BROKEN_REGREAD
+       if (reg == 0)
+               mpic->isu_reg0_shadow[idx] = value;
+#endif
 }
 
 #define mpic_read(b,r)         _mpic_read(mpic->reg_type,&(b),(r))
diff --git a/include/asm-powerpc/mpic.h b/include/asm-powerpc/mpic.h
index 0eb3ab9..edb4a7c 100644
--- a/include/asm-powerpc/mpic.h
+++ b/include/asm-powerpc/mpic.h
@@ -306,6 +306,10 @@ struct mpic
        unsigned long           *hwirq_bitmap;
 #endif
 
+#ifdef CONFIG_MPIC_BROKEN_REGREAD
+       u32                     isu_reg0_shadow[MPIC_MAX_IRQ_SOURCES];
+#endif
+
        /* link */
        struct mpic             *next;
 
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to