Skip to contentSkip to conversation

Add display cpuinfo for Atmel at91sam9261 Cores

PATCH Superseded Remy Bohmer 3 participants 9 messages May 2, 2009 – Jun 2, 2009 Arm/Microchip (AT91) SoC support

lore
Share & tools
lore
#1 lore raw

PATCH 1/1 Add display cpuinfo for Atmel at91sam9261 Cores

Quoted 3 lines · Remy Bohmer

This patch adds support for displaying CPU type information
about Atmel AT91 cores during boot. It currently only configures it for the at91sam9261ek board, but it can easily be configured for all at91 based cores.

please do this in two seperate patch
please ask Stelian
CC
btw please use git

Quoted 37 lines

This patch also provides at91_dbgu.h which is also used by the upcoming USB CDC-ethernet and USB-gadget support for this board.

---
 cpu/arm926ejs/at91/Makefile           |    1 
 cpu/arm926ejs/at91/cpuinfo.c          |   83 ++++++++++++++++++++++++++++
 include/asm-arm/arch-at91/at91_dbgu.h |   69 +++++++++++++++++++++++
 include/asm-arm/arch-at91/cpu.h       |   99 ++++++++++++++++++++++++++++++++++
 include/configs/at91sam9261ek.h       |    2 
 5 files changed, 254 insertions(+)
 create mode 100644 cpu/arm926ejs/at91/cpuinfo.c
 create mode 100644 include/asm-arm/arch-at91/at91_dbgu.h
 create mode 100644 include/asm-arm/arch-at91/cpu.h

Index: u-boot-usb.tmp/cpu/arm926ejs/at91/Makefile
===================================================================

cpu/arm926ejs/at91/Makefile +1 -0
@@ -55,6 +55,7 @@ COBJS-y				+= at91sam9rl_serial.o
 COBJS-$(CONFIG_HAS_DATAFLASH)	+= at91sam9rl_spi.o
 endif
 COBJS-$(CONFIG_AT91_LED)	+= led.o
+COBJS-$(CONFIG_DISPLAY_CPUINFO) +=cpuinfo.o
 COBJS-y += clock.o
 COBJS-y += cpu.o
 COBJS-y	+= timer.o

Index: u-boot-usb.tmp/cpu/arm926ejs/at91/cpuinfo.c
===================================================================

cpu/arm926ejs/at91/cpuinfo.c new file +4 -0
@@ -0,0 +1,83 @@
+#include <command.h>
+#include <common.h>
+#include <arm926ejs.h>
+#include <asm/hardware.h>

cpu/arm926ejs/at91/cpuinfo.c line 14

