[U-Boot] [PATCH 3/4] OMAP3, AM35x: Update function print_cpuinfo()

Wolfgang Denk wd at denx.de
Wed Dec 16 23:13:30 CET 2009


Dear Sanjeev Premi,

In message <1260902266-26009-4-git-send-email-premi at ti.com> you wrote:
> The function is updated to make use of the cpu related
> information extracted in arch_cpu_init().
> 
> Signed-off-by: Sanjeev Premi <premi at ti.com>
> ---
>  cpu/arm_cortexa8/omap3/sys_info.c |   45 ++++++++++++++++++++++++------------
>  1 files changed, 30 insertions(+), 15 deletions(-)
> 
> diff --git a/cpu/arm_cortexa8/omap3/sys_info.c b/cpu/arm_cortexa8/omap3/sys_info.c
> index 3544d26..1228f5f 100644
> --- a/cpu/arm_cortexa8/omap3/sys_info.c
> +++ b/cpu/arm_cortexa8/omap3/sys_info.c
> @@ -364,45 +364,60 @@ u32 get_device_type(void)
>   */
>  int print_cpuinfo (void)
>  {
> -	char *cpu_s, *sec_s;
> +	char cpu_s[16], sec_s[4];
>  
> -	switch (get_cpu_type()) {
> +	switch (cpu_id) {
>  	case OMAP3503:
> -		cpu_s = "3503";
> +		strcpy(cpu_s, "OMAP3503");
>  		break;
>  	case OMAP3515:
> -		cpu_s = "3515";
> +		strcpy(cpu_s, "OMAP3515");
>  		break;
>  	case OMAP3525:
> -		cpu_s = "3525";
> +		strcpy(cpu_s, "OMAP3503");
>  		break;
> +	case OMAP3430:
>  	case OMAP3530:
> -		cpu_s = "3530";
> +		strcpy(cpu_s, "OMAP3430/3530");
>  		break;
> -	default:
> -		cpu_s = "35XX";
> +	case CTRL_AM3505:
> +		strcpy(cpu_s, "AM3505");
> +		break;
> +	case CTRL_AM3517:
> +		strcpy(cpu_s, "AM3517");
>  		break;
> +
> +	default:
> +		if (cpu_family == CPU_AM35XX)
> +			strcpy(cpu_s, "AM35xx");
> +		else
> +			strcpy(cpu_s, "OMAP34xx/35xx");
>  	}
>  
>  	switch (get_device_type()) {
>  	case TST_DEVICE:
> -		sec_s = "TST";
> +		strcpy(sec_s, "TST");
>  		break;
>  	case EMU_DEVICE:
> -		sec_s = "EMU";
> +		strcpy(sec_s, "EMU");
>  		break;
>  	case HS_DEVICE:
> -		sec_s = "HS";
> +		strcpy(sec_s, "HS");
>  		break;
>  	case GP_DEVICE:
> -		sec_s = "GP";
> +		strcpy(sec_s, "GP");
>  		break;
>  	default:
> -		sec_s = "?";
> +		strcpy(sec_s, "?");
>  	}
>  
> -	printf("OMAP%s-%s ES%s, CPU-OPP2 L3-165MHz\n",
> -			cpu_s, sec_s, rev_s[get_cpu_rev()]);
> +	/*
> +	 * TBD: Revision numbers for AM35x may not be same as OMAP35x.
> +	 *      Will need to re-look sometime later.
> +	 */
> +	printf("%s-%s ES%s,%s L3-165MHz\n",
> +			cpu_s, sec_s, rev_s[get_cpu_rev()],
> +			(cpu_family == CPU_AM35XX) ? "" : " CPU-OPP2");

Changing pointers to constant strings into using an array with lots of
function calls (strcpy()) makes no sense to me. I think the resulting
code is just bigger and slower.

Or am I overlooking something?

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"It's when they say 2 + 2 = 5 that I begin to argue."    - Eric Pepke


More information about the U-Boot mailing list