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

[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@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;
- 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? */ + switch (speed) { + case 266: + loops_per_jiffy = 442901; + break; + case 400: + loops_per_jiffy = 666016; + break; + case 533: + loops_per_jiffy = 887467; + break; + } + + if (model) + printf("-%d", model); + if (speed) - printf("%d MHz\n", speed); + printf(" at %d MHz\n", speed); else - puts("unknown revision\n"); + puts(" unknown revision\n");
return 0; }

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@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.

Jean-Christophe PLAGNIOL-VILLARD schrieb:
- cfg_clk = *IXP425_EXP_CFG0 >> 21;
please use readx/writex
The pointer dereference style is used throughout the other files in the IXP port as well. Shouldn't this be handled the same way in all files?
- /* FIXME: is there any need for the jiffies? */
for the IRQ delay
Ok, I overlooked it is used in start.S.
-- Stefan

On 23:28 Tue 16 Dec , Stefan Althoefer wrote:
Jean-Christophe PLAGNIOL-VILLARD schrieb:
- cfg_clk = *IXP425_EXP_CFG0 >> 21;
please use readx/writex
The pointer dereference style is used throughout the other files in the IXP port as well. Shouldn't this be handled the same way in all files?
yes it's old wrong way code for new we to use the good accessor
for old code patch are welcome
Best Regards, J.
participants (2)
-
Jean-Christophe PLAGNIOL-VILLARD
-
Stefan Althoefer