Quoted 10 lines
cpu/arm926ejs/at91/cpuinfo.c new file +10 -0
+#include <asm/arch/at91_dbgu.h>
+#include <asm/arch/io.h>
+
+int print_cpuinfo(void)
+{
+	unsigned long cidr;
+	const char *txt;
+
+	cidr = at91_sys_read(AT91_DBGU_CIDR);
+

could you use the CONFIG_ARM926EJS and other configs to reduce the size impact

cpu/arm926ejs/at91/cpuinfo.c line 22

Quoted 8 lines
cpu/arm926ejs/at91/cpuinfo.c new file +8 -0
+	switch ((cidr & AT91_CIDR_EPROC) >> 5) {
+	case 0x1: txt = "ARM946ES";	break;
+	case 0x2: txt = "ARM7TDMI";	break;
+	case 0x4: txt = "ARM920T";	break;
+	case 0x5: txt = "ARM926EJS";	break;
+	default:  txt = "undefined";	break;
+	}
+	printf("Embedded Processor: %s\n", txt);

otherwise ok

Best Regards,
J.

#2 lore raw

PATCH v2 1/1 Add display cpuinfo for Atmel at91 arm926ejs based cores

---
V2 reworked comments from Jean-Christophe PLAGNIOL-VILLARD

 cpu/arm926ejs/at91/Makefile           |    1 +
 cpu/arm926ejs/at91/cpuinfo.c          |   65 +++++++++++++++++++++
 include/asm-arm/arch-at91/at91_dbgu.h |   69 +++++++++++++++++++++++
 include/asm-arm/arch-at91/cpu.h       |   99 +++++++++++++++++++++++++++++++++
 4 files changed, 234 insertions(+), 0 deletions(-)
 create mode 100644 cpu/arm926ejs/at91/cpuinfo.c
 create mode 100644 include/asm-arm/arch-at91/at91_dbgu.h
 create mode 100644 include/asm-arm/arch-at91/cpu.h
cpu/arm926ejs/at91/Makefile +1 -0
index 71acb0b..5c970a1 100644
@@ -32,6 +32,7 @@ COBJS-$(CONFIG_AT91SAM9261)	+= at91sam9261_devices.o
 COBJS-$(CONFIG_AT91SAM9263)	+= at91sam9263_devices.o
 COBJS-$(CONFIG_AT91SAM9RL)	+= at91sam9rl_devices.o
 COBJS-$(CONFIG_AT91_LED)	+= led.o
+COBJS-$(CONFIG_DISPLAY_CPUINFO) +=cpuinfo.o
 COBJS-y += clock.o
 COBJS-y += cpu.o
 COBJS-y	+= timer.o
cpu/arm926ejs/at91/cpuinfo.c new file +65 -0

65 lines not on this page · raw message

include/asm-arm/arch-at91/at91_dbgu.h new file +69 -0

69 lines not on this page · raw message

include/asm-arm/arch-at91/cpu.h new file +99 -0

99 lines not on this page · raw message

Signature · 1 line
1.6.0.4
#3 lore raw

PATCH 1/1 Enable display CPU-Info for at91sam9261

---
 include/configs/at91sam9261ek.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
include/configs/at91sam9261ek.h +2 -0
index fdaa71c..9a50347 100644
@@ -45,6 +45,8 @@
 #define CONFIG_SKIP_LOWLEVEL_INIT
 #define CONFIG_SKIP_RELOCATE_UBOOT
 
+#define CONFIG_DISPLAY_CPUINFO          1
+
 /*
  * Hardware drivers
  */
Signature · 1 line
1.6.0.4
#4 lore raw

PATCH 1/1 Enable display CPU-Info for at91sam9261

Quoted 10 lines · Remy Bohmer
---
 include/configs/at91sam9261ek.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
include/configs/at91sam9261ek.h +0 -0
index fdaa71c..9a50347 100644

include/configs/at91sam9261ek.h line 48

Quoted 4 lines
include/configs/at91sam9261ek.h +1 -0
@@ -45,6 +45,8 @@
 #define CONFIG_SKIP_LOWLEVEL_INIT
 #define CONFIG_SKIP_RELOCATE_UBOOT
 
+#define CONFIG_DISPLAY_CPUINFO          1

For homogeneity reasons, since this is a generic AT91 config option, I think it makes sense to define this by default for all the AT91 boards - or not define it at all. Your pick.

Stelian.

Signature · 1 line
Stelian Pop <[email protected]>
#5 lore raw

PATCH 1/1 Enable display CPU-Info for at91sam9261

Quoted 15 lines · Stelian Pop
Quoted 13 lines · Remy Bohmer
---
 include/configs/at91sam9261ek.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
include/configs/at91sam9261ek.h +0 -0
index fdaa71c..9a50347 100644
@@ -45,6 +45,8 @@
 #define CONFIG_SKIP_LOWLEVEL_INIT
 #define CONFIG_SKIP_RELOCATE_UBOOT
 
Quoted 5 lines

include/configs/at91sam9261ek.h line 48

Quoted 1 line
include/configs/at91sam9261ek.h +1 -0
+#define CONFIG_DISPLAY_CPUINFO          1

For homogeneity reasons, since this is a generic AT91 config option, I think it makes sense to define this by default for all the AT91 boards - or not define it at all. Your pick.

for the Atmel's ref boards maybe but for other boards we need to let this choice to each board Maintainer

Best Regards,
J.

#6 lore raw

PATCH 1/1 Enable display CPU-Info for at91sam9261

Hello,

Quoted 9 lines
Quoted 9 lines
Quoted 5 lines
(quoted diff) +0 -0
@@ -45,6 +45,8 @@

?#define CONFIG_SKIP_LOWLEVEL_INIT
?#define CONFIG_SKIP_RELOCATE_UBOOT

+#define CONFIG_DISPLAY_CPUINFO ? ? ? ? ?1

For homogeneity reasons, since this is a generic AT91 config option, I think it makes sense to define this by default for all the AT91 boards - or not define it at all. Your pick.

Well, I only have the at91sam9261ek board, and as such it is the only one I can test.
I do not prefer enabling things for boards I cannot test. Once the framework is there it can be enabled, if desired.

Quoted 2 lines

for the Atmel's ref boards maybe but for other boards we need to let this choice to each board Maintainer

I agree on that.

Kind Regards,

Remy

#7 lore raw

PATCH v2 1/1 Add display cpuinfo for Atmel at91 arm926ejs based cores

In reply to Remy Bohmer

Hi R?my,

I do have a few comments, see below:

Quoted 1 line · Remy Bohmer

V2 reworked comments from Jean-Christophe PLAGNIOL-VILLARD

[...]

Quoted 1 line

+COBJS-$(CONFIG_DISPLAY_CPUINFO) +=cpuinfo.o

missing space ?

cpu/arm926ejs/at91/cpuinfo.c line 18

Quoted 4 lines
cpu/arm926ejs/at91/cpuinfo.c new file +4 -0
+	switch ((cidr & AT91_CIDR_EPROC) >> 5) {
+	 /* 0x1 = ARM946ES, 0x2 = ARM7TDMI, 0x4 = ARM920T */
+	case 0x5: txt = "ARM926EJS";	break;
+	default:  txt = "undefined";	break;

since there are only four choices (until now at least...), why not put the 'txt' for all of them ?

and the 'undefined' string is not a good choice: it represents a configuration not known to U-Boot, but its numeric value is well defined. So I suggest you change this to 'unknown', or even better, 'unknown: 0xfoo'.

cpu/arm926ejs/at91/cpuinfo.c line 26

Quoted 8 lines
cpu/arm926ejs/at91/cpuinfo.c new file +8 -0
+	}
+	printf("Embedded Processor: %s\n", txt);
+
+	switch ((cidr & AT91_CIDR_ARCH) >> 20) {
+	case 0x19: txt = "AT91SAM9xx";		break;
+	case 0x29: txt = "AT91SAM9XExx";	break;
+	case 0x39: txt = "CAP9";		break;
+	default:   txt = "undefined";		break;

same comments as above for 'undefined'.

cpu/arm926ejs/at91/cpuinfo.c line 38

Quoted 7 lines
cpu/arm926ejs/at91/cpuinfo.c new file +7 -0
+	switch ((cidr & AT91_CIDR_NVPTYP) >> 28) {
+	case 0x0: txt = "ROM";				 break;
+	case 0x1: txt = "ROMless or onchip flash";	 break;
+	case 0x2: txt = "Embedded flash memory";	 break;
+	case 0x3: txt = "ROM and Embedded flash memory"; break;
+	case 0x4: txt = "SRAM emulating ROM";		 break;
+	default:  txt = "undefined";			 break;

ditto.

Quoted 6 lines
cpu/arm926ejs/at91/cpuinfo.c new file +6 -0
+	switch (cidr & AT91_CIDR_SRAMSIZ) {
+	case AT91_CIDR_SRAMSIZ_1K: txt = "1K";		break;
+	case AT91_CIDR_SRAMSIZ_2K: txt = "2K";		break;
+	case AT91_CIDR_SRAMSIZ_112K: txt = "112K";	break;
+	case AT91_CIDR_SRAMSIZ_4K: txt = "4K";		break;
+	case AT91_CIDR_SRAMSIZ_80K: txt = "80K";	break;

cpu/arm926ejs/at91/cpuinfo.c line 57

Quoted 10 lines
cpu/arm926ejs/at91/cpuinfo.c new file +10 -0
+	case AT91_CIDR_SRAMSIZ_160K: txt = "160K";	break;
+	case AT91_CIDR_SRAMSIZ_8K: txt = "8K";		break;
+	case AT91_CIDR_SRAMSIZ_16K: txt = "16K";	break;
+	case AT91_CIDR_SRAMSIZ_32K: txt = "32K";	break;
+	case AT91_CIDR_SRAMSIZ_64K: txt = "64K";	break;
+	case AT91_CIDR_SRAMSIZ_128K: txt = "128K";	break;
+	case AT91_CIDR_SRAMSIZ_256K: txt = "256K";	break;
+	case AT91_CIDR_SRAMSIZ_96K: txt = "96K";	break;
+	case AT91_CIDR_SRAMSIZ_512K: txt = "512K";	break;
+	default:  txt = "undefined";			break;

bad alignment here (you did align the 'txt =' properly in all other switch/case statements, but not here).

ditto for 'undefined'.

Stelian.

Signature · 1 line
Stelian Pop <[email protected]>
#8 lore raw

PATCH v2 1/1 Add display cpuinfo for Atmel at91 arm926ejs based cores

Quoted 13 lines · Stelian Pop

Hi R?my,

I do have a few comments, see below:

Quoted 1 line · Remy Bohmer

V2 reworked comments from Jean-Christophe PLAGNIOL-VILLARD

[...]

Quoted 1 line

+COBJS-$(CONFIG_DISPLAY_CPUINFO) +=cpuinfo.o

missing space ?

Quoted 7 lines

cpu/arm926ejs/at91/cpuinfo.c line 18

Quoted 4 lines
cpu/arm926ejs/at91/cpuinfo.c new file +4 -0
+	switch ((cidr & AT91_CIDR_EPROC) >> 5) {
+	 /* 0x1 = ARM946ES, 0x2 = ARM7TDMI, 0x4 = ARM920T */
+	case 0x5: txt = "ARM926EJS";	break;
+	default:  txt = "undefined";	break;

since there are only four choices (until now at least...), why not put the 'txt' for all of them ?

We need to use the ifdef to reduce the size impact and not implement non-supported code is important

Quoted 5 lines

and the 'undefined' string is not a good choice: it represents a configuration not known to U-Boot, but its numeric value is well defined. So I suggest you change this to 'unknown', or even better, 'unknown: 0xfoo'.

I agree

Best Regards,
J.