All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] AM35xx: Runtime detection of the device
@ 2009-10-27 14:02 Sanjeev Premi
  2009-10-27 16:11 ` Felipe Balbi
  2009-10-27 18:03 ` [PATCH 1/2] AM35xx: Runtime detection of the device Premi, Sanjeev
  0 siblings, 2 replies; 13+ messages in thread
From: Sanjeev Premi @ 2009-10-27 14:02 UTC (permalink / raw)
  To: linux-omap; +Cc: Sanjeev Premi

Add support to detect AM3505/AM3517 devices at runtime.
Also updates the CPU names printed during boot.

Signed-off-by: Sanjeev Premi <premi@ti.com>
---
 arch/arm/mach-omap2/id.c              |   43 ++++++++++++++++++++++++++++----
 arch/arm/plat-omap/include/plat/cpu.h |   12 +++++++++
 2 files changed, 49 insertions(+), 6 deletions(-)

diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 1c15112..87efb73 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -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);
diff --git a/arch/arm/plat-omap/include/plat/cpu.h b/arch/arm/plat-omap/include/plat/cpu.h
index 7cb0556..f1cc913 100644
--- a/arch/arm/plat-omap/include/plat/cpu.h
+++ b/arch/arm/plat-omap/include/plat/cpu.h
@@ -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
 
-- 
1.6.2.2


^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] AM35xx: Runtime detection of the device
  2009-10-27 14:02 [PATCH 1/2] AM35xx: Runtime detection of the device Sanjeev Premi
@ 2009-10-27 16:11 ` Felipe Balbi
  2009-10-27 18:08   ` Premi, Sanjeev
  2009-10-27 18:03 ` [PATCH 1/2] AM35xx: Runtime detection of the device Premi, Sanjeev
  1 sibling, 1 reply; 13+ messages in thread
From: Felipe Balbi @ 2009-10-27 16:11 UTC (permalink / raw)
  To: ext Sanjeev Premi; +Cc: linux-omap

Hi,

On Tue, Oct 27, 2009 at 03:02:30PM +0100, ext Sanjeev Premi wrote:
> Add support to detect AM3505/AM3517 devices at runtime.
> Also updates the CPU names printed during boot.
> 
> Signed-off-by: Sanjeev Premi <premi@ti.com>
> ---
>  arch/arm/mach-omap2/id.c              |   43 ++++++++++++++++++++++++++++----
>  arch/arm/plat-omap/include/plat/cpu.h |   12 +++++++++
>  2 files changed, 49 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
> index 1c15112..87efb73 100644
> --- a/arch/arm/mach-omap2/id.c
> +++ b/arch/arm/mach-omap2/id.c
> @@ -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);

if both are the same, what's the point of having this switch ?

> +		}
> +		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 {

according to CodingStyle this should be:

		} else {

-- 
balbi

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [PATCH 1/2] AM35xx: Runtime detection of the device
  2009-10-27 14:02 [PATCH 1/2] AM35xx: Runtime detection of the device Sanjeev Premi
  2009-10-27 16:11 ` Felipe Balbi
@ 2009-10-27 18:03 ` Premi, Sanjeev
  1 sibling, 0 replies; 13+ messages in thread
From: Premi, Sanjeev @ 2009-10-27 18:03 UTC (permalink / raw)
  To: linux-omap

> -----Original Message-----
> From: Premi, Sanjeev 
> Sent: Tuesday, October 27, 2009 7:33 PM
> To: linux-omap@vger.kernel.org
> Cc: Premi, Sanjeev
> Subject: [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.
> 
> Signed-off-by: Sanjeev Premi <premi@ti.com>
> ---
>  arch/arm/mach-omap2/id.c              |   43 
> ++++++++++++++++++++++++++++----
>  arch/arm/plat-omap/include/plat/cpu.h |   12 +++++++++
>  2 files changed, 49 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
> index 1c15112..87efb73 100644
> --- a/arch/arm/mach-omap2/id.c
> +++ b/arch/arm/mach-omap2/id.c
> @@ -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) {

[sp] Just noticed that this should have been a "&" instead of "&&";
     a copy paste while re-working.
     ... better still, cpu_is_omap3505().

~sanjeev

> +		/*
> +		 * 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);
> diff --git a/arch/arm/plat-omap/include/plat/cpu.h 
> b/arch/arm/plat-omap/include/plat/cpu.h
> index 7cb0556..f1cc913 100644
> --- a/arch/arm/plat-omap/include/plat/cpu.h
> +++ b/arch/arm/plat-omap/include/plat/cpu.h
> @@ -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
>  
> -- 
> 1.6.2.2
> 
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [PATCH 1/2] AM35xx: Runtime detection of the device
  2009-10-27 16:11 ` Felipe Balbi
