public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v5] mx6: Read silicon revision from register
Date: Tue, 20 Mar 2012 07:28:16 +0100	[thread overview]
Message-ID: <4F682380.7000605@denx.de> (raw)
In-Reply-To: <1332194822-27853-1-git-send-email-festevam@gmail.com>

On 19/03/2012 23:07, Fabio Estevam wrote:
> Instead of hardcoding the mx6 silicon revision, read it in run-time.
> 
> Also, besides the silicon version print the mx6 variant type: quad,dual/solo 
> or solo-lite.
> 
> Tested on a mx6qsabrelite, where it shows:
> 
> CPU:   Freescale i.MX6Q rev1.0 at 792 MHz  
> 
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> ---
Hi Fabio,

>  
>  #if defined(CONFIG_DISPLAY_CPUINFO)
> +
> +#ifdef CONFIG_MX6Q
> +static char *get_mx6_type(u32 mx6type)
> +{
> +	switch (mx6type) {
> +	case 0x63:
> +		return "Q";	/* Quad-core version of the mx6 */
> +	case 0x61:
> +		return "DS";	/* Dual/Solo version of the mx6 */
> +	case 0x60:
> +		return "SL";	/* Solo-Lite version of the mx6 */
> +	default:
> +		return "unknown";
> +	}
> +}
> +#endif
> +
>  int print_cpuinfo(void)
>  {
>  	u32 cpurev;
>  
>  	cpurev = get_cpu_rev();
> -	printf("CPU:   Freescale i.MX%x family rev%d.%d at %d MHz\n",
> +
> +#ifdef CONFIG_MX6Q
> +	printf("CPU:   Freescale i.MX6%s rev%d.%d at %d MHz\n",
> +		get_mx6_type((cpurev & 0xFF000) >> 12),
> +		(cpurev & 0x000F0) >> 4,
> +		(cpurev & 0x0000F) >> 0,
> +		mxc_get_clock(MXC_ARM_CLK) / 1000000);
> +#else
> +	printf("CPU:   Freescale i.MX%x rev%d.%d at %d MHz\n",
>  		(cpurev & 0xFF000) >> 12,
>  		(cpurev & 0x000F0) >> 4,
>  		(cpurev & 0x0000F) >> 0,
>  		mxc_get_clock(MXC_ARM_CLK) / 1000000);
> +#endif

What about if we modify slightly the code checking for MX6 in
get_mx6_type (that could become get_mx_type) ? Something like:

static char *get_mx6_type(u32 mx6type) {
   if ((mx6type & 0x60) != 0x60)
	return NULL;

we could drop CONFIG_MX6Q at all and also the duplication of code in
print_cpuinfo()

Best regards,
Stefano

-- 
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-0 Fax: +49-8142-66989-80  Email: office at denx.de
=====================================================================

      reply	other threads:[~2012-03-20  6:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-19 22:07 [U-Boot] [PATCH v5] mx6: Read silicon revision from register Fabio Estevam
2012-03-20  6:28 ` Stefano Babic [this message]

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=4F682380.7000605@denx.de \
    --to=sbabic@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