* [PATCH] powerpc: Add workaround for MPICs with broken register reads
@ 2007-09-05 2:44 Olof Johansson
2007-09-06 14:55 ` Milton Miller
2007-09-07 9:21 ` [PATCH v2] " Olof Johansson
0 siblings, 2 replies; 7+ messages in thread
From: Olof Johansson @ 2007-09-05 2:44 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev
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>
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 041df77..b9f1efa 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -137,6 +137,10 @@ config MPIC_U3_HT_IRQS
depends on PPC_MAPLE
default y
+config MPIC_BROKEN_REGREAD
+ bool
+ depends on PPC_PASEMI
+
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 74c64c0..c0fe063 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 262db6b..c877fa7 100644
--- a/include/asm-powerpc/mpic.h
+++ b/include/asm-powerpc/mpic.h
@@ -309,6 +309,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;
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc: Add workaround for MPICs with broken register reads
2007-09-05 2:44 [PATCH] powerpc: Add workaround for MPICs with broken register reads Olof Johansson
@ 2007-09-06 14:55 ` Milton Miller
2007-09-07 9:16 ` Olof Johansson
2007-09-07 9:21 ` [PATCH v2] " Olof Johansson
1 sibling, 1 reply; 7+ messages in thread
From: Milton Miller @ 2007-09-06 14:55 UTC (permalink / raw)
To: Olof Johansson; +Cc: ppcdev
On Wed Sep 5 12:44:17 EST 2007, Olof Johansson wrote:
> diff --git a/arch/powerpc/platforms/Kconfig
> b/arch/powerpc/platforms/Kconfig
> index 041df77..b9f1efa 100644
> --- a/arch/powerpc/platforms/Kconfig
> +++ b/arch/powerpc/platforms/Kconfig
> @@ -137,6 +137,10 @@ config MPIC_U3_HT_IRQS
> depends on PPC_MAPLE
> default y
>
> +config MPIC_BROKEN_REGREAD
> + bool
> + depends on PPC_PASEMI
> +
> 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
Since you are using select (and not default y), instead of the depends
on PPC_PASEMI how about adding a short description of what the config
does as help text, in case some future mpic has a similar bug?
milton
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] powerpc: Add workaround for MPICs with broken register reads
2007-09-06 14:55 ` Milton Miller
@ 2007-09-07 9:16 ` Olof Johansson
0 siblings, 0 replies; 7+ messages in thread
From: Olof Johansson @ 2007-09-07 9:16 UTC (permalink / raw)
To: Milton Miller; +Cc: ppcdev
On Thu, Sep 06, 2007 at 09:55:21AM -0500, Milton Miller wrote:
> On Wed Sep 5 12:44:17 EST 2007, Olof Johansson wrote:
>> diff --git a/arch/powerpc/platforms/Kconfig
>> b/arch/powerpc/platforms/Kconfig
>> index 041df77..b9f1efa 100644
>> --- a/arch/powerpc/platforms/Kconfig
>> +++ b/arch/powerpc/platforms/Kconfig
>> @@ -137,6 +137,10 @@ config MPIC_U3_HT_IRQS
>> depends on PPC_MAPLE
>> default y
>>
>> +config MPIC_BROKEN_REGREAD
>> + bool
>> + depends on PPC_PASEMI
>> +
>> 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
>
>
> Since you are using select (and not default y), instead of the depends on
> PPC_PASEMI how about adding a short description of what the config does as
> help text, in case some future mpic has a similar bug?
Thanks Milton, that's a reasonable suggestion (not that any of the other
options do it, including the very vague MPIC_WEIRD :-).
New patch posted shortly.
-Olof
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] powerpc: Add workaround for MPICs with broken register reads
2007-09-05 2:44 [PATCH] powerpc: Add workaround for MPICs with broken register reads Olof Johansson
2007-09-06 14:55 ` Milton Miller
@ 2007-09-07 9:21 ` Olof Johansson
2007-09-07 14:11 ` Milton Miller
2007-09-07 19:13 ` [PATCH v3] " Olof Johansson
1 sibling, 2 replies; 7+ messages in thread
From: Olof Johansson @ 2007-09-07 9:21 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev, miltonm
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>
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 041df77..f2e7049 100644
--- a/arch/powerpc/platforms/Kconfig
+++ b/arch/powerpc/platforms/Kconfig
@@ -137,6 +137,18 @@ config MPIC_U3_HT_IRQS
depends on PPC_MAPLE
default y
+config MPIC_BROKEN_REGREAD
+ bool "MPIC workaround for broken register reads"
+ depends on MPIC
+ help
+ Say Y here to enable 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.
+
+ Say N if you are unsure.
+
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 74c64c0..c0fe063 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 262db6b..c877fa7 100644
--- a/include/asm-powerpc/mpic.h
+++ b/include/asm-powerpc/mpic.h
@@ -309,6 +309,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;
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2] powerpc: Add workaround for MPICs with broken register reads
2007-09-07 9:21 ` [PATCH v2] " Olof Johansson
@ 2007-09-07 14:11 ` Milton Miller
2007-09-07 19:12 ` Olof Johansson
2007-09-07 19:13 ` [PATCH v3] " Olof Johansson
1 sibling, 1 reply; 7+ messages in thread
From: Milton Miller @ 2007-09-07 14:11 UTC (permalink / raw)
To: Olof Johansson; +Cc: paulus, linuxppc-dev
On Sep 7, 2007, at 4:21 AM, Olof Johansson wrote:
> 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>
>
>
> diff --git a/arch/powerpc/platforms/Kconfig
> b/arch/powerpc/platforms/Kconfig
> index 041df77..f2e7049 100644
> --- a/arch/powerpc/platforms/Kconfig
> +++ b/arch/powerpc/platforms/Kconfig
> @@ -137,6 +137,18 @@ config MPIC_U3_HT_IRQS
> depends on PPC_MAPLE
> default y
>
> +config MPIC_BROKEN_REGREAD
> + bool "MPIC workaround for broken register reads"
> + depends on MPIC
> + help
> + Say Y here to enable 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.
> +
> + Say N if you are unsure.
> +
>
I'm sorry, I didn't mean to imply it should be asked / selectable, just
that the help should be provided. I won't object to leaving it except
that it asks the average user unnecessary questions. In other words,
drop the question after bool.
milton
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] powerpc: Add workaround for MPICs with broken register reads
2007-09-07 14:11 ` Milton Miller
@ 2007-09-07 19:12 ` Olof Johansson
0 siblings, 0 replies; 7+ messages in thread
From: Olof Johansson @ 2007-09-07 19:12 UTC (permalink / raw)
To: Milton Miller; +Cc: paulus, linuxppc-dev
On Fri, Sep 07, 2007 at 09:11:52AM -0500, Milton Miller wrote:
> I'm sorry, I didn't mean to imply it should be asked / selectable, just
> that the help should be provided. I won't object to leaving it except
> that it asks the average user unnecessary questions. In other words, drop
> the question after bool.
Sigh. Why is it always that the simple patches/changes require 3 respins? It's
a valid point though, posting v3.
-Olof
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3] powerpc: Add workaround for MPICs with broken register reads
2007-09-07 9:21 ` [PATCH v2] " Olof Johansson
2007-09-07 14:11 ` Milton Miller
@ 2007-09-07 19:13 ` Olof Johansson
1 sibling, 0 replies; 7+ messages in thread
From: Olof Johansson @ 2007-09-07 19:13 UTC (permalink / raw)
To: paulus; +Cc: linuxppc-dev, miltonm
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>
diff --git a/arch/powerpc/platforms/Kconfig b/arch/powerpc/platforms/Kconfig
index 041df77..22a8fa9 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 74c64c0..c0fe063 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 262db6b..c877fa7 100644
--- a/include/asm-powerpc/mpic.h
+++ b/include/asm-powerpc/mpic.h
@@ -309,6 +309,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;
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2007-09-07 19:13 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-05 2:44 [PATCH] powerpc: Add workaround for MPICs with broken register reads Olof Johansson
2007-09-06 14:55 ` Milton Miller
2007-09-07 9:16 ` Olof Johansson
2007-09-07 9:21 ` [PATCH v2] " Olof Johansson
2007-09-07 14:11 ` Milton Miller
2007-09-07 19:12 ` Olof Johansson
2007-09-07 19:13 ` [PATCH v3] " Olof Johansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).