@ 2009-10-27 18:08   ` Premi, Sanjeev
  2009-10-27 21:08     ` Felipe Balbi
  0 siblings, 1 reply; 13+ messages in thread
From: Premi, Sanjeev @ 2009-10-27 18:08 UTC (permalink / raw)
  To: felipe.balbi; +Cc: linux-omap

> -----Original Message-----
> From: Felipe Balbi [mailto:felipe.balbi@nokia.com] 
> Sent: Tuesday, October 27, 2009 9:41 PM
> To: Premi, Sanjeev
> Cc: linux-omap@vger.kernel.org
> Subject: Re: [PATCH 1/2] AM35xx: Runtime detection of the device
> 
> Hi,
> 
> On Tue, Oct 27, 2009 at 03:02:30PM +0100, ext Sanjeev Premi wrote:
> > Add support to detect AM3505/AM3517 devices at runtime.
> > Also updates the CPU names printed during boot.
> > 
> > Signed-off-by: Sanjeev Premi <premi@ti.com>
> > ---
> >  arch/arm/mach-omap2/id.c              |   43 
> ++++++++++++++++++++++++++++----
> >  arch/arm/plat-omap/include/plat/cpu.h |   12 +++++++++
> >  2 files changed, 49 insertions(+), 6 deletions(-)
> > 
> > diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
> > index 1c15112..87efb73 100644
> > --- a/arch/arm/mach-omap2/id.c
> > +++ b/arch/arm/mach-omap2/id.c
> > @@ -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);
> 
> 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 :(
> 
> > +		}
> > +		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 {
> 
> according to CodingStyle this should be:
> 
> 		} else {

[sp] Yes. Missed it.

> 
> -- 
> balbi
> 
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] AM35xx: Runtime detection of the device
  2009-10-27 18:08   ` Premi, Sanjeev
@ 2009-10-27 21:08     ` Felipe Balbi
  2009-10-28 12:40       ` Premi, Sanjeev
  2009-11-10 10:20       ` Felipe Balbi
  0 siblings, 2 replies; 13+ messages in thread
From: Felipe Balbi @ 2009-10-27 21:08 UTC (permalink / raw)
  To: ext Premi, Sanjeev; +Cc: Balbi Felipe (Nokia-D/Helsinki), linux-omap, tony

Hi,

On Tue, Oct 27, 2009 at 07:08:22PM +0100, ext Premi, Sanjeev wrote:
> > > diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
> > > index 1c15112..87efb73 100644
> > > --- a/arch/arm/mach-omap2/id.c
> > > +++ b/arch/arm/mach-omap2/id.c
> > > @@ -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);
> > 
> > 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 to id.c ?

From: Felipe Balbi <felipe.balbi@nokia.com>
Subject: [PATCH] arm: omap: code cleanup to id.c

Cleanup the coding style in id.c while avoiding unneeded switch()
statements.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---

diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 1c15112..dbdeb09 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -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

-- 
balbi

^ permalink raw reply related	[flat|nested] 13+ messages in thread

* RE: [PATCH 1/2] AM35xx: Runtime detection of the device
  2009-10-27 21:08     ` Felipe Balbi
@ 2009-10-28 12:40       ` Premi, Sanjeev
  2009-10-28 13:42         ` Premi, Sanjeev
  2009-10-28 16:59         ` Felipe Balbi
  2009-11-10 10:20       ` Felipe Balbi
  1 sibling, 2 replies; 13+ messages in thread
From: Premi, Sanjeev @ 2009-10-28 12:40 UTC (permalink / raw)
  To: felipe.balbi; +Cc: linux-omap, tony

> -----Original Message-----
> From: Felipe Balbi [mailto:felipe.balbi@nokia.com] 
> Sent: Wednesday, October 28, 2009 2:39 AM
> To: Premi, Sanjeev
> Cc: Balbi Felipe (Nokia-D/Helsinki); 
> linux-omap@vger.kernel.org; tony@atomide.com
> Subject: Re: [PATCH 1/2] AM35xx: Runtime detection of the device
> 
> Hi,
> 
> On Tue, Oct 27, 2009 at 07:08:22PM +0100, ext Premi, Sanjeev wrote:
> > > > diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
> > > > index 1c15112..87efb73 100644
> > > > --- a/arch/arm/mach-omap2/id.c
> > > > +++ b/arch/arm/mach-omap2/id.c
> > > > @@ -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);
> > > 
> > > 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 to id.c ?
> 
> From: Felipe Balbi <felipe.balbi@nokia.com>
> Subject: [PATCH] arm: omap: code cleanup to id.c
> 
> Cleanup the coding style in id.c while avoiding unneeded switch()
> statements.
> 
> Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
> ---
> 
> diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
> index 1c15112..dbdeb09 100644
> --- a/arch/arm/mach-omap2/id.c
> +++ b/arch/arm/mach-omap2/id.c
> @@ -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;

[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

> @@ -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
> 
> -- 
> balbi
> 
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [PATCH 1/2] AM35xx: Runtime detection of the device
  2009-10-28 12:40       ` Premi, Sanjeev
