Runtime detection of OMAP35x devices
Subsystems (3)
PATCH 1/1 Runtime detection of OMAP35x devices
Add runtime check for these OMAP35x variations
based on the detected Si features:
OMAP3503, OMAP3515, OMAP3525 and OMA3530.
Also, delayed the call to pr_info() into actual
variant is detected in omap3_cpuinfo()
--- arch/arm/mach-omap2/id.c | 59 +++++++++++++++++++++++++++----- arch/arm/plat-omap/include/mach/cpu.h | 25 ++++++++++++++ 2 files changed, 74 insertions(+), 10 deletions(-)
arch/arm/mach-omap2/id.c +49 -10
@@ -187,7 +187,6 @@ void __init omap3_check_revision(void)u32 cpuid, idcode;u16 hawkeye;u8 rev; -char *rev_name ="ES1.0" ;/* * We cannot access revision registers on ES1.0.
@@ -197,7 +196,7 @@ void __init omap3_check_revision(void) cpuid =read_cpuid (CPUID_ID );if ((((cpuid >>4 ) &0xfff ) ==0xc08 ) && ((cpuid &0xf ) ==0x0 )) { omap_revision =OMAP3430_REV_ES1_0 ; - goto out; +return ; }/*
@@ -214,29 +213,21 @@ void __init omap3_check_revision(void)switch (rev) {case 0 : omap_revision =OMAP3430_REV_ES2_0 ; - rev_name ="ES2.0" ;break ;case 2 : omap_revision =OMAP3430_REV_ES2_1 ; - rev_name ="ES2.1" ;break ;case 3 : omap_revision =OMAP3430_REV_ES3_0 ; - rev_name ="ES3.0" ;break ;case 4 : omap_revision =OMAP3430_REV_ES3_1 ; - rev_name ="ES3.1" ;break ;default :/* Use the latest known revision as default */ omap_revision =OMAP3430_REV_ES3_1 ; - rev_name ="Unknown revision\n" ; } } - -out: -pr_info ("OMAP%04x %s\n" ,omap_rev () >>16 , rev_name); }#define OMAP3_SHOW_FEATURE (feat) \
@@ -248,6 +239,54 @@ out:void __init omap3_cpuinfo (void ) { +u8 rev =GET_OMAP_REVISION (); +char cpu_name[16 ], cpu_rev[16 ]; + +/* OMAP3430 and OMAP3530 are assumed to be same. +* +* OMAP3525, OMAP3515 and OMAP3503 can be detected only based +* on available features. Upon detection, update the CPU id +* and CPU class bits. +*/ +if (omap3_has_iva () &&omap3_has_sgx ()) { +strcpy (cpu_name,"3430/3530" ); + } +else if (omap3_has_sgx ()) { + omap_revision =OMAP3525_REV (rev); +strcpy (cpu_name,"3525" ); + } +else if (omap3_has_iva ()) { + omap_revision =OMAP3515_REV (rev); +strcpy (cpu_name,"3515" ); + } +else { + omap_revision =OMAP3503_REV (rev); +strcpy (cpu_name,"3503" ); + } + +switch (rev) { +case 0x10 : +strcpy (cpu_rev,"2.0" ); +break ; +case 0x20 : +strcpy (cpu_rev,"2.1" ); +break ; +case 0x30 : +strcpy (cpu_rev,"3.0" ); +break ; +case 0x40 : +strcpy (cpu_rev,"3.1" ); +break ; +default : +/* Use the latest known revision as default */ +strcpy (cpu_rev,"3.1" ); + } + +/* +* Print verbose information +*/ +pr_info ("OMAP%s ES%s\n" , cpu_name, cpu_rev); +OMAP3_SHOW_FEATURE (l2cache);OMAP3_SHOW_FEATURE (iva);OMAP3_SHOW_FEATURE (sgx);
arch/arm/plat-omap/include/mach/cpu.h +25 -0
@@ -57,6 +57,11 @@ struct omap_chip_id {unsigned int omap_rev (void );/* +* Get the CPU revision for OMAP devices +*/ +#define GET_OMAP_REVISION () ((omap_rev() >> 8) & 0xff) + +/* * Test if multicore OMAP support is needed */ #undef MULTI_OMAP1
@@ -360,7 +365,21 @@ IS_OMAP_TYPE(3430, 0x3430)#if defined(CONFIG_ARCH_OMAP34XX )# undef cpu_is_omap3430 +# undef cpu_is_omap3503 +# undef cpu_is_omap3515 +# undef cpu_is_omap3525 +# undef cpu_is_omap3530# define cpu_is_omap3430 () is_omap3430() +# define cpu_is_omap3503 (cpu_is_omap3430() & \ + (!omap3_has_iva()) & \ + (!omap3_has_sgx())) +# define cpu_is_omap3515 (cpu_is_omap3430() & \ + (omap3_has_iva()) & \ + (!omap3_has_sgx())) +# define cpu_is_omap3525 (cpu_is_omap3430() & \ + (omap3_has_sgx()) & \ + (!omap3_has_iva())) +# define cpu_is_omap3530 (cpu_is_omap3430())#endif # if defined(CONFIG_ARCH_OMAP4 )
@@ -391,6 +410,12 @@ IS_OMAP_TYPE(3430, 0x3430)#define OMAP3430_REV_ES3_0 0x34303034#define OMAP3430_REV_ES3_1 0x34304034 +#define OMAP35XX_CLASS 0x35000034 +#define OMAP3503_REV (v) (OMAP35XX_CLASS | (0x3503 << 16) | (v << 12)) +#define OMAP3515_REV (v) (OMAP35XX_CLASS | (0x3515 << 16) | (v << 12)) +#define OMAP3525_REV (v) (OMAP35XX_CLASS | (0x3525 << 16) | (v << 12)) +#define OMAP3530_REV (v) (OMAP35XX_CLASS | (0x3530 << 16) | (v << 12)) +#define OMAP443X_CLASS 0x44300034/*
Signature · 1 line
1.6.2.2
Quoted 14 lines
-----Original Message-----
From: Premi, Sanjeev
Sent: Tuesday, August 18, 2009 9:46 PM
To: [email protected]
Cc: Premi, Sanjeev
Subject: [PATCH] Runtime detection of OMAP35x devicesAdd runtime check for these OMAP35x variations
based on the detected Si features:
OMAP3503, OMAP3515, OMAP3525 and OMA3530.Also, delayed the call to
pr_info()into actual
variant is detected inomap3_cpuinfo()
Quoted 7 lines
Signed-off-by Sanjeev Premi <[email protected]>--- arch/arm/mach-omap2/id.c | 59 +++++++++++++++++++++++++++----- arch/arm/plat-omap/include/mach/cpu.h | 25 ++++++++++++++ 2 files changed, 74 insertions(+), 10 deletions(-)
<snip>--<snip>
...and this one as well.
Best regards,
Sanjeev
Tony Lindgren
maintainerQuoted 26 lines · Sanjeev Premi
Add runtime check for these OMAP35x variations
based on the detected Si features:
OMAP3503, OMAP3515, OMAP3525 and OMA3530.Also, delayed the call to
pr_info()into actual
variant is detected inomap3_cpuinfo()Signed-off-by Sanjeev Premi <[email protected]>--- arch/arm/mach-omap2/id.c | 59 +++++++++++++++++++++++++++----- arch/arm/plat-omap/include/mach/cpu.h | 25 ++++++++++++++ 2 files changed, 74 insertions(+), 10 deletions(-)arch/arm/mach-omap2/id.c +0
-1@@ -187,7 +187,6 @@ void __init omap3_check_revision(void)u32 cpuid, idcode;u16 hawkeye;u8 rev; -char *rev_name ="ES1.0" ;/* * We cannot access revision registers on ES1.0.
arch/arm/mach-omap2/id.c void __init omap3_check_revision(void) · line 202
Quoted 8 lines
arch/arm/mach-omap2/id.c +1
-1@@ -197,7 +196,7 @@ void __init omap3_check_revision(void) cpuid =read_cpuid (CPUID_ID );if ((((cpuid >>4 ) &0xfff ) ==0xc08 ) && ((cpuid &0xf ) ==0x0 )) { omap_revision =OMAP3430_REV_ES1_0 ; - goto out; +return ; }/*
Looks like the above two changes break printing the ES1.0 rev name during the boot.
Quoted 48 lines
arch/arm/mach-omap2/id.c +14
-8@@ -214,29 +213,21 @@ void __init omap3_check_revision(void)switch (rev) {case 0 : omap_revision =OMAP3430_REV_ES2_0 ; - rev_name ="ES2.0" ;break ;case 2 : omap_revision =OMAP3430_REV_ES2_1 ; - rev_name ="ES2.1" ;break ;case 3 : omap_revision =OMAP3430_REV_ES3_0 ; - rev_name ="ES3.0" ;break ;case 4 : omap_revision =OMAP3430_REV_ES3_1 ; - rev_name ="ES3.1" ;break ;default :/* Use the latest known revision as default */ omap_revision =OMAP3430_REV_ES3_1 ; - rev_name ="Unknown revision\n" ; } } - -out: -pr_info ("OMAP%04x %s\n" ,omap_rev () >>16 , rev_name); }#define OMAP3_SHOW_FEATURE (feat) \@@ -248,6 +239,54 @@ out:void __init omap3_cpuinfo (void ) { +u8 rev =GET_OMAP_REVISION (); +char cpu_name[16 ], cpu_rev[16 ]; + +/* OMAP3430 and OMAP3530 are assumed to be same. +* +* OMAP3525, OMAP3515 and OMAP3503 can be detected only based +* on available features. Upon detection, update the CPU id +* and CPU class bits. +*/ +if (omap3_has_iva () &&omap3_has_sgx ()) { +strcpy (cpu_name,"3430/3530" ); + } +else if (omap3_has_sgx ()) { + omap_revision =OMAP3525_REV (rev);
arch/arm/mach-omap2/id.c out: · line 265
Quoted 10 lines
arch/arm/mach-omap2/id.c +10
-0+strcpy (cpu_name,"3525" ); + } +else if (omap3_has_iva ()) { + omap_revision =OMAP3515_REV (rev); +strcpy (cpu_name,"3515" ); + } +else { + omap_revision =OMAP3503_REV (rev); +strcpy (cpu_name,"3503" ); + }
Please remove the spaces in the *_REV(rev) macro calls above.
Quoted 8 lines
arch/arm/mach-omap2/id.c +8
-0+ +switch (rev) { +case 0x10 : +strcpy (cpu_rev,"2.0" ); +break ; +case 0x20 : +strcpy (cpu_rev,"2.1" ); +break ;
arch/arm/mach-omap2/id.c out: · line 283
Quoted 10 lines
arch/arm/mach-omap2/id.c +10
-0+case 0x30 : +strcpy (cpu_rev,"3.0" ); +break ; +case 0x40 : +strcpy (cpu_rev,"3.1" ); +break ; +default : +/* Use the latest known revision as default */ +strcpy (cpu_rev,"3.1" ); + }
I believe the above should use the defines to avoid thing breaking if renumbering the defines?
case 0x10 should be case CHIP_IS_OMAP3430ES2
case 0x20 should be case CHIP_IS_OMAP3430ES3
...
But instead you're renaming the defined ES values so what we have defined is different from your naming?
Can you please check that, and also boot on various boards to confirm. I suspect the TI documentation is messed up for the ES numbering..
Other than that, let's plan on merging this too after 2.6.32-rc1.
Regards,
Tony
Quoted 67 lines
arch/arm/mach-omap2/id.c +6
-0+ +/* +* Print verbose information +*/ +pr_info ("OMAP%s ES%s\n" , cpu_name, cpu_rev); +OMAP3_SHOW_FEATURE (l2cache);OMAP3_SHOW_FEATURE (iva);OMAP3_SHOW_FEATURE (sgx);arch/arm/plat-omap/include/mach/cpu.h +25
-0@@ -57,6 +57,11 @@ struct omap_chip_id {unsigned int omap_rev (void );/* +* Get the CPU revision for OMAP devices +*/ +#define GET_OMAP_REVISION () ((omap_rev() >> 8) & 0xff) + +/* * Test if multicore OMAP support is needed */ #undef MULTI_OMAP1@@ -360,7 +365,21 @@ IS_OMAP_TYPE(3430, 0x3430)#if defined(CONFIG_ARCH_OMAP34XX )# undef cpu_is_omap3430 +# undef cpu_is_omap3503 +# undef cpu_is_omap3515 +# undef cpu_is_omap3525 +# undef cpu_is_omap3530# define cpu_is_omap3430 () is_omap3430() +# define cpu_is_omap3503 (cpu_is_omap3430() & \ + (!omap3_has_iva()) & \ + (!omap3_has_sgx())) +# define cpu_is_omap3515 (cpu_is_omap3430() & \ + (omap3_has_iva()) & \ + (!omap3_has_sgx())) +# define cpu_is_omap3525 (cpu_is_omap3430() & \ + (omap3_has_sgx()) & \ + (!omap3_has_iva())) +# define cpu_is_omap3530 (cpu_is_omap3430())#endif # if defined(CONFIG_ARCH_OMAP4 )@@ -391,6 +410,12 @@ IS_OMAP_TYPE(3430, 0x3430)#define OMAP3430_REV_ES3_0 0x34303034#define OMAP3430_REV_ES3_1 0x34304034 +#define OMAP35XX_CLASS 0x35000034 +#define OMAP3503_REV (v) (OMAP35XX_CLASS | (0x3503 << 16) | (v << 12)) +#define OMAP3515_REV (v) (OMAP35XX_CLASS | (0x3515 << 16) | (v << 12)) +#define OMAP3525_REV (v) (OMAP35XX_CLASS | (0x3525 << 16) | (v << 12)) +#define OMAP3530_REV (v) (OMAP35XX_CLASS | (0x3530 << 16) | (v << 12)) +#define OMAP443X_CLASS 0x44300034/* Signature · 6 lines
1.6.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 7 lines
-----Original Message-----
From: Tony Lindgren [mailto:[email protected]]
Sent: Wednesday, September 23, 2009 1:59 AM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH] Runtime detection of OMAP35x devices
[snip]---[snip]---[snip]
Quoted 21 lines
Quoted 13 lines
arch/arm/mach-omap2/id.c +0
-1@@ -187,7 +187,6 @@ void __init omap3_check_revision(void)u32 cpuid, idcode;u16 hawkeye;u8 rev; -char *rev_name ="ES1.0" ;/* * We cannot access revision registers on ES1.0. arch/arm/mach-omap2/id.c void __init omap3_check_revision(void) · line 197
Quoted 2 lines
arch/arm/mach-omap2/id.c +0
-0@@ -197,7 +196,7 @@ void __init omap3_check_revision(void) cpuid =read_cpuid (CPUID_ID ); if ((((cpuid >> 4) & 0xfff) == 0xc08) && ((cpuid & 0xf)==
0x0)) {Quoted 5 lines
arch/arm/mach-omap2/id.c +1
-1omap_revision =OMAP3430_REV_ES1_0 ; - goto out; +return ; }
Quoted 5 lines
arch/arm/mach-omap2/id.c void __init omap3_check_revision(void) · line 202
Quoted 1 line
arch/arm/mach-omap2/id.c +0
-0/* Looks like the above two changes break printing the ES1.0 rev name during the boot.
[sp] This change did not break the printing of ES1.0 as it relates
to postponing the print. However, I see that ES1.0 was not being printed. (see below).
Submitting a fresh patch with the fix.
Quoted 18 lines
Quoted 18 lines
arch/arm/mach-omap2/id.c +0
-3@@ -214,29 +213,21 @@ void __init omap3_check_revision(void)switch (rev) {case 0 : omap_revision =OMAP3430_REV_ES2_0 ; - rev_name ="ES2.0" ;break ;case 2 : omap_revision =OMAP3430_REV_ES2_1 ; - rev_name ="ES2.1" ;break ;case 3 : omap_revision =OMAP3430_REV_ES3_0 ; - rev_name ="ES3.0" ;break ;case 4 : omap_revision =OMAP3430_REV_ES3_1 ;
Quoted 8 lines
arch/arm/mach-omap2/id.c void __init omap3_check_revision(void) · line 230
Quoted 8 lines
arch/arm/mach-omap2/id.c +0
-2- rev_name ="ES3.1" ;break ;default :/* Use the latest known revision as default */ omap_revision =OMAP3430_REV_ES3_1 ; - rev_name ="Unknown revision\n" ; } }
[sp] Here the print for ES1.0 was missing.
Quoted 28 lines
Quoted 28 lines
arch/arm/mach-omap2/id.c +18
-3- -out: -pr_info ("OMAP%04x %s\n" ,omap_rev () >>16 , rev_name); }#define OMAP3_SHOW_FEATURE (feat) \@@ -248,6 +239,54 @@ out:void __init omap3_cpuinfo (void ) { +u8 rev =GET_OMAP_REVISION (); +char cpu_name[16 ], cpu_rev[16 ]; + +/* OMAP3430 and OMAP3530 are assumed to be same. +* +* OMAP3525, OMAP3515 and OMAP3503 can be detected only based +* on available features. Upon detection, update the CPU id +* and CPU class bits. +*/ +if (omap3_has_iva () &&omap3_has_sgx ()) { +strcpy (cpu_name,"3430/3530" ); + } +else if (omap3_has_sgx ()) { + omap_revision =OMAP3525_REV (rev); +strcpy (cpu_name,"3525" ); + } +else if (omap3_has_iva ()) { + omap_revision =OMAP3515_REV (rev);
Quoted 8 lines
arch/arm/mach-omap2/id.c out: · line 265
Quoted 6 lines
arch/arm/mach-omap2/id.c +6
-0+strcpy (cpu_name,"3515" ); + } +else { + omap_revision =OMAP3503_REV (rev); +strcpy (cpu_name,"3503" ); + }Please remove the spaces in the
*_REV(rev)macro calls above.
[sp] Will take care in follow-up patch.
Quoted 24 lines
Quoted 10 lines
arch/arm/mach-omap2/id.c +8
-0+ +switch (rev) { +case 0x10 : +strcpy (cpu_rev,"2.0" ); +break ; +case 0x20 : +strcpy (cpu_rev,"2.1" ); +break ;arch/arm/mach-omap2/id.c out: · line 283
Quoted 10 lines
arch/arm/mach-omap2/id.c +10
-0+case 0x30 : +strcpy (cpu_rev,"3.0" ); +break ; +case 0x40 : +strcpy (cpu_rev,"3.1" ); +break ; +default : +/* Use the latest known revision as default */ +strcpy (cpu_rev,"3.1" ); + }I believe the above should use the defines to avoid thing breaking if renumbering the defines?
Quoted 6 lines
case
0x10should be caseCHIP_IS_OMAP3430ES2
case0x20should be caseCHIP_IS_OMAP3430ES3
...But instead you're renaming the defined ES values so what we have defined is different from your naming?
[sp] The intent is to use omap_revision bits 15:8 alone.
If the concern was use of explicit values, I can use #defines instead.
Quoted 4 lines
Can you please check that, and also boot on various boards to confirm. I suspect the TI documentation is messed up for the ES numbering..
[sp] I do not have and ES 1.0 board. Other that that, I have
tested on all ES revisions. And found it to be workig fine. Will do the test again before submitting the follow-up.
Quoted 9 lines
Other than that, let's plan on merging this too after 2.6.32-rc1.
Regards,
Tony
Best regards,
Sanjeev
[snip]---[snip]---[snip]