linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: baruch@tkos.co.il (Baruch Siach)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/1] ARM: imx53: correct Silicon Revision definition following fuse map
Date: Fri, 18 Feb 2011 09:07:52 +0200	[thread overview]
Message-ID: <20110218070752.GC2343@tarshish> (raw)
In-Reply-To: <1298008049-20352-1-git-send-email-richard.zhao@freescale.com>

Hi Richard,

On Fri, Feb 18, 2011 at 01:47:29PM +0800, Richard Zhao wrote:
> Signed-off-by: Richard Zhao <richard.zhao@freescale.com>
> 
> diff --git a/arch/arm/mach-mx5/cpu.c b/arch/arm/mach-mx5/cpu.c
> index d40671d..95fd5f8 100644
> --- a/arch/arm/mach-mx5/cpu.c
> +++ b/arch/arm/mach-mx5/cpu.c
> @@ -76,13 +76,25 @@ late_initcall(mx51_neon_fixup);
>  static int get_mx53_srev(void)
>  {
>  	void __iomem *iim_base = MX51_IO_ADDRESS(MX53_IIM_BASE_ADDR);
> -	u32 rev = readl(iim_base + IIM_SREV) & 0xff;
> +	u32 reg = readl(iim_base + IIM_SREV) & 0xff;
> +	int rev;
> +
> +	switch (reg) {
> +	case 0x0:
> +		rev = IMX_CHIP_REVISION_1_0;
> +		break;
> +	case 0x2:
> +		rev = IMX_CHIP_REVISION_2_0;
> +		break;
> +	case 0x3:
> +		rev = IMX_CHIP_REVISION_2_1;
> +		break;
> +	default:
> +		rev = IMX_CHIP_REVISION_UNKNOWN;
> +		break;
> +	}
>  
> -	if (rev == 0x0)
> -		return IMX_CHIP_REVISION_1_0;
> -	else if (rev == 0x10)
> -		return IMX_CHIP_REVISION_2_0;
> -	return 0;
> +	return rev;
>  }
>  
>  /*

I think the following code is shorter and more readable:

switch (reg) {
case 0x0:
    return IMX_CHIP_REVISION_1_0;
case 0x2:
    return IMX_CHIP_REVISION_2_0;
case 0x3:
    return IMX_CHIP_REVISION_2_1;
default:
    return IMX_CHIP_REVISION_UNKNOWN;
}

baruch


-- 
                                                     ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.2.679.5364, http://www.tkos.co.il -

  reply	other threads:[~2011-02-18  7:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-18  5:47 [PATCH 1/1] ARM: imx53: correct Silicon Revision definition following fuse map Richard Zhao
2011-02-18  7:07 ` Baruch Siach [this message]
2011-02-18  9:01   ` Richard Zhao

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=20110218070752.GC2343@tarshish \
    --to=baruch@tkos.co.il \
    --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).