@ 2009-10-28 13:42         ` Premi, Sanjeev
  2009-10-28 16:59         ` Felipe Balbi
  1 sibling, 0 replies; 13+ messages in thread
From: Premi, Sanjeev @ 2009-10-28 13:42 UTC (permalink / raw)
  To: Premi, Sanjeev, felipe.balbi; +Cc: linux-omap, tony

 

> -----Original Message-----
> From: linux-omap-owner@vger.kernel.org 
> [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of Premi, Sanjeev
> Sent: Wednesday, October 28, 2009 6:10 PM
> To: felipe.balbi@nokia.com
> Cc: linux-omap@vger.kernel.org; tony@atomide.com
> Subject: RE: [PATCH 1/2] AM35xx: Runtime detection of the device

[snip]--[snip]

> > 
> > From: Felipe Balbi <felipe.balbi@nokia.com>
> > Subject: [PATCH] arm: omap: code cleanup to id.c
> > 
> > Cleanup the coding style in id.c while avoiding unneeded switch()
> > statements.
> > 
> > Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
> > ---

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]

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] AM35xx: Runtime detection of the device
  2009-10-28 12:40       ` Premi, Sanjeev
  2009-10-28 13:42         ` Premi, Sanjeev
@ 2009-10-28 16:59         ` Felipe Balbi
  2009-10-28 18:42           ` Premi, Sanjeev
  1 sibling, 1 reply; 13+ messages in thread
From: Felipe Balbi @ 2009-10-28 16:59 UTC (permalink / raw)
  To: ext Premi, Sanjeev; +Cc: Balbi Felipe (Nokia-D/Helsinki), linux-omap, tony

Hi,

