public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/3] mxs: generalize code for print_cpuinfo()
Date: Sun, 17 Jun 2012 15:28:17 +0200	[thread overview]
Message-ID: <201206171528.18141.marex@denx.de> (raw)
In-Reply-To: <1339937889-15538-3-git-send-email-otavio@ossystems.com.br>

Dear Otavio Salvador,

> The information now is gathered from HW_DIGCTL_CHIPID register and
> includes the revision of the chip on the output.
> 
> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
> Cc: Marek Vasut <marex@denx.de>
> Cc: Stefano Babic <sbabic@denx.de>
> Cc: Fabio Estevam <fabio.estevam@freescale.com>
> ---
>  arch/arm/cpu/arm926ejs/mx28/mx28.c |   29 +++++++++++++++++++++++++++--
>  1 file changed, 27 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/cpu/arm926ejs/mx28/mx28.c
> b/arch/arm/cpu/arm926ejs/mx28/mx28.c index a82ff25..ac2f2e0 100644
> --- a/arch/arm/cpu/arm926ejs/mx28/mx28.c
> +++ b/arch/arm/cpu/arm926ejs/mx28/mx28.c
> @@ -190,13 +190,38 @@ int arch_cpu_init(void)
>  #endif
> 
>  #if defined(CONFIG_DISPLAY_CPUINFO)
> +static const char *get_cpu_type(void)
> +{
> +	struct mx28_digctl_regs *digctl_regs =
> +		(struct mx28_digctl_regs *)MXS_DIGCTL_BASE;
> +
> +	switch (readl(&digctl_regs->hw_digctl_chipid) >> 16) {

#define that >> 16 ... maybe offset? I'd define a mask though, see below.

#define PRODUCT_CODE_MASK (0xffff << 16)

> +	case 0x2800:

#define this as something ... #define PRODUCT_CODE_MX28 (0x2800 << 16)

> +		return "28";
> +	case 0x3728:
> +		return "23";
> +	default:
> +		return "<unidentified>";

So X-Files-ish ;-)

> +	}
> +}
> +
> +static u8 get_cpu_rev(void)

uint8_t ... maybe? it's used throughout the code, so let's keep consistent.

> +{
> +	struct mx28_digctl_regs *digctl_regs =
> +		(struct mx28_digctl_regs *)MXS_DIGCTL_BASE;
> +
> +	return readl(&digctl_regs->hw_digctl_chipid) & 0x0000F;
> +}
> +
>  int print_cpuinfo(void)
>  {
>  	struct mx28_spl_data *data = (struct mx28_spl_data *)
>  		((CONFIG_SYS_TEXT_BASE - sizeof(struct mx28_spl_data)) & ~0xf);
> 
> -	printf("Freescale i.MX28 family at %d MHz\n",
> -			mxc_get_clock(MXC_ARM_CLK) / 1000000);
> +	printf("CPU:   Freescale i.MX%s rev%d at %d MHz\n",
> +		get_cpu_type(),
> +		get_cpu_rev(),
> +		mxc_get_clock(MXC_ARM_CLK) / 1000000);
>  	printf("BOOT:  %s\n", mx28_boot_modes[data->boot_mode_idx].mode);
>  	return 0;
>  }

Best regards,
Marek Vasut

  parent reply	other threads:[~2012-06-17 13:28 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-17 12:58 [U-Boot] [PATCH 0/3] i.MX refactoring patchset Otavio Salvador
2012-06-17 12:58 ` [U-Boot] [PATCH 1/3] imx: Use a clear identification of an unidentified CPU type Otavio Salvador
2012-06-17 13:05   ` Fabio Estevam
2012-06-17 13:09     ` Otavio Salvador
2012-06-17 13:13       ` Fabio Estevam
2012-06-17 13:21         ` Otavio Salvador
2012-06-17 13:30         ` Marek Vasut
2012-06-17 15:43   ` Stefano Babic
2012-06-17 15:48     ` Otavio Salvador
2012-06-17 16:03       ` Marek Vasut
2012-06-17 17:50         ` Otavio Salvador
2012-06-17 18:04           ` Stefano Babic
2012-06-17 18:40             ` Marek Vasut
2012-06-17 18:04           ` Marek Vasut
2012-06-17 12:58 ` [U-Boot] [PATCH 2/3] mxs: generalize code for print_cpuinfo() Otavio Salvador
2012-06-17 13:10   ` Fabio Estevam
2012-06-17 13:25   ` Fabio Estevam
2012-06-17 13:35     ` Marek Vasut
2012-06-17 14:14       ` Fabio Estevam
2012-06-17 14:35     ` Otavio Salvador
2012-06-17 15:10       ` Marek Vasut
2012-06-17 15:17         ` Otavio Salvador
2012-06-17 13:28   ` Marek Vasut [this message]
2012-06-17 15:49   ` Stefano Babic
2012-06-17 16:02     ` Marek Vasut
2012-06-17 17:56       ` Stefano Babic
2012-06-17 18:03         ` Otavio Salvador
2012-06-17 18:41           ` Marek Vasut
2012-06-17 18:04         ` Marek Vasut
2012-06-17 17:49     ` Otavio Salvador
2012-06-17 12:58 ` [U-Boot] [PATCH 3/3] mx28evk: extend default environment Otavio Salvador
2012-06-17 21:54 ` [U-Boot] [PATCH 0/3] i.MX refactoring patchset 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=201206171528.18141.marex@denx.de \
    --to=marex@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