AM35xx: Runtime detection of the device
Subsystems (3)
PATCH 1/2 AM35xx: Runtime detection of the device
Add support to detect AM3505/AM3517 devices at runtime. Also updates the CPU names printed during boot.
--- arch/arm/mach-omap2/id.c | 43 ++++++++++++++++++++++++++++---- arch/arm/plat-omap/include/plat/cpu.h | 12 +++++++++ 2 files changed, 49 insertions(+), 6 deletions(-)
arch/arm/mach-omap2/id.c +37 -6
@@ -242,6 +242,21 @@ void __init omap3_check_revision(void) omap_revision =OMAP3630_REV_ES1_0 ; }break ; +case 0xb868 : +/* Handle OMAP35xx/AM35xx devices +* +* Set the device to be OMAP3517 here. Actual device +* is identified later based on the features. +*/ +switch (rev) { +case 0 : + omap_revision =OMAP3505_REV (rev); +break ; +default : +/* Use the latest known revision as default */ + omap_revision =OMAP3505_REV (rev); + } +break ;default :/* Unknown default to latest silicon rev as default*/ omap_revision =OMAP3630_REV_ES1_0 ;
@@ -267,20 +282,36 @@ void __init omap3_cpuinfo(void)* and CPU class bits. */ if (cpu_is_omap3630 ()) -strcpy (cpu_name,"3630" ); +strcpy (cpu_name,"OMAP3630" ); +else if (omap_rev () &&OMAP35XX_CLASS ) { +/* +* AM3517, AM3505 devices +*/ +if (omap3_has_sgx ()) { + omap_revision =OMAP3517_REV (rev); +strcpy (cpu_name,"AM3517" ); + } +else { +/* Already set in omap3_check_revision() */ +strcpy (cpu_name,"AM3505" ); + } + } +/* +* OMAP3430, OMAP3525, OMAP3515, OMAP3503 devices +*/ else if (omap3_has_iva () &&omap3_has_sgx ()) -strcpy (cpu_name,"3430/3530" ); +strcpy (cpu_name,"OMAP3430/3530" );else if (omap3_has_sgx ()) { omap_revision =OMAP3525_REV (rev); -strcpy (cpu_name,"3525" ); +strcpy (cpu_name,"OMAP3525" ); }else if (omap3_has_iva ()) { omap_revision =OMAP3515_REV (rev); -strcpy (cpu_name,"3515" ); +strcpy (cpu_name,"OMAP3515" ); }else { omap_revision =OMAP3503_REV (rev); -strcpy (cpu_name,"3503" ); +strcpy (cpu_name,"OMAP3503" ); }switch (rev) {
@@ -307,7 +338,7 @@ void __init omap3_cpuinfo(void)/* * Print verbose information */ -pr_info ("OMAP%s ES%s\n" , cpu_name, cpu_rev); +pr_info ("%s ES%s\n" , cpu_name, cpu_rev);OMAP3_SHOW_FEATURE (l2cache);OMAP3_SHOW_FEATURE (iva);
arch/arm/plat-omap/include/plat/cpu.h +12 -0
@@ -284,6 +284,8 @@ IS_OMAP_SUBCLASS(363x, 0x363)* cpu_is_omap2423(): True for OMAP2423 * cpu_is_omap2430(): True for OMAP2430 * cpu_is_omap3430(): True for OMAP3430 +* cpu_is_omap3505(): True for OMAP3505 +* cpu_is_omap3517(): True for OMAP3517 */ #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)
@@ -307,6 +309,8 @@ IS_OMAP_TYPE(2422, 0x2422) IS_OMAP_TYPE(2423, 0x2423) IS_OMAP_TYPE(2430, 0x2430) IS_OMAP_TYPE(3430, 0x3430) +IS_OMAP_TYPE(3505, 0x3505) +IS_OMAP_TYPE(3517, 0x3517)#define cpu_is_omap310 () 0#define cpu_is_omap730 () 0
@@ -325,6 +329,8 @@ IS_OMAP_TYPE(3430, 0x3430)#define cpu_is_omap3515 () 0#define cpu_is_omap3525 () 0#define cpu_is_omap3530 () 0 +#define cpu_is_omap3505 () 0 +#define cpu_is_omap3517 () 0#define cpu_is_omap3430 () 0#define cpu_is_omap3630 () 0
@@ -380,6 +386,8 @@ IS_OMAP_TYPE(3430, 0x3430)# undef cpu_is_omap3515# undef cpu_is_omap3525# undef cpu_is_omap3530 +# undef cpu_is_omap3505 +# undef cpu_is_omap3517# define cpu_is_omap3430 () is_omap3430()# define cpu_is_omap3503 (cpu_is_omap3430() && \ (!omap3_has_iva()) && \
@@ -391,6 +399,8 @@ IS_OMAP_TYPE(3430, 0x3430) (omap3_has_sgx()) && \ (!omap3_has_iva()))# define cpu_is_omap3530 (cpu_is_omap3430()) +# define cpu_is_omap3505 is_omap3505() +# define cpu_is_omap3517 is_omap3517()# undef cpu_is_omap3630# define cpu_is_omap3630 () is_omap363x()#endif
@@ -430,6 +440,8 @@ IS_OMAP_TYPE(3430, 0x3430)#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 OMAP3505_REV (v) (OMAP35XX_CLASS | (0x3505 << 16) | (v << 12)) +#define OMAP3517_REV (v) (OMAP35XX_CLASS | (0x3517 << 16) | (v << 12))#define OMAP443X_CLASS 0x44300034
Signature · 1 line
1.6.2.2
Hi,
Quoted 20 lines · ext Sanjeev Premi
Add support to detect AM3505/AM3517 devices at runtime. Also updates the CPU names printed during boot.
Signed-off-by Sanjeev Premi <[email protected]>--- arch/arm/mach-omap2/id.c | 43 ++++++++++++++++++++++++++++---- arch/arm/plat-omap/include/plat/cpu.h | 12 +++++++++ 2 files changed, 49 insertions(+), 6 deletions(-)arch/arm/mach-omap2/id.c +3
-0@@ -242,6 +242,21 @@ void __init omap3_check_revision(void) omap_revision =OMAP3630_REV_ES1_0 ; }break ; +case 0xb868 : +/* Handle OMAP35xx/AM35xx devices +*
arch/arm/mach-omap2/id.c void __init omap3_check_revision(void) · line 257
Quoted 10 lines
arch/arm/mach-omap2/id.c +10
-0+* Set the device to be OMAP3517 here. Actual device +* is identified later based on the features. +*/ +switch (rev) { +case 0 : + omap_revision =OMAP3505_REV (rev); +break ; +default : +/* Use the latest known revision as default */ + omap_revision =OMAP3505_REV (rev);
if both are the same, what's the point of having this switch ?
Quoted 10 lines
arch/arm/mach-omap2/id.c +2
-1+ } +break ;default :/* Unknown default to latest silicon rev as default*/ omap_revision =OMAP3630_REV_ES1_0 ;@@ -267,20 +282,36 @@ void __init omap3_cpuinfo(void)* and CPU class bits. */ if (cpu_is_omap3630 ()) -strcpy (cpu_name,"3630" );
arch/arm/mach-omap2/id.c void __init omap3_cpuinfo(void) · line 294
Quoted 10 lines
arch/arm/mach-omap2/id.c +10
-0+strcpy (cpu_name,"OMAP3630" ); + else if (omap_rev() && OMAP35XX_CLASS) { +/* +* AM3517, AM3505 devices +*/ +if (omap3_has_sgx ()) { + omap_revision =OMAP3517_REV (rev); +strcpy (cpu_name,"AM3517" ); + } +else {
according to CodingStyle this should be:
} else {Signature · 1 line
balbi
Quoted 35 lines
-----Original Message-----
From: Felipe Balbi [mailto:[email protected]]
Sent: Tuesday, October 27, 2009 9:41 PM
To: Premi, Sanjeev
Cc: [email protected]
Subject: Re: [PATCH 1/2] AM35xx: Runtime detection of the deviceHi,
Quoted 6 lines · ext Sanjeev Premi
Add support to detect AM3505/AM3517 devices at runtime. Also updates the CPU names printed during boot.
Signed-off-by Sanjeev Premi <[email protected]>--- arch/arm/mach-omap2/id.c | 43++++++++++++++++++++++++++++----
Quoted 18 lines
arch/arm/plat-omap/include/plat/cpu.h | 12 +++++++++ 2 files changed, 49 insertions(+), 6 deletions(-)arch/arm/mach-omap2/id.c +7
-0@@ -242,6 +242,21 @@ void __init omap3_check_revision(void) omap_revision =OMAP3630_REV_ES1_0 ; }break ; +case 0xb868 : +/* Handle OMAP35xx/AM35xx devices +* +* Set the device to be OMAP3517 here. Actual device +* is identified later based on the features. +*/ +switch (rev) {
Quoted 8 lines
arch/arm/mach-omap2/id.c void __init omap3_check_revision(void) · line 257
Quoted 6 lines
arch/arm/mach-omap2/id.c +6
-0+case 0 : + omap_revision =OMAP3505_REV (rev); +break ; +default : +/* Use the latest known revision as default */ + omap_revision =OMAP3505_REV (rev);if both are the same, what's the point of having this switch ?
[sp] I was just following the style for 3630, while re-basing
this patch :(
Quoted 24 lines
Quoted 11 lines
arch/arm/mach-omap2/id.c +2
-1+ } +break ;default :/* Unknown default to latest silicon rev as default*/ omap_revision =OMAP3630_REV_ES1_0 ;@@ -267,20 +282,36 @@ void __init omap3_cpuinfo(void)* and CPU class bits. */ if (cpu_is_omap3630 ()) -strcpy (cpu_name,"3630" );arch/arm/mach-omap2/id.c void __init omap3_cpuinfo(void) · line 294
Quoted 10 lines
arch/arm/mach-omap2/id.c +10
-0+strcpy (cpu_name,"OMAP3630" ); + else if (omap_rev() && OMAP35XX_CLASS) { +/* +* AM3517, AM3505 devices +*/ +if (omap3_has_sgx ()) { + omap_revision =OMAP3517_REV (rev); +strcpy (cpu_name,"AM3517" ); + } +else {according to CodingStyle this should be:
Quoted 1 line
} else {[sp] Yes. Missed it.
Quoted 5 lines
Signature · 2 lines
-- balbi
Hi,
Quoted 24 lines · Sanjeev
Quoted 15 lines
Quoted 15 lines
arch/arm/mach-omap2/id.c +7
-0@@ -242,6 +242,21 @@ void __init omap3_check_revision(void) omap_revision =OMAP3630_REV_ES1_0 ; }break ; +case 0xb868 : +/* Handle OMAP35xx/AM35xx devices +* +* Set the device to be OMAP3517 here. Actual device +* is identified later based on the features. +*/ +switch (rev) {Quoted 8 lines
arch/arm/mach-omap2/id.c void __init omap3_check_revision(void) · line 257
Quoted 6 lines
arch/arm/mach-omap2/id.c +6
-0+case 0 : + omap_revision =OMAP3505_REV (rev); +break ; +default : +/* Use the latest known revision as default */ + omap_revision =OMAP3505_REV (rev);if both are the same, what's the point of having this switch ?
Quoted 2 lines
[sp] I was just following the style for 3630, while re-basing
this patch :(
I see, but that's clearly bogus (in a sense), then if you come up with another version of the chip, there will be two place to be fixed. Tony, what do you think about applying the following cleanup patch to id.c ?
From: Felipe Balbi <[email protected]>
Subject: [PATCH] arm: omap: code cleanup to id.c
Cleanup the coding style in id.c while avoiding unneeded switch() statements.
---
arch/arm/mach-omap2/id.c +16 -29
@@ -53,11 +53,11 @@ int omap_type(void) {u32 val =0 ; -if (cpu_is_omap24xx ()) +if (cpu_is_omap24xx ()) { val =omap_ctrl_readl (OMAP24XX_CONTROL_STATUS ); -else if (cpu_is_omap34xx ()) + }else if (cpu_is_omap34xx ()) { val =omap_ctrl_readl (OMAP343X_CONTROL_STATUS ); -else { + }else {pr_err ("Cannot detect omap type!\n" ); goto out; }
@@ -224,24 +224,14 @@ void __init omap3_check_revision(void) omap_revision =OMAP3430_REV_ES3_0 ;break ;case 4 : - omap_revision =OMAP3430_REV_ES3_1 ; -break ; +/* FALLTHROUGH */ default :/* Use the latest known revision as default */ omap_revision =OMAP3430_REV_ES3_1 ; }break ;case 0xb891 : -/* Handle 36xx devices */ -switch (rev) { -case 0 : - omap_revision =OMAP3630_REV_ES1_0 ; -break ; -default : -/* Use the latest known revision as default */ - omap_revision =OMAP3630_REV_ES1_0 ; - } -break ; +/* FALLTHROUGH */ default :/* Unknown default to latest silicon rev as default*/ omap_revision =OMAP3630_REV_ES1_0 ;
@@ -266,19 +256,17 @@ void __init omap3_cpuinfo(void)* on available features. Upon detection, update the CPU id * and CPU class bits. */ -if (cpu_is_omap3630 ()) +if (cpu_is_omap3630 ()) {strcpy (cpu_name,"3630" ); -else if (omap3_has_iva () &&omap3_has_sgx ()) + }else if (omap3_has_iva () &&omap3_has_sgx ()) {strcpy (cpu_name,"3430/3530" ); -else if (omap3_has_sgx ()) { + }else if (omap3_has_sgx ()) { omap_revision =OMAP3525_REV (rev);strcpy (cpu_name,"3525" ); - } -else if (omap3_has_iva ()) { + }else if (omap3_has_iva ()) { omap_revision =OMAP3515_REV (rev);strcpy (cpu_name,"3515" ); - } -else { + }else { omap_revision =OMAP3503_REV (rev);strcpy (cpu_name,"3503" ); }
@@ -297,8 +285,7 @@ void __init omap3_cpuinfo(void)strcpy (cpu_rev,"3.0" );break ;case OMAP_REVBITS_40 : -strcpy (cpu_rev,"3.1" ); -break ; +/* FALLTHROUGH */ default :/* Use the latest known revision as default */ strcpy (cpu_rev,"3.1" );
@@ -325,18 +312,18 @@ void __init omap2_check_revision(void)* At this point we have an idea about the processor revision set * earlier with omap2_set_globals_tap(). */ -if (cpu_is_omap24xx ()) +if (cpu_is_omap24xx ()) {omap24xx_check_revision (); -else if (cpu_is_omap34xx ()) { + }else if (cpu_is_omap34xx ()) {omap3_check_features ();omap3_check_revision ();omap3_cpuinfo (); - } -else if (cpu_is_omap44xx ()) { + }else if (cpu_is_omap44xx ()) {printk (KERN_INFO "FIXME: CPU revision = OMAP4430\n" );return ; - }else + }else {pr_err ("OMAP revision unknown, please fix!\n" ); + }/* * OK, now we know the exact revision. Initialize omap_chip bits
Signature · 1 line
balbi
Quoted 90 lines
-----Original Message-----
From: Felipe Balbi [mailto:[email protected]]
Sent: Wednesday, October 28, 2009 2:39 AM
To: Premi, Sanjeev
Cc: Balbi Felipe (Nokia-D/Helsinki); [email protected]; [email protected]
Subject: Re: [PATCH 1/2] AM35xx: Runtime detection of the deviceHi,
Quoted 4 lines · Sanjeev
Quoted 4 lines
Quoted 4 lines
arch/arm/mach-omap2/id.c +0
-0Quoted 8 lines
Quoted 8 lines
arch/arm/mach-omap2/id.c void __init omap3_check_revision(void) · line 248
Quoted 8 lines
arch/arm/mach-omap2/id.c +4
-0@@ -242,6 +242,21 @@ void __init omap3_check_revision(void) omap_revision =OMAP3630_REV_ES1_0 ; }break ; +case 0xb868 : +/* Handle OMAP35xx/AM35xx devices +* +* Set the device to be OMAP3517 here. Actual device
Quoted 8 lines
Quoted 8 lines
arch/arm/mach-omap2/id.c void __init omap3_check_revision(void) · line 256
Quoted 8 lines
arch/arm/mach-omap2/id.c +8
-0+* is identified later based on the features. +*/ +switch (rev) { +case 0 : + omap_revision =OMAP3505_REV (rev); +break ; +default : +/* Use the latest known revision as default */
Quoted 6 lines
Quoted 3 lines
arch/arm/mach-omap2/id.c void __init omap3_check_revision(void) · line 257
Quoted 1 line
arch/arm/mach-omap2/id.c +1
-0+ omap_revision =OMAP3505_REV (rev);if both are the same, what's the point of having this switch ?
[sp] I was just following the style for 3630, while re-basing
this patch :(I see, but that's clearly bogus (in a sense), then if you come up with another version of the chip, there will be two place to be fixed. Tony,
what do you think about applying the following cleanup patch toid.c?From: Felipe Balbi <[email protected]>
Subject: [PATCH] arm: omap: code cleanup toid.cCleanup the coding style in
id.cwhile avoiding unneededswitch()statements.Signed-off-by Felipe Balbi <[email protected]>---
arch/arm/mach-omap2/id.c +4
-9@@ -53,11 +53,11 @@ int omap_type(void) {u32 val =0 ; -if (cpu_is_omap24xx ()) +if (cpu_is_omap24xx ()) { val =omap_ctrl_readl (OMAP24XX_CONTROL_STATUS ); -else if (cpu_is_omap34xx ()) + }else if (cpu_is_omap34xx ()) { val =omap_ctrl_readl (OMAP343X_CONTROL_STATUS ); -else { + }else {pr_err ("Cannot detect omap type!\n" ); goto out; }@@ -224,24 +224,14 @@ void __init omap3_check_revision(void) omap_revision =OMAP3430_REV_ES3_0 ;break ;case 4 : - omap_revision =OMAP3430_REV_ES3_1 ; -break ; +/* FALLTHROUGH */ default :/* Use the latest known revision as default */ omap_revision =OMAP3430_REV_ES3_1 ; }break ;case 0xb891 : -/* Handle 36xx devices */ -switch (rev) { -case 0 : - omap_revision =OMAP3630_REV_ES1_0 ;
arch/arm/mach-omap2/id.c void __init omap3_check_revision(void) · line 237
Quoted 10 lines
arch/arm/mach-omap2/id.c +1
-6-break ; -default : -/* Use the latest known revision as default */ - omap_revision =OMAP3630_REV_ES1_0 ; - } -break ; +/* FALLTHROUGH */ default :/* Unknown default to latest silicon rev as default*/ omap_revision =OMAP3630_REV_ES1_0 ;
[sp] Haven't applied the patch. But, if FALLTHROUGH will make the device
detected as OMAP3630, then it may not be right. The fall through should be on most common device. OMAP3430 ES21./3.1 should be ideal.
Thoughts?
~sanjeev
Quoted 65 lines
arch/arm/mach-omap2/id.c +6
-9@@ -266,19 +256,17 @@ void __init omap3_cpuinfo(void)* on available features. Upon detection, update the CPU id * and CPU class bits. */ -if (cpu_is_omap3630 ()) +if (cpu_is_omap3630 ()) {strcpy (cpu_name,"3630" ); -else if (omap3_has_iva () &&omap3_has_sgx ()) + }else if (omap3_has_iva () &&omap3_has_sgx ()) {strcpy (cpu_name,"3430/3530" ); -else if (omap3_has_sgx ()) { + }else if (omap3_has_sgx ()) { omap_revision =OMAP3525_REV (rev);strcpy (cpu_name,"3525" ); - } -else if (omap3_has_iva ()) { + }else if (omap3_has_iva ()) { omap_revision =OMAP3515_REV (rev);strcpy (cpu_name,"3515" ); - } -else { + }else { omap_revision =OMAP3503_REV (rev);strcpy (cpu_name,"3503" ); }@@ -297,8 +285,7 @@ void __init omap3_cpuinfo(void)strcpy (cpu_rev,"3.0" );break ;case OMAP_REVBITS_40 : -strcpy (cpu_rev,"3.1" ); -break ; +/* FALLTHROUGH */ default :/* Use the latest known revision as default */ strcpy (cpu_rev,"3.1" );@@ -325,18 +312,18 @@ void __init omap2_check_revision(void)* At this point we have an idea about the processor revision set
arch/arm/mach-omap2/id.c +5
-5* earlier with omap2_set_globals_tap(). */ -if (cpu_is_omap24xx ()) +if (cpu_is_omap24xx ()) {omap24xx_check_revision (); -else if (cpu_is_omap34xx ()) { + }else if (cpu_is_omap34xx ()) {omap3_check_features ();omap3_check_revision ();omap3_cpuinfo (); - } -else if (cpu_is_omap44xx ()) { + }else if (cpu_is_omap44xx ()) {printk (KERN_INFO "FIXME: CPU revision = OMAP4430\n" );return ; - }else + }else {pr_err ("OMAP revision unknown, please fix!\n" ); + }/* * OK, now we know the exact revision. Initialize omap_chip bits Signature · 2 lines
-- balbi
Quoted 9 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Premi, Sanjeev
Sent: Wednesday, October 28, 2009 6:10 PM
To: [email protected]
Cc: [email protected]; [email protected]
Subject: RE: [PATCH 1/2] AM35xx: Runtime detection of the device
[snip]--[snip]
Quoted 9 lines
Quoted 9 lines
From: Felipe Balbi <[email protected]>
Subject: [PATCH] arm: omap: code cleanup toid.cCleanup the coding style in
id.cwhile avoiding unneededswitch()statements.Signed-off-by Felipe Balbi <[email protected]>---
Felipe,
I wasn't sure of Tony's sequencing; so submitted a patch against current code to unblock some follow-up patches.
Won't mind making a v3 if your patch moves up the sequence.
~sanjeev
[snip]--[snip]
Hi,
Quoted 20 lines · Sanjeev
Quoted 5 lines
arch/arm/mach-omap2/id.c +0
-4case 0xb891 : -/* Handle 36xx devices */ -switch (rev) { -case 0 : - omap_revision =OMAP3630_REV_ES1_0 ;arch/arm/mach-omap2/id.c void __init omap3_check_revision(void) · line 237
Quoted 10 lines
arch/arm/mach-omap2/id.c +1
-6-break ; -default : -/* Use the latest known revision as default */ - omap_revision =OMAP3630_REV_ES1_0 ; - } -break ; +/* FALLTHROUGH */ default :/* Unknown default to latest silicon rev as default*/ omap_revision =OMAP3630_REV_ES1_0 ;[sp] Haven't applied the patch. But, if FALLTHROUGH will make the device
detected as OMAP3630, then it may not be right. The fall through should be on most common device. OMAP3430 ES21./3.1 should be ideal.
Quoted 1 line
Thoughts?
see that I didn't change the default clause. It was already OMAP3630_REV_ES1_0. If it has to be anything else, the default should be changed and the case 0xb891: should do:
case 0xb891:
omap_revision = OMAP3630_REV_ES1_0; break;
Signature · 1 line
balbi
Quoted 34 lines
-----Original Message-----
From: Felipe Balbi [mailto:[email protected]]
Sent: Wednesday, October 28, 2009 10:29 PM
To: Premi, Sanjeev
Cc: Balbi Felipe (Nokia-D/Helsinki); [email protected]; [email protected]
Subject: Re: [PATCH 1/2] AM35xx: Runtime detection of the deviceHi,
Quoted 9 lines · Sanjeev
Quoted 9 lines
arch/arm/mach-omap2/id.c +0
-8case 0xb891 : -/* Handle 36xx devices */ -switch (rev) { -case 0 : - omap_revision =OMAP3630_REV_ES1_0 ; -break ; -default : -/* Use the latest known revision as default */ - omap_revision =OMAP3630_REV_ES1_0 ;Quoted 8 lines
arch/arm/mach-omap2/id.c void __init omap3_check_revision(void) · line 237
Quoted 6 lines
arch/arm/mach-omap2/id.c +1
-2- } -break ; +/* FALLTHROUGH */ default :/* Unknown default to latest silicon rev as default*/ omap_revision =OMAP3630_REV_ES1_0 ;[sp] Haven't applied the patch. But, if FALLTHROUGH will
make the device
Quoted 1 line
detected as OMAP3630, then it may not be right. The
fall through
Quoted 1 line
should be on most common device. OMAP3430 ES21./3.1
Quoted 8 lines
should be ideal.
Quoted 2 lines
Thoughts?
see that I didn't change the default clause. It was already
OMAP3630_REV_ES1_0. If it has to be anything else, the default should be
changed and the case0xb891: should do:
I did see that. But since you were already proposing a change thought it would be good idea.
~sanjeev
Quoted 9 lines
case
0xb891:omap_revision = OMAP3630_REV_ES1_0; break;Signature · 1 line
balbi
Hi,
Quoted 26 lines · Sanjeev
Quoted 26 lines · Sanjeev
Quoted 9 lines
Quoted 9 lines
arch/arm/mach-omap2/id.c +0
-8case 0xb891 : -/* Handle 36xx devices */ -switch (rev) { -case 0 : - omap_revision =OMAP3630_REV_ES1_0 ; -break ; -default : -/* Use the latest known revision as default */ - omap_revision =OMAP3630_REV_ES1_0 ;Quoted 8 lines
arch/arm/mach-omap2/id.c void __init omap3_check_revision(void) · line 237
Quoted 6 lines
arch/arm/mach-omap2/id.c +1
-2- } -break ; +/* FALLTHROUGH */ default :/* Unknown default to latest silicon rev as default*/ omap_revision =OMAP3630_REV_ES1_0 ;[sp] Haven't applied the patch. But, if FALLTHROUGH will
make the device
Quoted 1 line
detected as OMAP3630, then it may not be right. The
fall through
Quoted 1 line
should be on most common device. OMAP3430 ES21./3.1
should be ideal.
Quoted 2 lines
Thoughts?
Quoted 7 lines
Quoted 4 lines
see that I didn't change the default clause. It was already
OMAP3630_REV_ES1_0. If it has to be anything else, the default should be
changed and the case0xb891: should do:I did see that. But since you were already proposing a change thought it would be good idea.
if Tony says it's ok, I can change the patch, for sure :-)
but I believe he will want that as a separate patch for bisectability.
Signature · 1 line
balbi
Hi,
Quoted 104 lines · Balbi Felipe (Nokia-D/Helsinki)
From: Felipe Balbi <[email protected]>
Subject: [PATCH] arm: omap: code cleanup toid.cCleanup the coding style in
id.cwhile avoiding unneededswitch()statements.Signed-off-by Felipe Balbi <[email protected]>---
arch/arm/mach-omap2/id.c +13
-28@@ -53,11 +53,11 @@ int omap_type(void) {u32 val =0 ; -if (cpu_is_omap24xx ()) +if (cpu_is_omap24xx ()) { val =omap_ctrl_readl (OMAP24XX_CONTROL_STATUS ); -else if (cpu_is_omap34xx ()) + }else if (cpu_is_omap34xx ()) { val =omap_ctrl_readl (OMAP343X_CONTROL_STATUS ); -else { + }else {pr_err ("Cannot detect omap type!\n" ); goto out; }@@ -224,24 +224,14 @@ void __init omap3_check_revision(void) omap_revision =OMAP3430_REV_ES3_0 ;break ;case 4 : - omap_revision =OMAP3430_REV_ES3_1 ; -break ; +/* FALLTHROUGH */ default :/* Use the latest known revision as default */ omap_revision =OMAP3430_REV_ES3_1 ; }break ;case 0xb891 : -/* Handle 36xx devices */ -switch (rev) { -case 0 : - omap_revision =OMAP3630_REV_ES1_0 ; -break ; -default : -/* Use the latest known revision as default */ - omap_revision =OMAP3630_REV_ES1_0 ; - } -break ; +/* FALLTHROUGH */ default :/* Unknown default to latest silicon rev as default*/ omap_revision =OMAP3630_REV_ES1_0 ;@@ -266,19 +256,17 @@ void __init omap3_cpuinfo(void)* on available features. Upon detection, update the CPU id * and CPU class bits. */ -if (cpu_is_omap3630 ()) +if (cpu_is_omap3630 ()) {strcpy (cpu_name,"3630" ); -else if (omap3_has_iva () &&omap3_has_sgx ()) + }else if (omap3_has_iva () &&omap3_has_sgx ()) {strcpy (cpu_name,"3430/3530" ); -else if (omap3_has_sgx ()) { + }else if (omap3_has_sgx ()) { omap_revision =OMAP3525_REV (rev);strcpy (cpu_name,"3525" ); - } -else if (omap3_has_iva ()) { + }else if (omap3_has_iva ()) { omap_revision =OMAP3515_REV (rev);strcpy (cpu_name,"3515" ); - } -else { + }else { omap_revision =OMAP3503_REV (rev);strcpy (cpu_name,"3503" ); }@@ -297,8 +285,7 @@ void __init omap3_cpuinfo(void)strcpy (cpu_rev,"3.0" );break ;case OMAP_REVBITS_40 : -strcpy (cpu_rev,"3.1" ); -break ; +/* FALLTHROUGH */ default :/* Use the latest known revision as default */ strcpy (cpu_rev,"3.1" );@@ -325,18 +312,18 @@ void __init omap2_check_revision(void)* At this point we have an idea about the processor revision set * earlier with omap2_set_globals_tap(). */ -if (cpu_is_omap24xx ()) +if (cpu_is_omap24xx ()) {omap24xx_check_revision (); -else if (cpu_is_omap34xx ()) { + }else if (cpu_is_omap34xx ()) {omap3_check_features ();omap3_check_revision ();omap3_cpuinfo (); - } -else if (cpu_is_omap44xx ()) {
arch/arm/mach-omap2/id.c void __init omap2_check_revision(void) · line 329
Quoted 10 lines
arch/arm/mach-omap2/id.c +3
-1+ }else if (cpu_is_omap44xx ()) {printk (KERN_INFO "FIXME: CPU revision = OMAP4430\n" );return ; - }else + }else {pr_err ("OMAP revision unknown, please fix!\n" ); + }/* * OK, now we know the exact revision. Initialize omap_chip bits
how about this patch, any comments ??
Signature · 1 line
balbi
Tony Lindgren
maintainerQuoted 115 lines · Felipe Balbi
Hi,
Quoted 112 lines · Balbi Felipe (Nokia-D/Helsinki)
From: Felipe Balbi <[email protected]>
Subject: [PATCH] arm: omap: code cleanup toid.cCleanup the coding style in
id.cwhile avoiding unneededswitch()statements.Signed-off-by Felipe Balbi <[email protected]>---
arch/arm/mach-omap2/id.c +16
-29@@ -53,11 +53,11 @@ int omap_type(void) {u32 val =0 ; -if (cpu_is_omap24xx ()) +if (cpu_is_omap24xx ()) { val =omap_ctrl_readl (OMAP24XX_CONTROL_STATUS ); -else if (cpu_is_omap34xx ()) + }else if (cpu_is_omap34xx ()) { val =omap_ctrl_readl (OMAP343X_CONTROL_STATUS ); -else { + }else {pr_err ("Cannot detect omap type!\n" ); goto out; }@@ -224,24 +224,14 @@ void __init omap3_check_revision(void) omap_revision =OMAP3430_REV_ES3_0 ;break ;case 4 : - omap_revision =OMAP3430_REV_ES3_1 ; -break ; +/* FALLTHROUGH */ default :/* Use the latest known revision as default */ omap_revision =OMAP3430_REV_ES3_1 ; }break ;case 0xb891 : -/* Handle 36xx devices */ -switch (rev) { -case 0 : - omap_revision =OMAP3630_REV_ES1_0 ; -break ; -default : -/* Use the latest known revision as default */ - omap_revision =OMAP3630_REV_ES1_0 ; - } -break ; +/* FALLTHROUGH */ default :/* Unknown default to latest silicon rev as default*/ omap_revision =OMAP3630_REV_ES1_0 ;@@ -266,19 +256,17 @@ void __init omap3_cpuinfo(void)* on available features. Upon detection, update the CPU id * and CPU class bits. */ -if (cpu_is_omap3630 ()) +if (cpu_is_omap3630 ()) {strcpy (cpu_name,"3630" ); -else if (omap3_has_iva () &&omap3_has_sgx ()) + }else if (omap3_has_iva () &&omap3_has_sgx ()) {strcpy (cpu_name,"3430/3530" ); -else if (omap3_has_sgx ()) { + }else if (omap3_has_sgx ()) { omap_revision =OMAP3525_REV (rev);strcpy (cpu_name,"3525" ); - } -else if (omap3_has_iva ()) { + }else if (omap3_has_iva ()) { omap_revision =OMAP3515_REV (rev);strcpy (cpu_name,"3515" ); - } -else { + }else { omap_revision =OMAP3503_REV (rev);strcpy (cpu_name,"3503" ); }@@ -297,8 +285,7 @@ void __init omap3_cpuinfo(void)strcpy (cpu_rev,"3.0" );break ;case OMAP_REVBITS_40 : -strcpy (cpu_rev,"3.1" ); -break ; +/* FALLTHROUGH */ default :/* Use the latest known revision as default */ strcpy (cpu_rev,"3.1" );@@ -325,18 +312,18 @@ void __init omap2_check_revision(void)* At this point we have an idea about the processor revision set * earlier with omap2_set_globals_tap(). */ -if (cpu_is_omap24xx ()) +if (cpu_is_omap24xx ()) {omap24xx_check_revision (); -else if (cpu_is_omap34xx ()) { + }else if (cpu_is_omap34xx ()) {omap3_check_features ();omap3_check_revision ();omap3_cpuinfo (); - } -else if (cpu_is_omap44xx ()) { + }else if (cpu_is_omap44xx ()) {printk (KERN_INFO "FIXME: CPU revision = OMAP4430\n" );return ; - }else + }else {pr_err ("OMAP revision unknown, please fix!\n" ); + }
Quoted 4 lines
arch/arm/mach-omap2/id.c void __init omap2_check_revision(void) · line 329
Quoted 2 lines
arch/arm/mach-omap2/id.c +0
-0/* * OK, now we know the exact revision. Initialize omap_chip bits how about this patch, any comments ??
Just pushed all kinds of CPU detection patches. Can you please check and refresh as needed?
Would like to see acks on this patch to make sure it's tested on various processors before we apply it.
Tony
PATCH 1/1 arm: omap: code cleanup to id.c
Cleanup the coding style in id.c while avoiding unneeded switch() statements.
---
refreshed on top of Today's linux-omap (0aaf4859f62d2ead2dd949646d12b0216439facd)
this patch was compile-tested only with all omap defconfigs, it would be nice to see it boot-tested on several boards before we apply it.
arch/arm/mach-omap2/id.c | 61 ++++++++++++++++------------------------------ 1 files changed, 21 insertions(+), 40 deletions(-)
arch/arm/mach-omap2/id.c +21 -40
@@ -53,11 +53,11 @@ int omap_type(void) {u32 val =0 ; -if (cpu_is_omap24xx ()) +if (cpu_is_omap24xx ()) { val =omap_ctrl_readl (OMAP24XX_CONTROL_STATUS ); -else if (cpu_is_omap34xx ()) + }else if (cpu_is_omap34xx ()) { val =omap_ctrl_readl (OMAP343X_CONTROL_STATUS ); -else { + }else {pr_err ("Cannot detect omap type!\n" ); goto out; }
@@ -224,24 +224,12 @@ void __init omap3_check_revision(void) omap_revision =OMAP3430_REV_ES3_0 ;break ;case 4 : - omap_revision =OMAP3430_REV_ES3_1 ; -break ; +/* FALLTHROUGH */ default :/* Use the latest known revision as default */ omap_revision =OMAP3430_REV_ES3_1 ; }break ; -case 0xb891 : -/* Handle 36xx devices */ -switch (rev) { -case 0 : - omap_revision =OMAP3630_REV_ES1_0 ; -break ; -default : -/* Use the latest known revision as default */ - omap_revision =OMAP3630_REV_ES1_0 ; - } -break ;case 0xb868 :/* Handle OMAP35xx/AM35xx devices *
@@ -250,6 +238,8 @@ void __init omap3_check_revision(void)*/ omap_revision =OMAP3505_REV (rev);break ; +case 0xb891 : +/* FALLTHROUGH */ default :/* Unknown default to latest silicon rev as default*/ omap_revision =OMAP3630_REV_ES1_0 ;
@@ -274,35 +264,29 @@ void __init omap3_cpuinfo(void)* on available features. Upon detection, update the CPU id * and CPU class bits. */ -if (cpu_is_omap3630 ()) +if (cpu_is_omap3630 ()) {strcpy (cpu_name,"OMAP3630" ); -else if (cpu_is_omap3505 ()) { + }else if (cpu_is_omap3505 ()) {/* * AM35xx devices */ if (omap3_has_sgx ()) { omap_revision =OMAP3517_REV (rev);strcpy (cpu_name,"AM3517" ); - } -else { + }else {/* Already set in omap3_check_revision() */ strcpy (cpu_name,"AM3505" ); } - } -/* -* OMAP3430, OMAP3525, OMAP3515, OMAP3503 devices -*/ -else if (omap3_has_iva () &&omap3_has_sgx ()) + }else if (omap3_has_iva () &&omap3_has_sgx ()) { +/* OMAP3430, OMAP3525, OMAP3515, OMAP3503 devices */ strcpy (cpu_name,"OMAP3430/3530" ); -else if (omap3_has_sgx ()) { + }else if (omap3_has_sgx ()) { omap_revision =OMAP3525_REV (rev);strcpy (cpu_name,"OMAP3525" ); - } -else if (omap3_has_iva ()) { + }else if (omap3_has_iva ()) { omap_revision =OMAP3515_REV (rev);strcpy (cpu_name,"OMAP3515" ); - } -else { + }else { omap_revision =OMAP3503_REV (rev);strcpy (cpu_name,"OMAP3503" ); }
@@ -321,16 +305,13 @@ void __init omap3_cpuinfo(void)strcpy (cpu_rev,"3.0" );break ;case OMAP_REVBITS_40 : -strcpy (cpu_rev,"3.1" ); -break ; +/* FALLTHROUGH */ default :/* Use the latest known revision as default */ strcpy (cpu_rev,"3.1" ); } -/* -* Print verbose information -*/ +/* Print verbose information */ pr_info ("%s ES%s\n" , cpu_name, cpu_rev);OMAP3_SHOW_FEATURE (l2cache);
@@ -349,18 +330,18 @@ void __init omap2_check_revision(void)* At this point we have an idea about the processor revision set * earlier with omap2_set_globals_tap(). */ -if (cpu_is_omap24xx ()) +if (cpu_is_omap24xx ()) {omap24xx_check_revision (); -else if (cpu_is_omap34xx ()) { + }else if (cpu_is_omap34xx ()) {omap3_check_features ();omap3_check_revision ();omap3_cpuinfo (); - } -else if (cpu_is_omap44xx ()) { + }else if (cpu_is_omap44xx ()) {printk (KERN_INFO "FIXME: CPU revision = OMAP4430\n" );return ; - }else + }else {pr_err ("OMAP revision unknown, please fix!\n" ); + }/* * OK, now we know the exact revision. Initialize omap_chip bits
Signature · 1 line
1.6.4.2.253.g0b1fac
Quoted 44 lines
-----Original Message-----
From: Premi, Sanjeev
Sent: Tuesday, October 27, 2009 7:33 PM
To: [email protected]
Cc: Premi, Sanjeev
Subject: [PATCH 1/2] AM35xx: Runtime detection of the deviceAdd support to detect AM3505/AM3517 devices at runtime. Also updates the CPU names printed during boot.
Signed-off-by Sanjeev Premi <[email protected]>--- arch/arm/mach-omap2/id.c | 43 ++++++++++++++++++++++++++++---- arch/arm/plat-omap/include/plat/cpu.h | 12 +++++++++ 2 files changed, 49 insertions(+), 6 deletions(-)arch/arm/mach-omap2/id.c +15
-0@@ -242,6 +242,21 @@ void __init omap3_check_revision(void) omap_revision =OMAP3630_REV_ES1_0 ; }break ; +case 0xb868 : +/* Handle OMAP35xx/AM35xx devices +* +* Set the device to be OMAP3517 here. Actual device +* is identified later based on the features. +*/ +switch (rev) { +case 0 : + omap_revision =OMAP3505_REV (rev); +break ; +default : +/* Use the latest known revision as default */ + omap_revision =OMAP3505_REV (rev); + } +break ;default :/* Unknown default to latest silicon rev as default*/ omap_revision =OMAP3630_REV_ES1_0 ;
arch/arm/mach-omap2/id.c void __init omap3_cpuinfo(void) · line 286
Quoted 6 lines
arch/arm/mach-omap2/id.c +2
-1@@ -267,20 +282,36 @@ void __init omap3_cpuinfo(void)* and CPU class bits. */ if (cpu_is_omap3630 ()) -strcpy (cpu_name,"3630" ); +strcpy (cpu_name,"OMAP3630" ); +else if (omap_rev () &&OMAP35XX_CLASS ) {
[sp] Just noticed that this should have been a "&" instead of "&&";
a copy paste while re-working.
... better still, cpu_is_omap3505().
~sanjeev
Quoted 115 lines
arch/arm/mach-omap2/id.c +20
-5+/* +* AM3517, AM3505 devices +*/ +if (omap3_has_sgx ()) { + omap_revision =OMAP3517_REV (rev); +strcpy (cpu_name,"AM3517" ); + } +else { +/* Already set in omap3_check_revision() */ +strcpy (cpu_name,"AM3505" ); + } + } +/* +* OMAP3430, OMAP3525, OMAP3515, OMAP3503 devices +*/ else if (omap3_has_iva () &&omap3_has_sgx ()) -strcpy (cpu_name,"3430/3530" ); +strcpy (cpu_name,"OMAP3430/3530" );else if (omap3_has_sgx ()) { omap_revision =OMAP3525_REV (rev); -strcpy (cpu_name,"3525" ); +strcpy (cpu_name,"OMAP3525" ); }else if (omap3_has_iva ()) { omap_revision =OMAP3515_REV (rev); -strcpy (cpu_name,"3515" ); +strcpy (cpu_name,"OMAP3515" ); }else { omap_revision =OMAP3503_REV (rev); -strcpy (cpu_name,"3503" ); +strcpy (cpu_name,"OMAP3503" ); }switch (rev) {@@ -307,7 +338,7 @@ void __init omap3_cpuinfo(void)/* * Print verbose information */ -pr_info ("OMAP%s ES%s\n" , cpu_name, cpu_rev); +pr_info ("%s ES%s\n" , cpu_name, cpu_rev);OMAP3_SHOW_FEATURE (l2cache);OMAP3_SHOW_FEATURE (iva);arch/arm/plat-omap/include/plat/cpu.h +8
-0@@ -284,6 +284,8 @@ IS_OMAP_SUBCLASS(363x, 0x363)* cpu_is_omap2423(): True for OMAP2423 * cpu_is_omap2430(): True for OMAP2430 * cpu_is_omap3430(): True for OMAP3430 +* cpu_is_omap3505(): True for OMAP3505 +* cpu_is_omap3517(): True for OMAP3517 */ #define GET_OMAP_TYPE ((omap_rev() >> 16) & 0xffff)@@ -307,6 +309,8 @@ IS_OMAP_TYPE(2422, 0x2422) IS_OMAP_TYPE(2423, 0x2423) IS_OMAP_TYPE(2430, 0x2430) IS_OMAP_TYPE(3430, 0x3430) +IS_OMAP_TYPE(3505, 0x3505) +IS_OMAP_TYPE(3517, 0x3517)#define cpu_is_omap310 () 0#define cpu_is_omap730 () 0@@ -325,6 +329,8 @@ IS_OMAP_TYPE(3430, 0x3430)#define cpu_is_omap3515 () 0#define cpu_is_omap3525 () 0#define cpu_is_omap3530 () 0 +#define cpu_is_omap3505 () 0 +#define cpu_is_omap3517 () 0#define cpu_is_omap3430 () 0#define cpu_is_omap3630 () 0@@ -380,6 +386,8 @@ IS_OMAP_TYPE(3430, 0x3430)# undef cpu_is_omap3515# undef cpu_is_omap3525# undef cpu_is_omap3530 +# undef cpu_is_omap3505 +# undef cpu_is_omap3517# define cpu_is_omap3430 () is_omap3430()# define cpu_is_omap3503 (cpu_is_omap3430() && \(!omap3_has_iva()) && \
arch/arm/plat-omap/include/plat/cpu.h +2
-0@@ -391,6 +399,8 @@ IS_OMAP_TYPE(3430, 0x3430) (omap3_has_sgx()) && \ (!omap3_has_iva()))# define cpu_is_omap3530 (cpu_is_omap3430()) +# define cpu_is_omap3505 is_omap3505() +# define cpu_is_omap3517 is_omap3517()# undef cpu_is_omap3630# define cpu_is_omap3630 () is_omap363x()#endif
arch/arm/plat-omap/include/plat/cpu.h +1
-0@@ -430,6 +440,8 @@ IS_OMAP_TYPE(3430, 0x3430)#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 OMAP3505_REV (v) (OMAP35XX_CLASS |(
0x3505<< 16) | (v << 12))
+#defineOMAP3517_REV(v)(OMAP35XX_CLASS|
(0x3517<< 16) | (v << 12))#define
OMAP443X_CLASS0x44300034Signature · 1 line
1.6.2.2