linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: marek.vasut@gmail.com (Marek Vasut)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: mx27: Print silicon revision on boot
Date: Mon, 22 Aug 2011 18:05:58 +0200	[thread overview]
Message-ID: <201108221805.58180.marek.vasut@gmail.com> (raw)
In-Reply-To: <1314028361-25622-1-git-send-email-fabio.estevam@freescale.com>

On Monday, August 22, 2011 05:52:41 PM Fabio Estevam wrote:
> Silicon revision is useful information to have during kernel boot.
> 
> Print the MX27 silicon revision.
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  arch/arm/mach-imx/clock-imx27.c       |    1 +
>  arch/arm/mach-imx/cpu-imx27.c         |   23 +++++++++++++++++++++++
>  arch/arm/plat-mxc/include/mach/mx27.h |    1 +
>  3 files changed, 25 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/mach-imx/clock-imx27.c
> b/arch/arm/mach-imx/clock-imx27.c index 6912b82..2858137 100644
> --- a/arch/arm/mach-imx/clock-imx27.c
> +++ b/arch/arm/mach-imx/clock-imx27.c
> @@ -756,6 +756,7 @@ int __init mx27_clocks_init(unsigned long fref)
>  	clk_enable(&uart1_clk);
>  #endif
> 
> +	mx27_read_cpu_rev();
>  	mxc_timer_init(&gpt1_clk, MX27_IO_ADDRESS(MX27_GPT1_BASE_ADDR),
>  			MX27_INT_GPT1);
> 
> diff --git a/arch/arm/mach-imx/cpu-imx27.c b/arch/arm/mach-imx/cpu-imx27.c
> index 3b117be..8f6495e 100644
> --- a/arch/arm/mach-imx/cpu-imx27.c
> +++ b/arch/arm/mach-imx/cpu-imx27.c
> @@ -74,3 +74,26 @@ int mx27_revision(void)
>  	return cpu_silicon_rev;
>  }
>  EXPORT_SYMBOL(mx27_revision);
> +
> +void __init mx27_read_cpu_rev(void)
> +{
> +	u32 rev;
> +	char *srev;
> +
> +	rev = mx27_revision();
> +	switch (rev) {
> +	case IMX_CHIP_REVISION_1_0:
> +		srev = IMX_CHIP_REVISION_1_0_STRING;
> +		break;
> +	case IMX_CHIP_REVISION_2_0:
> +		srev = IMX_CHIP_REVISION_2_0_STRING;
> +		break;
> +	case IMX_CHIP_REVISION_2_1:
> +		srev = IMX_CHIP_REVISION_2_1_STRING;
> +		break;
> +	default:
> +		srev = IMX_CHIP_REVISION_UNKNOWN_STRING;
> +	}

I didn't check really, but can't you just do some kind of a numeric 
transformation instead of storing strings ?

Cheers
> +
> +	pr_info("CPU identified as i.MX27, silicon rev %s\n", srev);
> +}
> diff --git a/arch/arm/plat-mxc/include/mach/mx27.h
> b/arch/arm/plat-mxc/include/mach/mx27.h index 1dc1c52..76edec7 100644
> --- a/arch/arm/plat-mxc/include/mach/mx27.h
> +++ b/arch/arm/plat-mxc/include/mach/mx27.h
> @@ -246,6 +246,7 @@ static inline void mx27_setup_weimcs(size_t cs,
> 
>  #ifndef __ASSEMBLY__
>  extern int mx27_revision(void);
> +extern void mx27_read_cpu_rev(void);
>  #endif
> 
>  #endif /* ifndef __MACH_MX27_H__ */

  reply	other threads:[~2011-08-22 16:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-22 15:52 [PATCH] ARM: mx27: Print silicon revision on boot Fabio Estevam
2011-08-22 16:05 ` Marek Vasut [this message]
2011-08-22 16:10   ` Fabio Estevam
2011-08-22 16:43     ` Marek Vasut
2011-08-22 17:09     ` Sascha Hauer
2011-08-22 18:21       ` Marek Vasut

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=201108221805.58180.marek.vasut@gmail.com \
    --to=marek.vasut@gmail.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /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;
as well as URLs for NNTP newsgroup(s).