All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/4] imx: mxs: reimplement get_cpu_rev
Date: Tue, 11 Aug 2015 12:45:46 +0200	[thread overview]
Message-ID: <55C9D25A.9090707@denx.de> (raw)
In-Reply-To: <1439211227-28030-3-git-send-email-Peng.Fan@freescale.com>

On 10/08/2015 14:53, Peng Fan wrote:
> Rewrite get_cpu_rev, from "static const char *get_cpu_rev(void)" to
> "u32 get_cpu_rev(void)". To align with get_cpu_rev of other i.MXes.
> 
> Also write get_imx_type to replace get_cpu_type, since we have
> macro named get_cpu_type.
> 
> Signed-off-by: Peng Fan <Peng.Fan@freescale.com>
> Cc: Stefano Babic <sbabic@denx.de>
> ---
>  arch/arm/cpu/arm926ejs/mxs/mxs.c          | 52 ++++++++++++++-----------------
>  arch/arm/include/asm/arch-mxs/sys_proto.h |  1 +
>  2 files changed, 25 insertions(+), 28 deletions(-)
> 
> diff --git a/arch/arm/cpu/arm926ejs/mxs/mxs.c b/arch/arm/cpu/arm926ejs/mxs/mxs.c
> index ef130ae..30dbf5e 100644
> --- a/arch/arm/cpu/arm926ejs/mxs/mxs.c
> +++ b/arch/arm/cpu/arm926ejs/mxs/mxs.c
> @@ -132,23 +132,7 @@ int arch_cpu_init(void)
>  	return 0;
>  }
>  
> -#if defined(CONFIG_DISPLAY_CPUINFO)
> -static const char *get_cpu_type(void)
> -{
> -	struct mxs_digctl_regs *digctl_regs =
> -		(struct mxs_digctl_regs *)MXS_DIGCTL_BASE;
> -
> -	switch (readl(&digctl_regs->hw_digctl_chipid) & HW_DIGCTL_CHIPID_MASK) {
> -	case HW_DIGCTL_CHIPID_MX23:
> -		return "23";
> -	case HW_DIGCTL_CHIPID_MX28:
> -		return "28";
> -	default:
> -		return "??";
> -	}
> -}
> -
> -static const char *get_cpu_rev(void)
> +u32 get_cpu_rev(void)
>  {
>  	struct mxs_digctl_regs *digctl_regs =
>  		(struct mxs_digctl_regs *)MXS_DIGCTL_BASE;
> @@ -158,38 +142,50 @@ static const char *get_cpu_rev(void)
>  	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";
> +			return (MXC_CPU_MX23 << 12) | (rev + 0x10);
>  		default:
> -			return "??";
> +			return 0;
>  		}
>  	case HW_DIGCTL_CHIPID_MX28:
>  		switch (rev) {
>  		case 0x1:
> -			return "1.2";
> +			return (MXC_CPU_MX28 << 12) | 0x12;
>  		default:
> -			return "??";
> +			return 0;
>  		}
>  	default:
> +		return 0;
> +	}
> +}
> +
> +#if defined(CONFIG_DISPLAY_CPUINFO)
> +const char *get_imx_type(u32 imxtype)
> +{
> +	switch (imxtype) {
> +	case MXC_CPU_MX23:
> +		return "23";	/* Quad-Plus version of the mx6 */
> +	case MXC_CPU_MX28:
> +		return "28";	/* Dual-Plus version of the mx6 */
> +	default:
>  		return "??";
>  	}
>  }
>  
>  int print_cpuinfo(void)
>  {
> +	u32 cpurev;
>  	struct mxs_spl_data *data = (struct mxs_spl_data *)
>  		((CONFIG_SYS_TEXT_BASE - sizeof(struct mxs_spl_data)) & ~0xf);
>  
> -	printf("CPU:   Freescale i.MX%s rev%s at %d MHz\n",
> -		get_cpu_type(),
> -		get_cpu_rev(),
> +	cpurev = get_cpu_rev();
> +	printf("CPU:   Freescale i.MX%s rev%d.%d at %d MHz\n",
> +	       get_imx_type((cpurev & 0xFF000) >> 12),
> +	       (cpurev & 0x000F0) >> 4,
> +	       (cpurev & 0x0000F) >> 0,
>  		mxc_get_clock(MXC_ARM_CLK) / 1000000);
>  	printf("BOOT:  %s\n", mxs_boot_modes[data->boot_mode_idx].mode);
>  	return 0;
> diff --git a/arch/arm/include/asm/arch-mxs/sys_proto.h b/arch/arm/include/asm/arch-mxs/sys_proto.h
> index 4678723..d6e9fdb 100644
> --- a/arch/arm/include/asm/arch-mxs/sys_proto.h
> +++ b/arch/arm/include/asm/arch-mxs/sys_proto.h
> @@ -11,6 +11,7 @@
>  #define __SYS_PROTO_H__
>  
>  #include <asm/imx-common/regs-common.h>
> +#include <../arch-imx/cpu.h>
>  
>  int mxs_reset_block(struct mxs_register_32 *reg);
>  int mxs_wait_mask_set(struct mxs_register_32 *reg,
> 

Reviewed-by: Stefano Babic <sbabic@denx.de>

Best regards,
Stefano Babic


-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

  reply	other threads:[~2015-08-11 10:45 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-10 12:53 [U-Boot] [PATCH 1/4] imx: add cpu type for i.MX2 and i.MX3 Peng Fan
2015-08-10 12:53 ` [U-Boot] [PATCH 2/4] imx: mx31 use new formula for get_cpu_rev Peng Fan
2015-08-11 10:45   ` Stefano Babic
2015-08-10 12:53 ` [U-Boot] [PATCH 3/4] imx: mxs: reimplement get_cpu_rev Peng Fan
2015-08-11 10:45   ` Stefano Babic [this message]
2015-08-10 12:53 ` [U-Boot] [PATCH 4/4] imx-common: consolidate macros and prototypes into sys_proto.h Peng Fan
2015-08-11 10:45   ` Stefano Babic
2015-08-12 15:49   ` Stefano Babic
2015-08-13  0:26     ` Peng Fan
2015-08-11 10:45 ` [U-Boot] [PATCH 1/4] imx: add cpu type for i.MX2 and i.MX3 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=55C9D25A.9090707@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 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.