public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Sanjeev Premi <premi@ti.com>
Cc: linux-omap@vger.kernel.org
Subject: Re: [PATCH 3/6] OMAP3: Add runtime check for OMAP35x
Date: Thu, 6 Aug 2009 14:04:00 +0300	[thread overview]
Message-ID: <20090806110359.GD2358@atomide.com> (raw)
In-Reply-To: <1249554967-20394-1-git-send-email-premi@ti.com>

Hi,

* Sanjeev Premi <premi@ti.com> [090806 13:36]:
> Added runtime check via omap2_set_globals_35xx().
> 
> Parts of this patch have been derived from an earlier
> earlier patch submitted by Tony Lindgren <tony@atomide.com>
> 
>  [1] http://marc.info/?l=linux-omap&m=123301852702797&w=2
>  [2] http://marc.info/?l=linux-omap&m=123334055822212&w=2
> 
> Signed-off-by: Sanjeev Premi <premi@ti.com>
> ---
>  arch/arm/mach-omap2/id.c                 |  115 ++++++++++++++++++++++++------
>  arch/arm/plat-omap/common.c              |   18 +++++-
>  arch/arm/plat-omap/include/mach/common.h |    1 +
>  arch/arm/plat-omap/include/mach/cpu.h    |   64 ++++++++++++++++-
>  4 files changed, 173 insertions(+), 25 deletions(-)
> 
> diff --git a/arch/arm/mach-omap2/id.c b/arch/arm/mach-omap2/id.c
> index a98201c..06770aa 100644
> --- a/arch/arm/mach-omap2/id.c
> +++ b/arch/arm/mach-omap2/id.c
> @@ -28,6 +28,14 @@
>  static struct omap_chip_id omap_chip;
>  static unsigned int omap_revision;
>  
> +/* The new OMAP35x devices have assymetric names - OMAP3505 and OMAP3517.
> + * It is not possible to define a common macro to identify them.
> + *
> + * A quick way is to separate them across 'generations' as below.
> + */
> +#define OMAP35XX_G1	0x1	/* Applies to 3503, 3515, 3525 and 3530 */
> +#define OMAP35XX_G2	0x2	/* Applies to 3505 and 3517 */
> +
>  
>  unsigned int omap_rev(void)
>  {
> @@ -155,12 +163,71 @@ void __init omap24xx_check_revision(void)
>  	pr_info("\n");
>  }
>  
> +static void __init omap34xx_set_revision(u8 rev, char *rev_name)
> +{
> +	switch (rev) {
> +	case 0:
> +		omap_revision = OMAP3430_REV_ES2_0;
> +		strcat(rev_name, "ES2.0");
> +		break;
> +	case 2:
> +		omap_revision = OMAP3430_REV_ES2_1;
> +		strcat(rev_name, "ES2.1");
> +		break;
> +	case 3:
> +		omap_revision = OMAP3430_REV_ES3_0;
> +		strcat(rev_name, "ES3.0");
> +		break;
> +	case 4:
> +		omap_revision = OMAP3430_REV_ES3_1;
> +		strcat(rev_name, "ES3.1");
> +		break;
> +	default:
> +		/* Use the latest known revision as default */
> +		omap_revision = OMAP3430_REV_ES3_1;
> +		strcat(rev_name, "Unknown revision");
> +	}
> +}
> +
> +static void __init omap35xx_set_revision(u8 rev, u8 gen, char *rev_name)
> +{
> +	omap_revision = OMAP35XX_CLASS ;
> +
> +	if (gen == OMAP35XX_G1) {
> +		switch (rev) {
> +		case 0:	/* Take care of some older boards */
> +		case 1:
> +			omap_revision |= OMAP35XX_MASK_ES2_0;
> +			strcat(rev_name, "ES2.0");
> +			break;
> +		case 2:
> +			omap_revision |= OMAP35XX_MASK_ES2_1;
> +			strcat(rev_name, "ES2.1");
> +			break;
> +		case 3:
> +			omap_revision |= OMAP35XX_MASK_ES3_0;
> +			strcat(rev_name, "ES3.0");
> +			break;
> +		case 4:
> +			omap_revision |= OMAP35XX_MASK_ES3_1;
> +			strcat(rev_name, "ES3.1");
> +			break;
> +		default:
> +			/* Use the latest known revision as default */
> +			omap_revision |= OMAP35XX_MASK_ES3_0;
> +			strcat(rev_name, "Unknown revision");
> +		}
> +	} else {
> +		strcat(rev_name, "ES1.0");
> +	}
> +}
> +

To me it looks like you're checking the exact same cores as we already do
for 34xx. That is, (idcode >> 28) & 0xff for both 34xx and 35xx. So basically
they have the same omap cores.

Considering this I don't see much sense adding cpu_is_35xx() category
because cpu_is_34xx() already covers these processors. Just like cpu_is_16xx()
covers both 1610 and 1710.

Let's just rather add more feature tests for IVA2 etc as needed, then
cpu_is_35something() becomse just cpu_is_34xx() && cpu_has_iva2() or similar.


>  void __init omap34xx_check_revision(void)
>  {
>  	u32 cpuid, idcode;
>  	u16 hawkeye;
>  	u8 rev;
> -	char *rev_name = "ES1.0";
> +	char rev_name[16] = "";
>  
>  	/*
>  	 * We cannot access revision registers on ES1.0.
> @@ -184,28 +251,12 @@ void __init omap34xx_check_revision(void)
>  	rev = (idcode >> 28) & 0xff;
>  
>  	if (hawkeye == 0xb7ae) {
> -		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";
> -		}
> +		if (cpu_is_omap35xx())
> +			omap35xx_set_revision(rev, OMAP35XX_G1, rev_name);
> +		else
> +			omap34xx_set_revision(rev, rev_name);
> +	} else if (hawkeye == 0xb868) {
> +		omap35xx_set_revision(rev, OMAP35XX_G2, rev_name);
>  	}

Testing for hawkeye == 0xb868 test should just be added into the current
omap34xx_check_revision().

Regards,

Tony

  reply	other threads:[~2009-08-06 11:04 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-06 10:36 [PATCH 3/6] OMAP3: Add runtime check for OMAP35x Sanjeev Premi
2009-08-06 11:04 ` Tony Lindgren [this message]
2009-08-06 11:34   ` Premi, Sanjeev
2009-08-06 11:50     ` Tony Lindgren
2009-08-06 14:11       ` Premi, Sanjeev
2009-08-06 14:18         ` Tony Lindgren
2009-08-06 14:55         ` Kevin Hilman
2009-08-07  8:23           ` Tony Lindgren
2009-08-10 15:10             ` Premi, Sanjeev
2009-08-11  8:02               ` Tony Lindgren
2009-08-11 11:52                 ` Premi, Sanjeev
2009-08-11 17:09                   ` Premi, Sanjeev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090806110359.GD2358@atomide.com \
    --to=tony@atomide.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=premi@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox