summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJoakim Axelsson <joakim.axelsson@stericsson.com>2010-12-03 13:18:04 +0800
committerMichael BRANDT <michael.brandt@stericsson.com>2010-12-08 16:19:19 +0100
commit568e790d63676b87c9e3be499e09dc3a390cbbfe (patch)
treeafd86821e40db8d4f299ce7e9d54be704f011fdd /include
parentad006f9896b3cc1d8d2b855f27bbd1ad4482abe1 (diff)
db8500: Move cpu identifying function to SoC code
Moved u8500_is_earlydrop() and cpu_is_u8500*() to include/asm-arm/arch-db8500/cpu.h. They are kept in cpu.h as the functions are very small and should be inlined with each use of them. The final binary actually also became around 100 bytes smaller. ST-Ericsson ID: None Signed-off-by: Joakim Axelsson <joakim.axelsson@stericsson.com> Change-Id: Ied553b7c8a004a37c70c3e328a069ae8b2a92b23 Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/9893 Reviewed-by: QATOOLS Reviewed-by: Michael BRANDT <michael.brandt@stericsson.com> Tested-by: Michael BRANDT <michael.brandt@stericsson.com>
Diffstat (limited to 'include')
-rw-r--r--include/asm-arm/arch-db8500/common.h5
-rw-r--r--include/asm-arm/arch-db8500/cpu.h76
2 files changed, 76 insertions, 5 deletions
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__ */
+