Updated code to print OMAP4 cpu info.
PATCH 1/1 Updated code to print OMAP4 cpu info.
---
arch/arm/cpu/armv7/omap4/sys_info.c | 150 +++++++++++++++++++++++++++++++++--
1 files changed, 144 insertions(+), 6 deletions(-)
(quoted diff) +0 -0
b/arch/arm/cpu/armv7/omap4/sys_info.c
index b9e5765..14145fb 100644
arch/arm/cpu/armv7/omap4/sys_info.c +20 -2
@@ -3,8 +3,9 @@* Texas Instruments, <www.ti.com> * * Author : -* Aneesh V <[email protected]> -* Steve Sakoman <[email protected]> +* Aneesh V <[email protected]> +* Steve Sakoman <[email protected]> +* Asad Akbar <[email protected]> * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as
@@ -25,12 +26,40 @@#include <common.h> #include <asm/arch/sys_proto.h> +/** +* Registers addresses. +*/ +#define DEVICE_IDENTIFICATION_BASE 0x4A002000 +#define DIE_ID_0 0x200 +#define ID_CODE 0x204 +#define DIE_ID_1 0x208 +#define DIE_ID_2 0x20C +#define DIE_ID_3 0x210 +#define PROD_ID_0 0x214 +#define PROD_ID_1 0x218 + +/** +* Device types +*/ +#define DEVICE_TYPE_GP 0xF0 +#define DEVICE_TYPE_HS 0xF1/* TODO: It has to be
updated. */
+#define DEVICE_TYPE_EMU 0xF2 /* TODO: It has to be
updated. */
+#define DEVICE_TYPE_TST 0xF3 /* TODO: It has to be
updated. */
+
/*
* get_device_type(): tell if GP/HS/EMU/TST
*/
u32 get_device_type(void)
{
- return 0;
+ u32 val32;
+
+ /* Reader PROD_ID_0 register. */
+ val32 = __raw_readl (DEVICE_IDENTIFICATION_BASE + PROD_ID_0);
+
+ /* Get only device type bits. */
+ val32 &= 0xFF;
+
+ return (val32);
}
/*
@@ -38,7 +67,7 @@ u32 get_device_type(void)
*/
u32 get_board_rev(void)
{
- return 0x20;
+ return 0x20;
}
/*
@@ -46,8 +75,117 @@ u32 get_board_rev(void)
*/
int print_cpuinfo(void)
{
+ u32 val32;
+ u32 id[4] = { 0 };
+
+ /* Reader ID_CODE register. */
+ val32 = __raw_readl (DEVICE_IDENTIFICATION_BASE + ID_CODE);
+
+ /* Make sure that it is as per documentation. */
+ if (val32 & 0x1)
+ {+ /**
+ * Get silicon type.
+ */
+ if (val32 == 0x0B85202F)
+ {
+ printf("Silicon Type: OMAP4430 ES1.0\n");
+ }
+ else if (val32 == 0x1B85202F)
+ {
+ printf("Silicon Type: OMAP4430 ES2.0\n");
+ }
+ else if (val32 == 0x3B95C02F)
+ {
+ printf("Silicon Type: OMAP4430 ES2.1\n");
+ }
+ else
+ {+ printf("Silicon Type: Unknown\n");
+ }
+
+ /**
+ * Get version.
+ */
+ u8 version = (val32 >> 28) & 0xFF;
+
+ switch(version)
+ {
+ case 0:+ printf("Version: OMAP4430 ES1.0\n");
+ break;
+
+ case 1:
+ printf("Version: OMAP4430 ES2.0\n");
+ break;
+
+ case 3:
+ printf("Version: OMAP4430 ES2.1\n");
+ break;
+
+ default:
+ printf("Version: Unknown\n");
+ break;
+ }
+
+ /**
+ * Get Hawkeye
+ */
+ u16 hawkeye = (val32 >> 12) & 0xFFFFF;
+
+ if (hawkeye == 0xB852)
+ {
+ printf("Hawkeye: OMAP4430 ES1.0 and
ES2.0\n");
+ }
+ else if (hawkeye == 0xB95C)
+ {+ printf("Hawkeye: OMAP4430 ES2.1\n");
+ }
+
+ /**
+ * Get TI IDM.
+ */
+ printf("Manufacturer Identity (TI): 0x%X\n", (val32 >> 1));
+ }
+ else
+ {+ printf("%s\n", "omap_silicon_revision: TI_IDM bit is not found.");
+ }
+
+ /* Get device type. */
+ u8 device_type = get_device_type();
+
+ switch (device_type)
+ {
+ case DEVICE_TYPE_TST:
+ printf("Device Type: %s\n", "TST");
+ break;
+ case DEVICE_TYPE_EMU:
+ printf("Device Type: %s\n", "EMU");
+ break;
+ case DEVICE_TYPE_HS:
+ printf("Device Type: %s\n", "HS");
+ break;
+ case DEVICE_TYPE_GP:
+ printf("Device Type: %s\n", "GP");
+ break;
+ default:
+ printf("Device Type: %s\n", "???");
+ }
+
+ /* Get Die-id */ + id[0] = __raw_readl(DEVICE_IDENTIFICATION_BASE + DIE_ID_0); + id[1] = __raw_readl(DEVICE_IDENTIFICATION_BASE + DIE_ID_1); + id[2] = __raw_readl(DEVICE_IDENTIFICATION_BASE + DIE_ID_2); + id[3] = __raw_readl(DEVICE_IDENTIFICATION_BASE + DIE_ID_3);
+
+ printf("Die-ID: %08X-%08X-%08X-%08X\n", id[3],
id[2], id[1], id[0]);
+
+ /* Get prod-id */ + id[0] = __raw_readl(DEVICE_IDENTIFICATION_BASE + PROD_ID_0); + id[1] = __raw_readl(DEVICE_IDENTIFICATION_BASE + PROD_ID_1);
- puts("CPU : OMAP4430\n");
+ printf("Prod-id: %08X-%08X\n", id[1], id[0]);
- return 0;
+ return 0;
}
--
1.7.4.1
PATCH 1/1 Updated code to print OMAP4 cpu info.
Dear Asad Akbar,
Quoted 5 lines · In message <[email protected]> you…
--===============1953672346==
Content-Type: multipart/alternative; boundary=90e6ba4fc2ea812fab049e842c5a--90e6ba4fc2ea812fab049e842c5a
Content-Type: text/plain; charset=ISO-8859-1
Please send patches always in-line, never as attachements.
Quoted 1 line
---
arch/arm/cpu/armv7/omap4/sys_info.c line 8
Quoted 9 lines
arch/arm/cpu/armv7/omap4/sys_info.c +3
-2@@ -3,8 +3,9 @@* Texas Instruments, <www.ti.com> * * Author : -* Aneesh V <[email protected]> -* Steve Sakoman <[email protected]> +* Aneesh V <[email protected]> +* Steve Sakoman <[email protected]> +* Asad Akbar <[email protected]>
Please omit unrelated changes.
arch/arm/cpu/armv7/omap4/sys_info.c line 39
Quoted 11 lines
arch/arm/cpu/armv7/omap4/sys_info.c +11
-0+/** +* Registers addresses. +*/ +#define DEVICE_IDENTIFICATION_BASE 0x4A002000 +#define DIE_ID_0 0x200 +#define ID_CODE 0x204 +#define DIE_ID_1 0x208 +#define DIE_ID_2 0x20C +#define DIE_ID_3 0x210 +#define PROD_ID_0 0x214 +#define PROD_ID_1 0x218
Please use a C struct instead.
Quoted 7 lines
arch/arm/cpu/armv7/omap4/sys_info.c +2
-0+#define DEVICE_TYPE_GP 0xF0 +#define DEVICE_TYPE_HS 0xF1/* TODO: It has to be updated. */
+#defineDEVICE_TYPE_EMU0xF2/* TODO: It has to be
updated. */
+#defineDEVICE_TYPE_TST0xF3/* TODO: It has to be
updated. */
Your patch is corrupted by line wrapping. Please use "git send-email" to submit patches. See
http://www.denx.de/wiki/U-Boot/Patches
Review
Quoted 2 lines
(quoted diff) +2
-0+ /* Reader PROD_ID_0 register. */ + val32 = __raw_readl (DEVICE_IDENTIFICATION_BASE + PROD_ID_0);
NAK. Please use C structs.
Are you absolutely sure that you must use __raw_readl() here?
Also, there are white space errors. Please make sure to run your patch through checkpatch.pl before submitting.
Review
Quoted 4 lines
u32
get_board_rev(void)
{(quoted diff) +1
-1- return 0x20; + return 0x20;
NAK. Please stick to the coding style.
Quoted 11 lines
int
print_cpuinfo(void)
{(quoted diff) +9
-0+ u32 val32; + u32 id[4] = { 0 }; + + /* Reader ID_CODE register. */ + val32 = __raw_readl (DEVICE_IDENTIFICATION_BASE + ID_CODE); + + /* Make sure that it is as per documentation. */ + if (val32 & 0x1) + {
Review
Quoted 10 lines
(quoted diff) +10
-0+ /** + * Get silicon type. + */ + if (val32 == 0x0B85202F) + { + printf("Silicon Type: OMAP4430 ES1.0\n"); + } + else if (val32 == 0x1B85202F) + { + printf("Silicon Type: OMAP4430 ES2.0\n");
NAK. Please stick to the coding style.
Best regards,
Wolfgang Denk
Signature · 7 lines
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
Brontosaurus Principle: Organizations can grow faster than their
brains can manage them in relation to their environment and to their
own physiology: when this occurs, they are an endangered species.
- Thomas K. Connellan