From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3] i.MX28: extend print_cpuinfo() to use chip information
Date: Mon, 16 Jul 2012 22:19:13 +0200 [thread overview]
Message-ID: <201207162219.13910.marex@denx.de> (raw)
In-Reply-To: <1342468772-6225-1-git-send-email-otavio@ossystems.com.br>
Dear Otavio Salvador,
> The information now is gathered from HW_DIGCTL_CHIPID register and
> includes the chip modem and revision on the output.
>
> Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
This one is OK with me, queue for next maybe?
Acked-by: Marek Vasut <marex@denx.de>
> ---
> Changes in v2:
> - use ?? for unidentified revision and cpu type
> - use numeric revisions
>
> Changes in v3:
> - drop mx23 data as it will be posted in a later patch
> - fix info order (first rev, then clock)
>
> arch/arm/cpu/arm926ejs/mx28/mx28.c | 38
> ++++++++++++++++++++++++-- arch/arm/include/asm/arch-mx28/regs-digctl.h |
> 4 +++
> 2 files changed, 40 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/cpu/arm926ejs/mx28/mx28.c
> b/arch/arm/cpu/arm926ejs/mx28/mx28.c index ff25772..cf7a50f 100644
> --- a/arch/arm/cpu/arm926ejs/mx28/mx28.c
> +++ b/arch/arm/cpu/arm926ejs/mx28/mx28.c
> @@ -188,13 +188,47 @@ int arch_cpu_init(void)
> }
>
> #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) & HW_DIGCTL_CHIPID_MASK) {
> + case HW_DIGCTL_CHIPID_MX28:
> + return "28";
> + default:
> + return "??";
> + }
> +}
> +
> +static const char *get_cpu_rev(void)
> +{
> + struct mx28_digctl_regs *digctl_regs =
> + (struct mx28_digctl_regs *)MXS_DIGCTL_BASE;
> + uint8_t rev = readl(&digctl_regs->hw_digctl_chipid) & 0x000000FF;
> +
> + switch (readl(&digctl_regs->hw_digctl_chipid) & HW_DIGCTL_CHIPID_MASK) {
> + case HW_DIGCTL_CHIPID_MX28:
> + switch (rev) {
> + case 0x1:
> + return "1.2";
> + default:
> + return "??";
> + }
> + default:
> + return "??";
> + }
> +}
> +
> 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%s 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;
> }
> diff --git a/arch/arm/include/asm/arch-mx28/regs-digctl.h
> b/arch/arm/include/asm/arch-mx28/regs-digctl.h index 9a63594..247da6e
> 100644
> --- a/arch/arm/include/asm/arch-mx28/regs-digctl.h
> +++ b/arch/arm/include/asm/arch-mx28/regs-digctl.h
> @@ -152,4 +152,8 @@ struct mx28_digctl_regs {
> };
> #endif
>
> +/* Product code identification */
> +#define HW_DIGCTL_CHIPID_MASK (0xffff << 16)
> +#define HW_DIGCTL_CHIPID_MX28 (0x2800 << 16)
> +
> #endif /* __MX28_REGS_DIGCTL_H__ */
Best regards,
Marek Vasut
next prev parent reply other threads:[~2012-07-16 20:19 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-07-16 19:59 [U-Boot] [PATCH v3] i.MX28: extend print_cpuinfo() to use chip information Otavio Salvador
2012-07-16 20:19 ` Marek Vasut [this message]
2012-07-16 20:38 ` Otavio Salvador
2012-07-17 7:50 ` 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=201207162219.13910.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.