From cdfc6fa722735fb6083dee0f139dcef00eb88809 Mon Sep 17 00:00:00 2001 From: Enric Balletbo i Serra Date: Wed, 25 May 2011 09:50:10 +0200 Subject: [PATCH] OMAP3: Move get_cpu_id() function to not duplicate code The get_cpu_id() function is implemented by various boards, this patch moves this function to a common place to not duplicate code. board/igep00x0/igep00x0.c :100:u32 get_cpu_id(void) board/overo/overo.c :165:u32 get_cpu_id(void) Signed-off-by: Enric Balletbo i Serra Signed-off-by: Anand Gadiyar --- board/igep00x0/igep00x0.c | 23 ----------------------- board/overo/overo.c | 23 ----------------------- cpu/omap3/sys_info.c | 23 +++++++++++++++++++++++ 3 files changed, 23 insertions(+), 46 deletions(-) diff --git a/board/igep00x0/igep00x0.c b/board/igep00x0/igep00x0.c index b9a1dcd..bb45637 100644 --- a/board/igep00x0/igep00x0.c +++ b/board/igep00x0/igep00x0.c @@ -93,29 +93,6 @@ u32 get_mem_type(void) return GPMC_ONENAND; } -/****************************************** - * get_cpu_id(void) - extract cpu id - * returns 0 for ES1.0, cpuid otherwise - ******************************************/ -u32 get_cpu_id(void) -{ - u32 cpuid = 0; - - /* - * On ES1.0 the IDCODE register is not exposed on L4 - * so using CPU ID to differentiate between ES1.0 and > ES1.0. - */ - __asm__ __volatile__("mrc p15, 0, %0, c0, c0, 0":"=r"(cpuid)); - if ((cpuid & 0xf) == 0x0) { - return 0; - } else { - /* Decode the IDs on > ES1.0 */ - cpuid = __raw_readl(CONTROL_IDCODE); - } - - return cpuid; -} - /***************************************************************** * sr32 - clear & set a value in a bit range for a 32 bit address *****************************************************************/ diff --git a/board/overo/overo.c b/board/overo/overo.c index b157b0e..165c503 100644 --- a/board/overo/overo.c +++ b/board/overo/overo.c @@ -158,29 +158,6 @@ u32 get_mem_type(void) } } -/****************************************** - * get_cpu_id(void) - extract cpu id - * returns 0 for ES1.0, cpuid otherwise - ******************************************/ -u32 get_cpu_id(void) -{ - u32 cpuid = 0; - - /* - * On ES1.0 the IDCODE register is not exposed on L4 - * so using CPU ID to differentiate between ES1.0 and > ES1.0. - */ - __asm__ __volatile__("mrc p15, 0, %0, c0, c0, 0":"=r"(cpuid)); - if ((cpuid & 0xf) == 0x0) { - return 0; - } else { - /* Decode the IDs on > ES1.0 */ - cpuid = __raw_readl(CONTROL_IDCODE); - } - - return cpuid; -} - /****************************************** * get_cpu_family(void) - extract cpu info ******************************************/ diff --git a/cpu/omap3/sys_info.c b/cpu/omap3/sys_info.c index 49ee4d5..8422b4e 100644 --- a/cpu/omap3/sys_info.c +++ b/cpu/omap3/sys_info.c @@ -41,3 +41,26 @@ u32 get_cpu_type(void) { return __raw_readl(CONTROL_OMAP_STATUS); } + +/* + * get_cpu_id(): extract cpu id + * returns 0 for ES1.0, cpuid otherwise + */ +u32 get_cpu_id(void) +{ + u32 cpuid = 0; + + /* + * On ES1.0 the IDCODE register is not exposed on L4 + * so using CPU ID to differentiate between ES1.0 and > ES1.0. + */ + __asm__ __volatile__("mrc p15, 0, %0, c0, c0, 0":"=r"(cpuid)); + if ((cpuid & 0xf) == 0x0) { + return 0; + } else { + /* Decode the IDs on > ES1.0 */ + cpuid = __raw_readl(CONTROL_IDCODE); + } + + return cpuid; +} -- 2.39.5