summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/st/u8500/mcde_hw.c1
-rw-r--r--board/st/u8500/mmc_host.c1
-rw-r--r--board/st/u8500/mmc_utils.c1
-rw-r--r--board/st/u8500/u8500.c51
-rw-r--r--cpu/arm_cortexa9/db8500/cpu.c3
-rw-r--r--cpu/arm_cortexa9/db8500/prcmu.c1
-rw-r--r--cpu/arm_cortexa9/db8500/timer.c1
-rw-r--r--include/asm-arm/arch-db8500/common.h5
-rw-r--r--include/asm-arm/arch-db8500/cpu.h76
9 files changed, 83 insertions, 57 deletions
diff --git a/board/st/u8500/mcde_hw.c b/board/st/u8500/mcde_hw.c
index 24b850cd3..e281d874c 100644
--- a/board/st/u8500/mcde_hw.c
+++ b/board/st/u8500/mcde_hw.c
@@ -9,6 +9,7 @@
#include <common.h>
#include <command.h>
+#include <asm/arch/cpu.h>
#include <asm/arch/gpio.h>
#include <tc35892.h>
#include <malloc.h>
diff --git a/board/st/u8500/mmc_host.c b/board/st/u8500/mmc_host.c
index a9023eb10..8a2e0b3dd 100644
--- a/board/st/u8500/mmc_host.c
+++ b/board/st/u8500/mmc_host.c
@@ -15,6 +15,7 @@
#define DBG_LVL_VERBOSE (2)
#include <asm/arch/common.h>
+#include <asm/arch/cpu.h>
#include <mmc.h>
#include <asm/arch/gpio.h>
#include "mmc_host.h"
diff --git a/board/st/u8500/mmc_utils.c b/board/st/u8500/mmc_utils.c
index 976310571..6c5a8150d 100644
--- a/board/st/u8500/mmc_utils.c
+++ b/board/st/u8500/mmc_utils.c
@@ -22,6 +22,7 @@
#include <linux/ctype.h>
#include <asm/arch/common.h>
+#include <asm/arch/cpu.h>
#include <command.h>
#include <mmc.h>
#include <fat.h>
diff --git a/board/st/u8500/u8500.c b/board/st/u8500/u8500.c
index a76825d0e..1eb083585 100644
--- a/board/st/u8500/u8500.c
+++ b/board/st/u8500/u8500.c
@@ -12,6 +12,7 @@
#include <asm/io.h>
#include <asm/errno.h>
#include <asm/arch/clock.h>
+#include <asm/arch/cpu.h>
#include <asm/arch/hardware.h>
#include <asm/arch/ab8500.h>
#include <asm/arch/prcmu.h>
@@ -118,56 +119,6 @@ void show_boot_progress(int progress)
}
#endif
-#define CPUID_DB8500ED 0x410fc090
-#define CPUID_DB8500V1 0x411fc091
-#define CPUID_DB8500V2 0x412fc091
-
-#define ASICID_DB8500V11 0x008500A1
-
-static unsigned int read_cpuid(void)
-{
- unsigned int val;
-
- /* Main ID register (MIDR) */
- asm("mrc p15, 0, %0, c0, c0, 0"
- : "=r" (val)
- :
- : "cc");
-
- return val;
-}
-
-static unsigned int read_asicid(void)
-{
- unsigned int *address;
-
- if (u8500_is_earlydrop() || cpu_is_u8500v1())
- address = (void *) U8500_ASIC_ID_LOC_ED_V1;
- else
- address = (void *) U8500_ASIC_ID_LOC_V2;
-
- return readl(address);
-}
-
-int u8500_is_earlydrop(void)
-{
- return read_cpuid() == CPUID_DB8500ED;
-}
-
-int cpu_is_u8500v1(void)
-{
- return read_cpuid() == CPUID_DB8500V1;
-}
-
-int cpu_is_u8500v11(void)
-{
- return read_asicid() == ASICID_DB8500V11;
-}
-
-int cpu_is_u8500v2(void)
-{
- return read_cpuid() == CPUID_DB8500V2;
-}
/*
* Miscellaneous platform dependent initialisations
diff --git a/cpu/arm_cortexa9/db8500/cpu.c b/cpu/arm_cortexa9/db8500/cpu.c
index 25b4a0462..1edf98aa0 100644
--- a/cpu/arm_cortexa9/db8500/cpu.c
+++ b/cpu/arm_cortexa9/db8500/cpu.c
@@ -12,8 +12,7 @@
#include <common.h>
#include <asm/io.h>
#include <asm/arch/clock.h>
-#include <asm/arch/common.h>
-#include <asm/arch/hardware.h>
+#include <asm/arch/cpu.h>
#include <asm/arch/prcmu.h>
#ifdef CONFIG_ARCH_CPU_INIT
diff --git a/cpu/arm_cortexa9/db8500/prcmu.c b/cpu/arm_cortexa9/db8500/prcmu.c
index e411d1a1c..1cd4a7f8e 100644
--- a/cpu/arm_cortexa9/db8500/prcmu.c
+++ b/cpu/arm_cortexa9/db8500/prcmu.c
@@ -16,6 +16,7 @@
#include <common.h>
#include <config.h>
#include <asm/io.h>
+#include <asm/arch/cpu.h>
#include <asm/arch/hardware.h>
#include <asm/types.h>
#include <asm/io.h>
diff --git a/cpu/arm_cortexa9/db8500/timer.c b/cpu/arm_cortexa9/db8500/timer.c
index 42d70c73e..86065e5a8 100644
--- a/cpu/arm_cortexa9/db8500/timer.c
+++ b/cpu/arm_cortexa9/db8500/timer.c
@@ -23,6 +23,7 @@
#include <common.h>
#include <asm/io.h>
#include <asm/arch/common.h>
+#include <asm/arch/cpu.h>
#include <asm/arch/hardware.h>
#include <boottime.h>
diff --git a/include/asm-arm/arch-db8500/common.h b/include/asm-arm/arch-db8500/common.h
index 38079b79c..81f100a50 100644
--- a/include/asm-arm/arch-db8500/common.h
+++ b/include/asm-arm/arch-db8500/common.h
@@ -129,10 +129,5 @@ typedef u32 t_logical_address;
/*function prototypes*/
void gpio_init(void);
-int u8500_is_earlydrop(void);
-int cpu_is_u8500v11(void);
-int cpu_is_u8500v1(void);
-int cpu_is_u8500v2(void);
-
int board_early_access(block_dev_desc_t *block_dev);
#endif /* _DB8500_COMMON_H_ */
diff --git a/include/asm-arm/arch-db8500/cpu.h b/include/asm-arm/arch-db8500/cpu.h
new file mode 100644
index 000000000..a9d62f4b0
--- /dev/null
+++ b/include/asm-arm/arch-db8500/cpu.h
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) ST-Ericsson SA 2010
+ *
+ * Author: Joakim Axelsson <joakim.axelsson at stericsson.com>
+ * for ST-Ericsson
+ *
+ * Origin: Code split from board/st/u8500/u8500.c
+ *
+ * License terms: GNU General Public License (GPL), version 2.
+ */
+
+#ifndef __DB8500_CPU_H__
+#define __DB8500_CPU_H__
+
+#include <asm/io.h>
+#include <asm/arch/hardware.h>
+
+#define CPUID_DB8500ED 0x410fc090
+#define CPUID_DB8500V1 0x411fc091
+#define CPUID_DB8500V2 0x412fc091
+
+#define ASICID_DB8500V11 0x008500A1
+
+/*
+ * Keep these CPU identity functions inline here because they are short
+ * and used by many. Will make for fast optimized compiled code.
+ */
+
+static inline unsigned int read_cpuid(void)
+{
+ unsigned int val;
+
+ /* Main ID register (MIDR) */
+ asm("mrc p15, 0, %0, c0, c0, 0"
+ : "=r" (val)
+ :
+ : "cc");
+
+ return val;
+}
+
+static inline int u8500_is_earlydrop(void)
+{
+ return read_cpuid() == CPUID_DB8500ED;
+}
+
+static inline int cpu_is_u8500v1(void)
+{
+ return read_cpuid() == CPUID_DB8500V1;
+}
+
+static inline int cpu_is_u8500v2(void)
+{
+ return read_cpuid() == CPUID_DB8500V2;
+}
+
+static inline unsigned int read_asicid(void)
+{
+ unsigned int *address;
+
+ if (u8500_is_earlydrop() || cpu_is_u8500v1())
+ address = (void *) U8500_ASIC_ID_LOC_ED_V1;
+ else
+ address = (void *) U8500_ASIC_ID_LOC_V2;
+
+ return readl(address);
+}
+
+static inline int cpu_is_u8500v11(void)
+{
+ return read_asicid() == ASICID_DB8500V11;
+}
+
+
+#endif /* __DB8500_CPU_H__ */
+