public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Detlev Zundel <dzu@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] MX31: change return value of get_cpu_rev
Date: Fri, 29 Apr 2011 13:36:54 +0200	[thread overview]
Message-ID: <m2pqo55lwp.fsf@ohwell.denx.de> (raw)
In-Reply-To: <1304061193-23544-1-git-send-email-sbabic@denx.de> (Stefano Babic's message of "Fri, 29 Apr 2011 09:13:13 +0200")

Hi Stefano,

> Drop warnings in get_cpu_rev and changes the return value
> (a u32 instead of char * is returned) of the function
> to be coherent with other processors.
>
> Signed-off-by: Stefano Babic <sbabic@denx.de>
> CC: Detlev Zundev <dzu@denx.de>

Can you please correct the spelling of my name?  Thanks.

> CC: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>
> This is a follow-up patch of "MX31: drop warnings in get_cpu_rev",
> as this patch was already integrated in u-boot mainline, and
> implements the comments discussed on ML.
>
> - Detlev Zundev: be coherent with other architecture
>
>  arch/arm/cpu/arm1136/mx31/generic.c       |   29 ++++++++++++++++-------------
>  arch/arm/include/asm/arch-mx31/imx-regs.h |    2 +-
>  2 files changed, 17 insertions(+), 14 deletions(-)
>
> diff --git a/arch/arm/cpu/arm1136/mx31/generic.c b/arch/arm/cpu/arm1136/mx31/generic.c
> index 18572b9..461d960 100644
> --- a/arch/arm/cpu/arm1136/mx31/generic.c
> +++ b/arch/arm/cpu/arm1136/mx31/generic.c
> @@ -107,18 +107,18 @@ void mx31_set_pad(enum iomux_pins pin, u32 config)
>  }
>  
>  struct mx3_cpu_type mx31_cpu_type[] = {
> -	{ .srev = 0x00,	.v = "1.0"  },
> -	{ .srev = 0x10,	.v = "1.1"  },
> -	{ .srev = 0x11,	.v = "1.1"  },
> -	{ .srev = 0x12,	.v = "1.15" },
> -	{ .srev = 0x13,	.v = "1.15" },
> -	{ .srev = 0x14,	.v = "1.2"  },
> -	{ .srev = 0x15,	.v = "1.2"  },
> -	{ .srev = 0x28,	.v = "2.0"  },
> -	{ .srev = 0x29,	.v = "2.0"  },
> +	{ .srev = 0x00, .v = 0x10 },
> +	{ .srev = 0x10, .v = 0x11 },
> +	{ .srev = 0x11, .v = 0x11 },
> +	{ .srev = 0x12, .v = 0x1F },
> +	{ .srev = 0x13, .v = 0x1F },
> +	{ .srev = 0x14, .v = 0x12 },
> +	{ .srev = 0x15, .v = 0x12 },
> +	{ .srev = 0x28, .v = 0x20 },
> +	{ .srev = 0x29, .v = 0x20 },
>  };
>  
> -char *get_cpu_rev(void)
> +u32 get_cpu_rev(void)
>  {
>  	u32 i, srev;
>  
> @@ -129,7 +129,7 @@ char *get_cpu_rev(void)
>  	for (i = 0; i < ARRAY_SIZE(mx31_cpu_type); i++)
>  		if (srev == mx31_cpu_type[i].srev)
>  			return mx31_cpu_type[i].v;
> -		return "unknown";
> +	return srev;

Hm, so we drop the "unknown" case and return the srev unchanged.

>  }
>  
>  char *get_reset_cause(void)
> @@ -161,8 +161,11 @@ char *get_reset_cause(void)
>  #if defined(CONFIG_DISPLAY_CPUINFO)
>  int print_cpuinfo (void)
>  {
> -	printf("CPU:   Freescale i.MX31 rev %s at %d MHz.",
> -			get_cpu_rev(), mx31_get_mcu_main_clk() / 1000000);
> +	u32 srev = get_cpu_rev();
> +
> +	printf("CPU:   Freescale i.MX31 rev %d.%d at %d MHz.",
> +			(srev & 0xF0) >> 4, (srev & 0x0F),
> +			mx31_get_mcu_main_clk() / 1000000);

And here we have no way of knowing if the output number is the result of
a correct translation or if our table is insufficient.  This is not
good.

Please provide a "unknown" case again for missing table entries.

Cheers
  Detlev

-- 
Math and Alcohol don't mix, so...
PLEASE DON'T DRINK AND DERIVE

[Motto of the society: Mathematicians Against Drunk Deriving]
--
DENX Software Engineering GmbH,      MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich,  Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-40 Fax: (+49)-8142-66989-80 Email: dzu at denx.de

  reply	other threads:[~2011-04-29 11:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-29  7:13 [U-Boot] [PATCH] MX31: change return value of get_cpu_rev Stefano Babic
2011-04-29 11:36 ` Detlev Zundel [this message]
2011-04-29 12:14   ` Stefano Babic
2011-04-29 12:54     ` Detlev Zundel
2011-04-29 14:00 ` [U-Boot] [PATCH V2] " Stefano Babic
2011-04-29 15:22   ` Detlev Zundel
2011-05-01 16:38 ` [U-Boot] [PATCH V3] " Stefano Babic

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=m2pqo55lwp.fsf@ohwell.denx.de \
    --to=dzu@denx.de \
    --cc=u-boot@lists.denx.de \
    /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