On Wed, Oct 28, 2009 at 01:40:04PM +0100, ext Premi, Sanjeev wrote:
> >  	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;
> 
> [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?

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;

-- 
balbi

^ permalink raw reply	[flat|nested] 13+ messages in thread

* RE: [PATCH 1/2] AM35xx: Runtime detection of the device
  2009-10-28 16:59         ` Felipe Balbi
@ 2009-10-28 18:42           ` Premi, Sanjeev
  2009-10-28 20:17             ` Felipe Balbi
  0 siblings, 1 reply; 13+ messages in thread
From: Premi, Sanjeev @ 2009-10-28 18:42 UTC (permalink / raw)
  To: felipe.balbi; +Cc: linux-omap, tony

 

> -----Original Message-----
> From: Felipe Balbi [mailto:felipe.balbi@nokia.com] 
> Sent: Wednesday, October 28, 2009 10:29 PM
> To: Premi, Sanjeev
> Cc: Balbi Felipe (Nokia-D/Helsinki); 
> linux-omap@vger.kernel.org; tony@atomide.com
> Subject: Re: [PATCH 1/2] AM35xx: Runtime detection of the device
> 
> Hi,
> 
> On Wed, Oct 28, 2009 at 01:40:04PM +0100, ext Premi, Sanjeev wrote:
> > >  	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;
> > 
> > [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?
> 
> 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:

I did see that. But since you were already proposing a change
thought it would be good idea.

~sanjeev

> 
> case 0xb891:
> 	omap_revision = OMAP3630_REV_ES1_0;
> 	break;
> 
> -- 
> balbi
> 
> 

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] AM35xx: Runtime detection of the device
  2009-10-28 18:42           ` Premi, Sanjeev
@ 2009-10-28 20:17             ` Felipe Balbi
  0 siblings, 0 replies; 13+ messages in thread
From: Felipe Balbi @ 2009-10-28 20:17 UTC (permalink / raw)
  To: ext Premi, Sanjeev; +Cc: Balbi Felipe (Nokia-D/Helsinki), linux-omap, tony

Hi,

On Wed, Oct 28, 2009 at 07:42:07PM +0100, ext Premi, Sanjeev wrote:
> > On Wed, Oct 28, 2009 at 01:40:04PM +0100, ext Premi, Sanjeev wrote:
> > > >  	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;
> > > 
> > > [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?
> > 
> > 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:
> 
> 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.

-- 
balbi

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] AM35xx: Runtime detection of the device
  2009-10-27 21:08     ` Felipe Balbi
  2009-10-28 12:40       ` Premi, Sanjeev
@ 2009-11-10 10:20       ` Felipe Balbi
  2009-11-11  2:49         ` Tony Lindgren
  1 sibling, 1 reply; 13+ messages in thread
From: Felipe Balbi @ 2009-11-10 10:20 UTC (permalink / raw)
  To: Balbi Felipe (Nokia-D/Helsinki); +Cc: ext Premi, Sanjeev, linux-omap, tony

Hi,

On Tue, Oct 27, 2009 at 10:08:54PM +0100, Balbi Felipe (Nokia-D/Helsinki) wrote:
>From: Felipe Balbi <felipe.balbi@nokia.com>
>Subject: [PATCH] arm: omap: code cleanup to id.c
>
>Cleanup the coding style in id.c while avoiding unneeded switch()
>statements.
>
>Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
>---
>
>diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
>index 1c15112..dbdeb09 100644
>--- a/arch/arm/mach-omap2/id.c
>+++ b/arch/arm/mach-omap2/id.c
>@@ -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

how about this patch, any comments ??

-- 
balbi

^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH 1/2] AM35xx: Runtime detection of the device
  2009-11-10 10:20       ` Felipe Balbi
@ 2009-11-11  2:49         ` Tony Lindgren
  2009-11-12  9:21           ` [PATCH] arm: omap: code cleanup to id.c Felipe Balbi
  0 siblings, 1 reply; 13+ messages in thread
From: Tony Lindgren @ 2009-11-11  2:49 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: ext Premi, Sanjeev, linux-omap

* Felipe Balbi <felipe.balbi@nokia.com> [091110 02:22]:
> Hi,
> 
> On Tue, Oct 27, 2009 at 10:08:54PM +0100, Balbi Felipe (Nokia-D/Helsinki) wrote:
> >From: Felipe Balbi <felipe.balbi@nokia.com>
> >Subject: [PATCH] arm: omap: code cleanup to id.c
> >
> >Cleanup the coding style in id.c while avoiding unneeded switch()
> >statements.
> >
> >Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
> >---
> >
> >diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
> >index 1c15112..dbdeb09 100644
> >--- a/arch/arm/mach-omap2/id.c
> >+++ b/arch/arm/mach-omap2/id.c
> >@@ -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
> 
> 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

^ permalink raw reply	[flat|nested] 13+ messages in thread

* [PATCH] arm: omap: code cleanup to id.c
  2009-11-11  2:49         ` Tony Lindgren
@ 2009-11-12  9:21           ` Felipe Balbi
  0 siblings, 0 replies; 13+ messages in thread
From: Felipe Balbi @ 2009-11-12  9:21 UTC (permalink / raw)
  To: linux-omap, tony; +Cc: Felipe Balbi

Cleanup the coding style in id.c while avoiding unneeded switch()
statements.

Signed-off-by: Felipe Balbi <felipe.balbi@nokia.com>
---
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(-)

diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
index 441ca26..cb75b32 100644
--- a/arch/arm/mach-omap2/id.c
+++ b/arch/arm/mach-omap2/id.c
@@ -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
-- 
1.6.4.2.253.g0b1fac


^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2009-11-12  9:23 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-10-27 14:02 [PATCH 1/2] AM35xx: Runtime detection of the device Sanjeev Premi
2009-10-27 16:11 ` Felipe Balbi
2009-10-27 18:08   ` Premi, Sanjeev
2009-10-27 21:08     ` Felipe Balbi
2009-10-28 12:40       ` Premi, Sanjeev
2009-10-28 13:42         ` Premi, Sanjeev
2009-10-28 16:59         ` Felipe Balbi
2009-10-28 18:42           ` Premi, Sanjeev
2009-10-28 20:17             ` Felipe Balbi
2009-11-10 10:20       ` Felipe Balbi
2009-11-11  2:49         ` Tony Lindgren
2009-11-12  9:21           ` [PATCH] arm: omap: code cleanup to id.c Felipe Balbi
2009-10-27 18:03 ` [PATCH 1/2] AM35xx: Runtime detection of the device Premi, Sanjeev

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.