[U-Boot] [PATCH] IXP425: Improving print_cpuinfo code Part 1/1

Jean-Christophe PLAGNIOL-VILLARD plagnioj at jcrosoft.com
Tue Dec 16 22:54:07 CET 2008


On 22:09 Thu 04 Dec     , Stefan Althoefer wrote:
> [PATCH] IXP425: Improving print_cpuinfo code
> 
> The existing version of print_cpuinfo did read the
> processor ID and detects clock speed from this.
> 
> This is not correct, as the IXP425 has the ability
> to "downgrade" clock speed by using strapping resistors.
> 
> The improved code reads strapping information from
> register and corrects the actual clock speed. Both
> information are displayed.
> 
> 
> The patch is against "latest" u-boot git-repository
> 
> Please (still) be patient if style of submission or patches are
> offending.
> 
> Signed-off-by: Stefan Althoefer <stefan.althoefer at web.de>
> ----
> 
> diff -uprN u-boot-orig//cpu/ixp/cpu.c u-boot/cpu/ixp/cpu.c
> --- u-boot-orig//cpu/ixp/cpu.c	2008-12-02 17:25:31.000000000 +0100
> +++ u-boot/cpu/ixp/cpu.c	2008-12-03 11:35:37.000000000 +0100
> @@ -45,32 +45,68 @@ DECLARE_GLOBAL_DATA_PTR;
>  int print_cpuinfo (void)
>  {
>  	unsigned long id;
> +	unsigned long cfg_clk;
>  	int speed = 0;
> +	int model = 0;
>  
>  	asm ("mrc p15, 0, %0, c0, c0, 0":"=r" (id));
> +	cfg_clk = *IXP425_EXP_CFG0 >> 21;
please use readx/writex 
>  
> -	puts("CPU:   Intel IXP425 at ");
> +	puts("CPU:   Intel IXP42X");
>  	switch ((id & 0x000003f0) >> 4) {
>  	case 0x1c:
> -		loops_per_jiffy = 887467;
> -		speed = 533;
> +		model = 533;
> +		switch (cfg_clk) {
> +		case 0x1:
> +			speed = 400;
> +			break;
> +		case 0x3:
> +			speed = 266;
> +			break;
> +		default:
> +			speed = 533;
> +			break;
> +		}
>  		break;
>  
>  	case 0x1d:
> -		loops_per_jiffy = 666016;
> -		speed = 400;
> +		model = 400;
> +		switch (cfg_clk) {
> +		case 0x3:
> +			speed = 266;
> +			break;
> +		default:
> +			speed = 400;
> +			break;
> +		}
>  		break;
>  
>  	case 0x1f:
> -		loops_per_jiffy = 442901;
> +		model = 266;
>  		speed = 266;
>  		break;
>  	}
>  
> +	/* FIXME: is there any need for the jiffies? */
	for the IRQ delay
> +	switch (speed) {
> +	case 266:
> +		loops_per_jiffy = 442901;
> +		break;
> +	case 400:
> +		loops_per_jiffy = 666016;
> +		break;
> +	case 533:
> +		loops_per_jiffy = 887467;
> +		break;
> +	}
Best Regards,
J.


More information about the U-Boot mailing list