[U-Boot] [PATCH v2 3/3] mxs: generalize code for print_cpuinfo()
Fabio Estevam
festevam at gmail.com
Mon Jun 25 05:23:41 CEST 2012
On Sun, Jun 24, 2012 at 6:34 PM, Otavio Salvador
<otavio at ossystems.com.br> wrote:
> 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 at ossystems.com.br>
> Cc: Marek Vasut <marex at denx.de>
> Cc: Stefano Babic <sbabic at denx.de>
> Cc: Fabio Estevam <fabio.estevam at freescale.com>
>
> ---
> Changes since v1:
> * use ?? for unidentified revision and cpu type
> * use numeric revisions
>
> arch/arm/cpu/arm926ejs/mx28/mx28.c | 55 +++++++++++++++++++++++++-
> arch/arm/include/asm/arch-mx28/regs-digctl.h | 5 +++
> 2 files changed, 58 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/cpu/arm926ejs/mx28/mx28.c b/arch/arm/cpu/arm926ejs/mx28/mx28.c
> index a82ff25..5a527cf 100644
> --- a/arch/arm/cpu/arm926ejs/mx28/mx28.c
> +++ b/arch/arm/cpu/arm926ejs/mx28/mx28.c
> @@ -190,13 +190,64 @@ 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) & HW_DIGCTL_CHIPID_MASK) {
> + case HW_DIGCTL_CHIPID_MX28:
> + return "28";
> + case HW_DIGCTL_CHIPID_MX23:
> + return "23";
> + 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 "??";
> + }
> + case HW_DIGCTL_CHIPID_MX23:
> + switch (rev) {
> + case 0x0:
> + return "1.0";
> + case 0x1:
> + return "1.1";
> + case 0x2:
> + return "1.2";
> + case 0x3:
> + return "1.3";
> + case 0x4:
> + return "1.4";
> + 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 %s at rev%s MHz\n",
No, you are printing CPU: Freescale i.MX28 1.2 at rev454 MHz, which is
very confusing.
Correct is: CPU: Freescale i.MX28 rev1.2 at 454 MHz
More information about the U-Boot
mailing list