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>
This commit is contained in:
Lokesh Vutla 2015-07-28 14:16:41 +05:30 committed by Tom Rini
parent 095a5ef88e
commit cfe5f0cda0

View file

@ -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)
{
unsigned int jtag_id = __raw_readl(KS2_JTAG_ID_REG);
unsigned int part_no = (jtag_id >> 12) & 0xffff;
return (part_no == 0xb981) ? 1 : 0;
static inline u16 get_part_number(void)
{
u32 jtag_id = __raw_readl(KS2_JTAG_ID_REG);
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 (part_no == 0xb9a7) ? 1 : 0;
return get_part_number() == CPU_66AK2Ex;
}
static inline int cpu_revision(void)
static inline u8 cpu_is_k2l(void)
{
unsigned int jtag_id = __raw_readl(KS2_JTAG_ID_REG);
unsigned int rev = (jtag_id >> 28) & 0xf;
return get_part_number() == CPU_66AK2Lx;
}
static inline u8 cpu_revision(void)
{
u32 jtag_id = __raw_readl(KS2_JTAG_ID_REG);
u8 rev = (jtag_id & JTAGID_VARIANT_MASK) >> JTAGID_VARIANT_SHIFT;
return rev;
}