mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH] arm: cpuinfo: display the core name and version
@ 2013-07-14 13:47 Jan Luebbe
  2013-07-14 20:17 ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 3+ messages in thread
From: Jan Luebbe @ 2013-07-14 13:47 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
---
 arch/arm/cpu/cpuinfo.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/arch/arm/cpu/cpuinfo.c b/arch/arm/cpu/cpuinfo.c
index 8aea4b4..260d47b 100644
--- a/arch/arm/cpu/cpuinfo.c
+++ b/arch/arm/cpu/cpuinfo.c
@@ -31,6 +31,12 @@
 #define CPU_ARCH_ARMv6		8
 #define CPU_ARCH_ARMv7		9
 
+#define ARM_CPU_PART_CORTEX_A5      0xC050
+#define ARM_CPU_PART_CORTEX_A7      0xC070
+#define ARM_CPU_PART_CORTEX_A8      0xC080
+#define ARM_CPU_PART_CORTEX_A9      0xC090
+#define ARM_CPU_PART_CORTEX_A15     0xC0F0
+
 static void decode_cache(unsigned long size)
 {
 	int linelen = 1 << ((size & 0x3) + 3);
@@ -154,6 +160,33 @@ static int do_cpuinfo(int argc, char *argv[])
 	printf("implementer: %s\narchitecture: %s\n",
 			implementer, architecture);
 
+	if (cpu_arch == CPU_ARCH_ARMv7) {
+		unsigned int major, minor;
+		char *part;
+		major = (mainid >> 20) & 0xf;
+		minor = mainid & 0xf;
+		switch (mainid & 0xfff0) {
+		case ARM_CPU_PART_CORTEX_A5:
+			part = "Cortex-A5";
+			break;
+		case ARM_CPU_PART_CORTEX_A7:
+			part = "Cortex-A7";
+			break;
+		case ARM_CPU_PART_CORTEX_A8:
+			part = "Cortex-A8";
+			break;
+		case ARM_CPU_PART_CORTEX_A9:
+			part = "Cortex-A9";
+			break;
+		case ARM_CPU_PART_CORTEX_A15:
+			part = "Cortex-A15";
+			break;
+		default:
+			part = "unknown";
+		}
+		printf("core: %s r%up%u\n", part, major, minor);
+	}
+
 	if (cache & (1 << 24)) {
 		/* separate I/D cache */
 		printf("I-cache: ");
-- 
1.8.3.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm: cpuinfo: display the core name and version
  2013-07-14 13:47 [PATCH] arm: cpuinfo: display the core name and version Jan Luebbe
@ 2013-07-14 20:17 ` Jean-Christophe PLAGNIOL-VILLARD
  2013-07-15  6:53   ` Jan Lübbe
  0 siblings, 1 reply; 3+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2013-07-14 20:17 UTC (permalink / raw)
  To: Jan Luebbe; +Cc: barebox

On 15:47 Sun 14 Jul     , Jan Luebbe wrote:
> Signed-off-by: Jan Luebbe <jlu@pengutronix.de>
> ---
>  arch/arm/cpu/cpuinfo.c | 33 +++++++++++++++++++++++++++++++++
>  1 file changed, 33 insertions(+)
> 
> diff --git a/arch/arm/cpu/cpuinfo.c b/arch/arm/cpu/cpuinfo.c
> index 8aea4b4..260d47b 100644
> --- a/arch/arm/cpu/cpuinfo.c
> +++ b/arch/arm/cpu/cpuinfo.c
> @@ -31,6 +31,12 @@
>  #define CPU_ARCH_ARMv6		8
>  #define CPU_ARCH_ARMv7		9
>  
> +#define ARM_CPU_PART_CORTEX_A5      0xC050
> +#define ARM_CPU_PART_CORTEX_A7      0xC070
> +#define ARM_CPU_PART_CORTEX_A8      0xC080
> +#define ARM_CPU_PART_CORTEX_A9      0xC090
> +#define ARM_CPU_PART_CORTEX_A15     0xC0F0
> +

reuse instead

arch/arm/include/asm/system_info.h

Best Regards,
J.
>  static void decode_cache(unsigned long size)
>  {
>  	int linelen = 1 << ((size & 0x3) + 3);
> @@ -154,6 +160,33 @@ static int do_cpuinfo(int argc, char *argv[])
>  	printf("implementer: %s\narchitecture: %s\n",
>  			implementer, architecture);
>  
> +	if (cpu_arch == CPU_ARCH_ARMv7) {
> +		unsigned int major, minor;
> +		char *part;
> +		major = (mainid >> 20) & 0xf;
> +		minor = mainid & 0xf;
> +		switch (mainid & 0xfff0) {
> +		case ARM_CPU_PART_CORTEX_A5:
> +			part = "Cortex-A5";
> +			break;
> +		case ARM_CPU_PART_CORTEX_A7:
> +			part = "Cortex-A7";
> +			break;
> +		case ARM_CPU_PART_CORTEX_A8:
> +			part = "Cortex-A8";
> +			break;
> +		case ARM_CPU_PART_CORTEX_A9:
> +			part = "Cortex-A9";
> +			break;
> +		case ARM_CPU_PART_CORTEX_A15:
> +			part = "Cortex-A15";
> +			break;
> +		default:
> +			part = "unknown";
> +		}
> +		printf("core: %s r%up%u\n", part, major, minor);
> +	}
> +
>  	if (cache & (1 << 24)) {
>  		/* separate I/D cache */
>  		printf("I-cache: ");
> -- 
> 1.8.3.2
> 
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] arm: cpuinfo: display the core name and version
  2013-07-14 20:17 ` Jean-Christophe PLAGNIOL-VILLARD
@ 2013-07-15  6:53   ` Jan Lübbe
  0 siblings, 0 replies; 3+ messages in thread
From: Jan Lübbe @ 2013-07-15  6:53 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Sun, 2013-07-14 at 22:17 +0200, Jean-Christophe PLAGNIOL-VILLARD
wrote:
> > +#define ARM_CPU_PART_CORTEX_A5      0xC050
> > +#define ARM_CPU_PART_CORTEX_A7      0xC070
> > +#define ARM_CPU_PART_CORTEX_A8      0xC080
> > +#define ARM_CPU_PART_CORTEX_A9      0xC090
> > +#define ARM_CPU_PART_CORTEX_A15     0xC0F0
> > +
> 
> reuse instead
> 
> arch/arm/include/asm/system_info.h

Thanks. So cpuinfo.c should probably reworked based on that code.
I'll take a look.

Regards,
Jan
-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2013-07-15  6:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-14 13:47 [PATCH] arm: cpuinfo: display the core name and version Jan Luebbe
2013-07-14 20:17 ` Jean-Christophe PLAGNIOL-VILLARD
2013-07-15  6:53   ` Jan Lübbe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox