
--- arch/arm/cpu/armv7/omap4/sys_ info.c | 150 +++++++++++++++++++++++++++++++++-- 1 files changed, 144 insertions(+), 6 deletions(-)
diff --git a/arch/arm/cpu/armv7/omap4/sys_info.c b/arch/arm/cpu/armv7/omap4/sys_info.c index b9e5765..14145fb 100644 --- a/arch/arm/cpu/armv7/omap4/sys_info.c +++ b/arch/arm/cpu/armv7/omap4/sys_info.c @@ -3,8 +3,9 @@ * Texas Instruments, <www.ti.com> * * Author : - * Aneesh V aneesh@ti.com - * Steve Sakoman steve@sakoman.com + * Aneesh V aneesh@ti.com + * Steve Sakoman steve@sakoman.com + * Asad Akbar asadakbar@gmail.com * * 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