summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorLokesh Vutla <lokeshvutla@ti.com>2015-07-28 14:16:41 +0530
committerTom Rini <trini@konsulko.com>2015-08-12 20:47:51 -0400
commitcfe5f0cda0f39fe833233fdffbac127fd7b3db4e (patch)
treeaedca1abfae65d89913c94f243e339a5453501e6 /arch
parent095a5ef88e08c3df0f273c20a39cb921900cfae6 (diff)
ARM: keystone2: Cleanup SoC detection
Add proper register definition for JTAG ID and cleanup cpu_is_* functions. Reviewed-by: Tom Rini <trini@konsulko.com> Reviewed-by: Vitaly Andrianov <vitalya@ti.com> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-keystone/include/mach/hardware.h42
1 files changed, 26 insertions, 16 deletions
diff --git a/arch/arm/mach-keystone/include/mach/hardware.h b/arch/arm/mach-keystone/include/mach/hardware.h
index 16cbcee12b..6082b87a16 100644
--- a/arch/arm/mach-keystone/include/mach/hardware.h
+++ b/arch/arm/mach-keystone/include/mach/hardware.h
@@ -237,6 +237,17 @@ typedef volatile unsigned int *dv_reg_p;
/* SGMII SerDes */
#define KS2_SGMII_SERDES_BASE 0x0232a000
+/* JTAG ID register */
+#define JTAGID_VARIANT_SHIFT 28
+#define JTAGID_VARIANT_MASK (0xf << 28)
+#define JTAGID_PART_NUM_SHIFT 12
+#define JTAGID_PART_NUM_MASK (0xffff << 12)
+
+/* PART NUMBER definitions */
+#define CPU_66AK2Hx 0xb981
+#define CPU_66AK2Ex 0xb9a6
+#define CPU_66AK2Lx 0xb9a7
+
#ifdef CONFIG_SOC_K2HK
#include <asm/arch/hardware-k2hk.h>
#endif
@@ -250,34 +261,33 @@ typedef volatile unsigned int *dv_reg_p;
#endif
#ifndef __ASSEMBLY__
-static inline int cpu_is_k2hk(void)
+
+static inline u16 get_part_number(void)
{
- unsigned int jtag_id = __raw_readl(KS2_JTAG_ID_REG);
- unsigned int part_no = (jtag_id >> 12) & 0xffff;
+ u32 jtag_id = __raw_readl(KS2_JTAG_ID_REG);
- return (part_no == 0xb981) ? 1 : 0;
+ return (jtag_id & JTAGID_PART_NUM_MASK) >> JTAGID_PART_NUM_SHIFT;
}
-static inline int cpu_is_k2e(void)
+static inline u8 cpu_is_k2hk(void)
{
- unsigned int jtag_id = __raw_readl(KS2_JTAG_ID_REG);
- unsigned int part_no = (jtag_id >> 12) & 0xffff;
-
- return (part_no == 0xb9a6) ? 1 : 0;
+ return get_part_number() == CPU_66AK2Hx;
}
-static inline int cpu_is_k2l(void)
+static inline u8 cpu_is_k2e(void)
{
- unsigned int jtag_id = __raw_readl(KS2_JTAG_ID_REG);
- unsigned int part_no = (jtag_id >> 12) & 0xffff;
+ return get_part_number() == CPU_66AK2Ex;
+}
- return (part_no == 0xb9a7) ? 1 : 0;
+static inline u8 cpu_is_k2l(void)
+{
+ return get_part_number() == CPU_66AK2Lx;
}
-static inline int cpu_revision(void)
+static inline u8 cpu_revision(void)
{
- unsigned int jtag_id = __raw_readl(KS2_JTAG_ID_REG);
- unsigned int rev = (jtag_id >> 28) & 0xf;
+ u32 jtag_id = __raw_readl(KS2_JTAG_ID_REG);
+ u8 rev = (jtag_id & JTAGID_VARIANT_MASK) >> JTAGID_VARIANT_SHIFT;
return rev;
}