* OMAP3 CPU revision fix
@ 2008-09-16 13:46 Tero Kristo
2008-09-16 13:46 ` [PATCH] Fixed OMAP3 version check Tero Kristo
0 siblings, 1 reply; 12+ messages in thread
From: Tero Kristo @ 2008-09-16 13:46 UTC (permalink / raw)
To: linux-omap
OMAP3 CPU revision check is still a bit broken. Following patch fixes this.
Also added a small performance optimization to the omap_type() check, type
is only read once from the hardware now.
Tested with two chip revisions: ES2.1GP and ES3.0EMU.
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH] Fixed OMAP3 version check
2008-09-16 13:46 OMAP3 CPU revision fix Tero Kristo
@ 2008-09-16 13:46 ` Tero Kristo
2008-09-25 10:17 ` Tony Lindgren
0 siblings, 1 reply; 12+ messages in thread
From: Tero Kristo @ 2008-09-16 13:46 UTC (permalink / raw)
To: linux-omap
CPU version was reported incorrectly (e.g. ES3.0 instead of ES2.1.)
Also added a piece of optimization for CPU type check (omap_type()).
Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
---
arch/arm/mach-omap2/id.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index ab7a6e9..4e2b449 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -37,7 +37,10 @@ EXPORT_SYMBOL(omap_chip_is);
int omap_type(void)
{
- u32 val = 0;
+ static u32 val;
+
+ if (val != 0)
+ return val;
if (cpu_is_omap24xx()) {
val = omap_ctrl_readl(OMAP24XX_CONTROL_STATUS);
@@ -169,7 +172,7 @@ void __init omap34xx_check_revision(void)
rev = (idcode >> 28) & 0xff;
if (hawkeye == 0xb7ae)
- system_rev = 0x34300034 | ((1 + rev) << 12);
+ system_rev = 0x34300034 | (rev << 12);
out:
switch (system_rev) {
--
1.5.4.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] Fixed OMAP3 version check
2008-09-16 13:46 ` [PATCH] Fixed OMAP3 version check Tero Kristo
@ 2008-09-25 10:17 ` Tony Lindgren
2008-09-25 10:23 ` Felipe Balbi
2008-09-25 12:10 ` Tero.Kristo
0 siblings, 2 replies; 12+ messages in thread
From: Tony Lindgren @ 2008-09-25 10:17 UTC (permalink / raw)
To: Tero Kristo; +Cc: linux-omap
[-- Attachment #1: Type: text/plain, Size: 1414 bytes --]
Hi,
* Tero Kristo <tero.kristo@nokia.com> [080916 14:59]:
> CPU version was reported incorrectly (e.g. ES3.0 instead of ES2.1.)
> Also added a piece of optimization for CPU type check (omap_type()).
>
> Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
> ---
> arch/arm/mach-omap2/id.c | 7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
> index ab7a6e9..4e2b449 100644
> --- a/arch/arm/mach-omap2/id.c
> +++ b/arch/arm/mach-omap2/id.c
> @@ -37,7 +37,10 @@ EXPORT_SYMBOL(omap_chip_is);
>
> int omap_type(void)
> {
> - u32 val = 0;
> + static u32 val;
> +
> + if (val != 0)
> + return val;
Hmm I guess this would return a random val? :)
> if (cpu_is_omap24xx()) {
> val = omap_ctrl_readl(OMAP24XX_CONTROL_STATUS);
> @@ -169,7 +172,7 @@ void __init omap34xx_check_revision(void)
> rev = (idcode >> 28) & 0xff;
>
> if (hawkeye == 0xb7ae)
> - system_rev = 0x34300034 | ((1 + rev) << 12);
> + system_rev = 0x34300034 | (rev << 12);
>
> out:
> switch (system_rev) {
Well AFAIK here are the numbers for rev:
ES1.0 0 /* Cannot read idcode register */
ES2.0 0
ES2.1 1
ES3.0 2
While ES3.0 TRM claims:
ES1.0 0
ES2.0 1
ES2.1 2
ES3.0 3
Which I think is incorrect at least for ES2.0 and ES2.1.
Can you please try the attached patch and see if it detects your ES3.0
correctly?
Tony
[-- Attachment #2: omap3-cpu-detection-fix.patch --]
[-- Type: text/x-diff, Size: 2335 bytes --]
>From 51b488cee3cea1e791728fd6dc69941448a951ce Mon Sep 17 00:00:00 2001
From: Tony Lindgren <tony@atomide.com>
Date: Thu, 25 Sep 2008 13:07:23 +0300
Subject: [PATCH] ARM: OMAP: Improve 34xx detection
Fix it for ES3.0. Also use ES3.0 now as the default for unknown
future revision, and make the code easier to follow.
Signed-off-by: Tony Lindgren <tony@atomide.com>
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index ab7a6e9..bf3691f 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -150,45 +150,49 @@ void __init omap34xx_check_revision(void)
char *rev_name;
/*
+ * We cannot access revision registers on ES1.0.
* If the processor type is Cortex-A8 and the revision is 0x0
- * it means its Cortex r0p0 which is 3430 ES1
+ * it means its Cortex r0p0 which is 3430 ES1.0.
*/
cpuid = read_cpuid(CPUID_ID);
if ((((cpuid >> 4) & 0xfff) == 0xc08) && ((cpuid & 0xf) == 0x0)) {
system_rev = OMAP3430_REV_ES1_0;
+ rev_name = "ES1.0";
goto out;
}
/*
* Detection for 34xx ES2.0 and above can be done with just
* hawkeye and rev. See TRM 1.5.2 Device Identification.
- * Note that rev cannot be used directly as ES1.0 uses value 0.
+ * Note that rev does not map directly to our defined processor
+ * revision numbers as ES1.0 uses value 0.
*/
idcode = read_tap_reg(OMAP_TAP_IDCODE);
hawkeye = (idcode >> 12) & 0xffff;
rev = (idcode >> 28) & 0xff;
- if (hawkeye == 0xb7ae)
- system_rev = 0x34300034 | ((1 + rev) << 12);
-
-out:
- switch (system_rev) {
- case OMAP3430_REV_ES1_0:
- rev_name = "ES1.0";
- break;
- case OMAP3430_REV_ES2_0:
- rev_name = "ES2.0";
- break;
- case OMAP3430_REV_ES2_1:
- rev_name = "ES2.1";
- break;
- case OMAP3430_REV_ES3_0:
- rev_name = "ES3.0";
- break;
- default:
- rev_name = "Unknown revision\n";
+ if (hawkeye == 0xb7ae) {
+ switch (rev) {
+ case 0:
+ system_rev = OMAP3430_REV_ES2_0;
+ rev_name = "ES2.0";
+ break;
+ case 1:
+ system_rev = OMAP3430_REV_ES2_1;
+ rev_name = "ES2.1";
+ break;
+ case 2:
+ system_rev = OMAP3430_REV_ES3_0;
+ rev_name = "ES3.0";
+ break;
+ default:
+ /* Use the latest known revision as default */
+ system_rev = OMAP3430_REV_ES3_0;
+ rev_name = "Unknown revision\n";
+ }
}
+out:
pr_info("OMAP%04x %s\n", system_rev >> 16, rev_name);
}
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] Fixed OMAP3 version check
2008-09-25 10:17 ` Tony Lindgren
@ 2008-09-25 10:23 ` Felipe Balbi
2008-09-25 10:31 ` Tony Lindgren
2008-09-25 12:10 ` Tero.Kristo
1 sibling, 1 reply; 12+ messages in thread
From: Felipe Balbi @ 2008-09-25 10:23 UTC (permalink / raw)
To: ext Tony Lindgren; +Cc: Tero Kristo, linux-omap
On Thu, Sep 25, 2008 at 01:17:51PM +0300, Tony Lindgren wrote:
> Hi,
>
> * Tero Kristo <tero.kristo@nokia.com> [080916 14:59]:
> > CPU version was reported incorrectly (e.g. ES3.0 instead of ES2.1.)
> > Also added a piece of optimization for CPU type check (omap_type()).
> >
> > Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
> > ---
> > arch/arm/mach-omap2/id.c | 7 +++++--
> > 1 files changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
> > index ab7a6e9..4e2b449 100644
> > --- a/arch/arm/mach-omap2/id.c
> > +++ b/arch/arm/mach-omap2/id.c
> > @@ -37,7 +37,10 @@ EXPORT_SYMBOL(omap_chip_is);
> >
> > int omap_type(void)
> > {
> > - u32 val = 0;
> > + static u32 val;
> > +
> > + if (val != 0)
> > + return val;
>
> Hmm I guess this would return a random val? :)
it would return 0, look that val is static.
--
balbi
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Fixed OMAP3 version check
2008-09-25 10:23 ` Felipe Balbi
@ 2008-09-25 10:31 ` Tony Lindgren
2008-09-25 11:41 ` Felipe Balbi
0 siblings, 1 reply; 12+ messages in thread
From: Tony Lindgren @ 2008-09-25 10:31 UTC (permalink / raw)
To: Felipe Balbi; +Cc: Tero Kristo, linux-omap
* Felipe Balbi <felipe.balbi@nokia.com> [080925 13:24]:
> On Thu, Sep 25, 2008 at 01:17:51PM +0300, Tony Lindgren wrote:
> > Hi,
> >
> > * Tero Kristo <tero.kristo@nokia.com> [080916 14:59]:
> > > CPU version was reported incorrectly (e.g. ES3.0 instead of ES2.1.)
> > > Also added a piece of optimization for CPU type check (omap_type()).
> > >
> > > Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
> > > ---
> > > arch/arm/mach-omap2/id.c | 7 +++++--
> > > 1 files changed, 5 insertions(+), 2 deletions(-)
> > >
> > > diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
> > > index ab7a6e9..4e2b449 100644
> > > --- a/arch/arm/mach-omap2/id.c
> > > +++ b/arch/arm/mach-omap2/id.c
> > > @@ -37,7 +37,10 @@ EXPORT_SYMBOL(omap_chip_is);
> > >
> > > int omap_type(void)
> > > {
> > > - u32 val = 0;
> > > + static u32 val;
> > > +
> > > + if (val != 0)
> > > + return val;
> >
> > Hmm I guess this would return a random val? :)
>
> it would return 0, look that val is static.
Ah, sorry I did not see the static. So this is to cache the result
to optimize it? I'd assume this function is only needed during some
init code hopefully where performance does not matter..
Tony
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Fixed OMAP3 version check
2008-09-25 10:31 ` Tony Lindgren
@ 2008-09-25 11:41 ` Felipe Balbi
2008-09-25 11:45 ` Tero.Kristo
0 siblings, 1 reply; 12+ messages in thread
From: Felipe Balbi @ 2008-09-25 11:41 UTC (permalink / raw)
To: ext Tony Lindgren; +Cc: Felipe Balbi, Tero Kristo, linux-omap
On Thu, Sep 25, 2008 at 01:31:21PM +0300, Tony Lindgren wrote:
> * Felipe Balbi <felipe.balbi@nokia.com> [080925 13:24]:
> > On Thu, Sep 25, 2008 at 01:17:51PM +0300, Tony Lindgren wrote:
> > > Hi,
> > >
> > > * Tero Kristo <tero.kristo@nokia.com> [080916 14:59]:
> > > > CPU version was reported incorrectly (e.g. ES3.0 instead of ES2.1.)
> > > > Also added a piece of optimization for CPU type check (omap_type()).
> > > >
> > > > Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
> > > > ---
> > > > arch/arm/mach-omap2/id.c | 7 +++++--
> > > > 1 files changed, 5 insertions(+), 2 deletions(-)
> > > >
> > > > diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
> > > > index ab7a6e9..4e2b449 100644
> > > > --- a/arch/arm/mach-omap2/id.c
> > > > +++ b/arch/arm/mach-omap2/id.c
> > > > @@ -37,7 +37,10 @@ EXPORT_SYMBOL(omap_chip_is);
> > > >
> > > > int omap_type(void)
> > > > {
> > > > - u32 val = 0;
> > > > + static u32 val;
> > > > +
> > > > + if (val != 0)
> > > > + return val;
> > >
> > > Hmm I guess this would return a random val? :)
> >
> > it would return 0, look that val is static.
>
> Ah, sorry I did not see the static. So this is to cache the result
> to optimize it? I'd assume this function is only needed during some
> init code hopefully where performance does not matter..
Yeah, it's not like we're gonna check the revision after the board is
botted all up I guess.
--
balbi
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH] Fixed OMAP3 version check
2008-09-25 11:41 ` Felipe Balbi
@ 2008-09-25 11:45 ` Tero.Kristo
2008-09-25 11:47 ` Tony Lindgren
0 siblings, 1 reply; 12+ messages in thread
From: Tero.Kristo @ 2008-09-25 11:45 UTC (permalink / raw)
To: felipe.balbi, tony; +Cc: linux-omap
>-----Original Message-----
>From: Balbi Felipe (Nokia-D/Helsinki)
>Sent: 25 September, 2008 14:41
>To: ext Tony Lindgren
>Cc: Balbi Felipe (Nokia-D/Helsinki); Kristo Tero
>(Nokia-D/Tampere); linux-omap@vger.kernel.org
>Subject: Re: [PATCH] Fixed OMAP3 version check
>
>On Thu, Sep 25, 2008 at 01:31:21PM +0300, Tony Lindgren wrote:
>> * Felipe Balbi <felipe.balbi@nokia.com> [080925 13:24]:
>> > On Thu, Sep 25, 2008 at 01:17:51PM +0300, Tony Lindgren wrote:
>> > > Hi,
>> > >
>> > > * Tero Kristo <tero.kristo@nokia.com> [080916 14:59]:
>> > > > CPU version was reported incorrectly (e.g. ES3.0 instead of
>> > > > ES2.1.) Also added a piece of optimization for CPU
>type check (omap_type()).
>> > > >
>> > > > Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
>> > > > ---
>> > > > arch/arm/mach-omap2/id.c | 7 +++++--
>> > > > 1 files changed, 5 insertions(+), 2 deletions(-)
>> > > >
>> > > > diff --git a/arch/arm/mach-omap2/id.c
>b/arch/arm/mach-omap2/id.c
>> > > > index ab7a6e9..4e2b449 100644
>> > > > --- a/arch/arm/mach-omap2/id.c
>> > > > +++ b/arch/arm/mach-omap2/id.c
>> > > > @@ -37,7 +37,10 @@ EXPORT_SYMBOL(omap_chip_is);
>> > > >
>> > > > int omap_type(void)
>> > > > {
>> > > > - u32 val = 0;
>> > > > + static u32 val;
>> > > > +
>> > > > + if (val != 0)
>> > > > + return val;
>> > >
>> > > Hmm I guess this would return a random val? :)
>> >
>> > it would return 0, look that val is static.
>>
>> Ah, sorry I did not see the static. So this is to cache the
>result to
>> optimize it? I'd assume this function is only needed during
>some init
>> code hopefully where performance does not matter..
>
>Yeah, it's not like we're gonna check the revision after the
>board is botted all up I guess.
PM code will need to either cache the type information or call this
check every time when entering off-mode. Some things work differently in
secure chips. Could probably just cache this inside PM code.
-Tero
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Fixed OMAP3 version check
2008-09-25 11:45 ` Tero.Kristo
@ 2008-09-25 11:47 ` Tony Lindgren
2008-09-25 11:49 ` Tony Lindgren
0 siblings, 1 reply; 12+ messages in thread
From: Tony Lindgren @ 2008-09-25 11:47 UTC (permalink / raw)
To: Tero.Kristo; +Cc: felipe.balbi, linux-omap
* Tero.Kristo@nokia.com <Tero.Kristo@nokia.com> [080925 14:45]:
>
>
> >-----Original Message-----
> >From: Balbi Felipe (Nokia-D/Helsinki)
> >Sent: 25 September, 2008 14:41
> >To: ext Tony Lindgren
> >Cc: Balbi Felipe (Nokia-D/Helsinki); Kristo Tero
> >(Nokia-D/Tampere); linux-omap@vger.kernel.org
> >Subject: Re: [PATCH] Fixed OMAP3 version check
> >
> >On Thu, Sep 25, 2008 at 01:31:21PM +0300, Tony Lindgren wrote:
> >> * Felipe Balbi <felipe.balbi@nokia.com> [080925 13:24]:
> >> > On Thu, Sep 25, 2008 at 01:17:51PM +0300, Tony Lindgren wrote:
> >> > > Hi,
> >> > >
> >> > > * Tero Kristo <tero.kristo@nokia.com> [080916 14:59]:
> >> > > > CPU version was reported incorrectly (e.g. ES3.0 instead of
> >> > > > ES2.1.) Also added a piece of optimization for CPU
> >type check (omap_type()).
> >> > > >
> >> > > > Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
> >> > > > ---
> >> > > > arch/arm/mach-omap2/id.c | 7 +++++--
> >> > > > 1 files changed, 5 insertions(+), 2 deletions(-)
> >> > > >
> >> > > > diff --git a/arch/arm/mach-omap2/id.c
> >b/arch/arm/mach-omap2/id.c
> >> > > > index ab7a6e9..4e2b449 100644
> >> > > > --- a/arch/arm/mach-omap2/id.c
> >> > > > +++ b/arch/arm/mach-omap2/id.c
> >> > > > @@ -37,7 +37,10 @@ EXPORT_SYMBOL(omap_chip_is);
> >> > > >
> >> > > > int omap_type(void)
> >> > > > {
> >> > > > - u32 val = 0;
> >> > > > + static u32 val;
> >> > > > +
> >> > > > + if (val != 0)
> >> > > > + return val;
> >> > >
> >> > > Hmm I guess this would return a random val? :)
> >> >
> >> > it would return 0, look that val is static.
> >>
> >> Ah, sorry I did not see the static. So this is to cache the
> >result to
> >> optimize it? I'd assume this function is only needed during
> >some init
> >> code hopefully where performance does not matter..
> >
> >Yeah, it's not like we're gonna check the revision after the
> >board is botted all up I guess.
>
> PM code will need to either cache the type information or call this
> check every time when entering off-mode. Some things work differently in
> secure chips. Could probably just cache this inside PM code.
How about setting up the save and restore registers properly for GP
and HS omap once during PM init?
Tony
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH] Fixed OMAP3 version check
2008-09-25 11:47 ` Tony Lindgren
@ 2008-09-25 11:49 ` Tony Lindgren
2008-09-25 12:10 ` Tero.Kristo
0 siblings, 1 reply; 12+ messages in thread
From: Tony Lindgren @ 2008-09-25 11:49 UTC (permalink / raw)
To: Tero.Kristo; +Cc: felipe.balbi, linux-omap
* Tony Lindgren <tony@atomide.com> [080925 14:47]:
> * Tero.Kristo@nokia.com <Tero.Kristo@nokia.com> [080925 14:45]:
> >
> >
> > >-----Original Message-----
> > >From: Balbi Felipe (Nokia-D/Helsinki)
> > >Sent: 25 September, 2008 14:41
> > >To: ext Tony Lindgren
> > >Cc: Balbi Felipe (Nokia-D/Helsinki); Kristo Tero
> > >(Nokia-D/Tampere); linux-omap@vger.kernel.org
> > >Subject: Re: [PATCH] Fixed OMAP3 version check
> > >
> > >On Thu, Sep 25, 2008 at 01:31:21PM +0300, Tony Lindgren wrote:
> > >> * Felipe Balbi <felipe.balbi@nokia.com> [080925 13:24]:
> > >> > On Thu, Sep 25, 2008 at 01:17:51PM +0300, Tony Lindgren wrote:
> > >> > > Hi,
> > >> > >
> > >> > > * Tero Kristo <tero.kristo@nokia.com> [080916 14:59]:
> > >> > > > CPU version was reported incorrectly (e.g. ES3.0 instead of
> > >> > > > ES2.1.) Also added a piece of optimization for CPU
> > >type check (omap_type()).
> > >> > > >
> > >> > > > Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
> > >> > > > ---
> > >> > > > arch/arm/mach-omap2/id.c | 7 +++++--
> > >> > > > 1 files changed, 5 insertions(+), 2 deletions(-)
> > >> > > >
> > >> > > > diff --git a/arch/arm/mach-omap2/id.c
> > >b/arch/arm/mach-omap2/id.c
> > >> > > > index ab7a6e9..4e2b449 100644
> > >> > > > --- a/arch/arm/mach-omap2/id.c
> > >> > > > +++ b/arch/arm/mach-omap2/id.c
> > >> > > > @@ -37,7 +37,10 @@ EXPORT_SYMBOL(omap_chip_is);
> > >> > > >
> > >> > > > int omap_type(void)
> > >> > > > {
> > >> > > > - u32 val = 0;
> > >> > > > + static u32 val;
> > >> > > > +
> > >> > > > + if (val != 0)
> > >> > > > + return val;
> > >> > >
> > >> > > Hmm I guess this would return a random val? :)
> > >> >
> > >> > it would return 0, look that val is static.
> > >>
> > >> Ah, sorry I did not see the static. So this is to cache the
> > >result to
> > >> optimize it? I'd assume this function is only needed during
> > >some init
> > >> code hopefully where performance does not matter..
> > >
> > >Yeah, it's not like we're gonna check the revision after the
> > >board is botted all up I guess.
> >
> > PM code will need to either cache the type information or call this
> > check every time when entering off-mode. Some things work differently in
> > secure chips. Could probably just cache this inside PM code.
>
> How about setting up the save and restore registers properly for GP
> and HS omap once during PM init?
To clarify: Set the save and restore registers and needed functions only
once during PM init depending on the omap type.
Tony
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH] Fixed OMAP3 version check
2008-09-25 11:49 ` Tony Lindgren
@ 2008-09-25 12:10 ` Tero.Kristo
0 siblings, 0 replies; 12+ messages in thread
From: Tero.Kristo @ 2008-09-25 12:10 UTC (permalink / raw)
To: tony; +Cc: felipe.balbi, linux-omap
>-----Original Message-----
>From: ext Tony Lindgren [mailto:tony@atomide.com]
>Sent: 25 September, 2008 14:50
>To: Kristo Tero (Nokia-D/Tampere)
>Cc: Balbi Felipe (Nokia-D/Helsinki); linux-omap@vger.kernel.org
>Subject: Re: [PATCH] Fixed OMAP3 version check
>
>* Tony Lindgren <tony@atomide.com> [080925 14:47]:
>> * Tero.Kristo@nokia.com <Tero.Kristo@nokia.com> [080925 14:45]:
>> >
>> >
>> > >-----Original Message-----
>> > >From: Balbi Felipe (Nokia-D/Helsinki)
>> > >Sent: 25 September, 2008 14:41
>> > >To: ext Tony Lindgren
>> > >Cc: Balbi Felipe (Nokia-D/Helsinki); Kristo Tero
>(Nokia-D/Tampere);
>> > >linux-omap@vger.kernel.org
>> > >Subject: Re: [PATCH] Fixed OMAP3 version check
>> > >
>> > >On Thu, Sep 25, 2008 at 01:31:21PM +0300, Tony Lindgren wrote:
>> > >> * Felipe Balbi <felipe.balbi@nokia.com> [080925 13:24]:
>> > >> > On Thu, Sep 25, 2008 at 01:17:51PM +0300, Tony Lindgren wrote:
>> > >> > > Hi,
>> > >> > >
>> > >> > > * Tero Kristo <tero.kristo@nokia.com> [080916 14:59]:
>> > >> > > > CPU version was reported incorrectly (e.g. ES3.0
>instead of
>> > >> > > > ES2.1.) Also added a piece of optimization for CPU
>> > >type check (omap_type()).
>> > >> > > >
>> > >> > > > Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
>> > >> > > > ---
>> > >> > > > arch/arm/mach-omap2/id.c | 7 +++++--
>> > >> > > > 1 files changed, 5 insertions(+), 2 deletions(-)
>> > >> > > >
>> > >> > > > diff --git a/arch/arm/mach-omap2/id.c
>> > >b/arch/arm/mach-omap2/id.c
>> > >> > > > index ab7a6e9..4e2b449 100644
>> > >> > > > --- a/arch/arm/mach-omap2/id.c
>> > >> > > > +++ b/arch/arm/mach-omap2/id.c
>> > >> > > > @@ -37,7 +37,10 @@ EXPORT_SYMBOL(omap_chip_is);
>> > >> > > >
>> > >> > > > int omap_type(void)
>> > >> > > > {
>> > >> > > > - u32 val = 0;
>> > >> > > > + static u32 val;
>> > >> > > > +
>> > >> > > > + if (val != 0)
>> > >> > > > + return val;
>> > >> > >
>> > >> > > Hmm I guess this would return a random val? :)
>> > >> >
>> > >> > it would return 0, look that val is static.
>> > >>
>> > >> Ah, sorry I did not see the static. So this is to cache the
>> > >result to
>> > >> optimize it? I'd assume this function is only needed during
>> > >some init
>> > >> code hopefully where performance does not matter..
>> > >
>> > >Yeah, it's not like we're gonna check the revision after
>the board
>> > >is botted all up I guess.
>> >
>> > PM code will need to either cache the type information or
>call this
>> > check every time when entering off-mode. Some things work
>> > differently in secure chips. Could probably just cache
>this inside PM code.
>>
>> How about setting up the save and restore registers properly for GP
>> and HS omap once during PM init?
>
>To clarify: Set the save and restore registers and needed
>functions only once during PM init depending on the omap type.
That would be possible also. We only have two additional things to do in
secure OMAP chips anyway, so it is not a big deal. Need to get the damn
thing working first though, can think about optimizations later. >.<
-Tero
^ permalink raw reply [flat|nested] 12+ messages in thread
* RE: [PATCH] Fixed OMAP3 version check
2008-09-25 10:17 ` Tony Lindgren
2008-09-25 10:23 ` Felipe Balbi
@ 2008-09-25 12:10 ` Tero.Kristo
2008-09-25 12:18 ` Tony Lindgren
1 sibling, 1 reply; 12+ messages in thread
From: Tero.Kristo @ 2008-09-25 12:10 UTC (permalink / raw)
To: tony; +Cc: linux-omap
[-- Attachment #1: Type: text/plain, Size: 1919 bytes --]
Hi,
Here is a fix that works on top of your patch. Tested with ES2.1 and
ES3.0 chips. I left out the caching for CPU type.
-Tero
>-----Original Message-----
>From: ext Tony Lindgren [mailto:tony@atomide.com]
>Sent: 25 September, 2008 13:18
>To: Kristo Tero (Nokia-D/Tampere)
>Cc: linux-omap@vger.kernel.org
>Subject: Re: [PATCH] Fixed OMAP3 version check
>
>Hi,
>
>* Tero Kristo <tero.kristo@nokia.com> [080916 14:59]:
>> CPU version was reported incorrectly (e.g. ES3.0 instead of ES2.1.)
>> Also added a piece of optimization for CPU type check (omap_type()).
>>
>> Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
>> ---
>> arch/arm/mach-omap2/id.c | 7 +++++--
>> 1 files changed, 5 insertions(+), 2 deletions(-)
>>
>> diff --git a/arch/arm/mach-omap2/id.c
>b/arch/arm/mach-omap2/id.c index
>> ab7a6e9..4e2b449 100644
>> --- a/arch/arm/mach-omap2/id.c
>> +++ b/arch/arm/mach-omap2/id.c
>> @@ -37,7 +37,10 @@ EXPORT_SYMBOL(omap_chip_is);
>>
>> int omap_type(void)
>> {
>> - u32 val = 0;
>> + static u32 val;
>> +
>> + if (val != 0)
>> + return val;
>
>Hmm I guess this would return a random val? :)
>
>
>> if (cpu_is_omap24xx()) {
>> val = omap_ctrl_readl(OMAP24XX_CONTROL_STATUS);
>> @@ -169,7 +172,7 @@ void __init omap34xx_check_revision(void)
>> rev = (idcode >> 28) & 0xff;
>>
>> if (hawkeye == 0xb7ae)
>> - system_rev = 0x34300034 | ((1 + rev) << 12);
>> + system_rev = 0x34300034 | (rev << 12);
>>
>> out:
>> switch (system_rev) {
>
>Well AFAIK here are the numbers for rev:
>
>ES1.0 0 /* Cannot read idcode register */
>ES2.0 0
>ES2.1 1
>ES3.0 2
>
>While ES3.0 TRM claims:
>
>ES1.0 0
>ES2.0 1
>ES2.1 2
>ES3.0 3
>
>Which I think is incorrect at least for ES2.0 and ES2.1.
>
>Can you please try the attached patch and see if it detects
>your ES3.0 correctly?
>
>Tony
>
[-- Attachment #2: 0001-OMAP3-Fixed-version-check.patch --]
[-- Type: application/octet-stream, Size: 879 bytes --]
From 3c61087568f3075398ee502bd91e6e760e04bca1 Mon Sep 17 00:00:00 2001
From: Tero Kristo <tero.kristo@nokia.com>
Date: Thu, 25 Sep 2008 16:43:18 +0300
Subject: [PATCH] OMAP3: Fixed version check
ES2.1 and ES3.0 are now detected correctly.
Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
---
arch/arm/mach-omap2/id.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index bf3691f..7a7ad18 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -177,11 +177,11 @@ void __init omap34xx_check_revision(void)
system_rev = OMAP3430_REV_ES2_0;
rev_name = "ES2.0";
break;
- case 1:
+ case 2:
system_rev = OMAP3430_REV_ES2_1;
rev_name = "ES2.1";
break;
- case 2:
+ case 3:
system_rev = OMAP3430_REV_ES3_0;
rev_name = "ES3.0";
break;
--
1.5.4.3
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH] Fixed OMAP3 version check
2008-09-25 12:10 ` Tero.Kristo
@ 2008-09-25 12:18 ` Tony Lindgren
0 siblings, 0 replies; 12+ messages in thread
From: Tony Lindgren @ 2008-09-25 12:18 UTC (permalink / raw)
To: Tero.Kristo; +Cc: linux-omap
* Tero.Kristo@nokia.com <Tero.Kristo@nokia.com> [080925 15:10]:
> Hi,
>
> Here is a fix that works on top of your patch. Tested with ES2.1 and
> ES3.0 chips. I left out the caching for CPU type.
Thanks, I'll merge your fix into my patch and push it to l-o. Will
also create a series for patches for upstream to fix cpu detection.
For the caching of the omap type, if we need to set up something,
let's set up some other register in addition to system_rev. That allows
more tests, like the package type. But let's do it once we really need
it.
Tony
>
> -Tero
>
> >-----Original Message-----
> >From: ext Tony Lindgren [mailto:tony@atomide.com]
> >Sent: 25 September, 2008 13:18
> >To: Kristo Tero (Nokia-D/Tampere)
> >Cc: linux-omap@vger.kernel.org
> >Subject: Re: [PATCH] Fixed OMAP3 version check
> >
> >Hi,
> >
> >* Tero Kristo <tero.kristo@nokia.com> [080916 14:59]:
> >> CPU version was reported incorrectly (e.g. ES3.0 instead of ES2.1.)
> >> Also added a piece of optimization for CPU type check (omap_type()).
> >>
> >> Signed-off-by: Tero Kristo <tero.kristo@nokia.com>
> >> ---
> >> arch/arm/mach-omap2/id.c | 7 +++++--
> >> 1 files changed, 5 insertions(+), 2 deletions(-)
> >>
> >> diff --git a/arch/arm/mach-omap2/id.c
> >b/arch/arm/mach-omap2/id.c index
> >> ab7a6e9..4e2b449 100644
> >> --- a/arch/arm/mach-omap2/id.c
> >> +++ b/arch/arm/mach-omap2/id.c
> >> @@ -37,7 +37,10 @@ EXPORT_SYMBOL(omap_chip_is);
> >>
> >> int omap_type(void)
> >> {
> >> - u32 val = 0;
> >> + static u32 val;
> >> +
> >> + if (val != 0)
> >> + return val;
> >
> >Hmm I guess this would return a random val? :)
> >
> >
> >> if (cpu_is_omap24xx()) {
> >> val = omap_ctrl_readl(OMAP24XX_CONTROL_STATUS);
> >> @@ -169,7 +172,7 @@ void __init omap34xx_check_revision(void)
> >> rev = (idcode >> 28) & 0xff;
> >>
> >> if (hawkeye == 0xb7ae)
> >> - system_rev = 0x34300034 | ((1 + rev) << 12);
> >> + system_rev = 0x34300034 | (rev << 12);
> >>
> >> out:
> >> switch (system_rev) {
> >
> >Well AFAIK here are the numbers for rev:
> >
> >ES1.0 0 /* Cannot read idcode register */
> >ES2.0 0
> >ES2.1 1
> >ES3.0 2
> >
> >While ES3.0 TRM claims:
> >
> >ES1.0 0
> >ES2.0 1
> >ES2.1 2
> >ES3.0 3
> >
> >Which I think is incorrect at least for ES2.0 and ES2.1.
> >
> >Can you please try the attached patch and see if it detects
> >your ES3.0 correctly?
> >
> >Tony
> >
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2008-09-25 12:18 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-16 13:46 OMAP3 CPU revision fix Tero Kristo
2008-09-16 13:46 ` [PATCH] Fixed OMAP3 version check Tero Kristo
2008-09-25 10:17 ` Tony Lindgren
2008-09-25 10:23 ` Felipe Balbi
2008-09-25 10:31 ` Tony Lindgren
2008-09-25 11:41 ` Felipe Balbi
2008-09-25 11:45 ` Tero.Kristo
2008-09-25 11:47 ` Tony Lindgren
2008-09-25 11:49 ` Tony Lindgren
2008-09-25 12:10 ` Tero.Kristo
2008-09-25 12:10 ` Tero.Kristo
2008-09-25 12:18 ` Tony Lindgren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox