public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Vitaly Andrianov <vitalya@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/8] ARM: keystone2: Cleanup SoC detection
Date: Wed, 22 Jul 2015 11:54:43 -0400	[thread overview]
Message-ID: <55AFBCC3.5090902@ti.com> (raw)
In-Reply-To: <1437579558-26579-2-git-send-email-lokeshvutla@ti.com>



On 07/22/2015 11:39 AM, Lokesh Vutla wrote:
> Add proper register definition for JTAG ID and
> cleanup cpu_is_* functions.
>
> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
> ---
>   arch/arm/mach-keystone/include/mach/hardware.h | 42 ++++++++++++++++----------
>   1 file 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 16cbcee..15c25b1 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;
>   }
>
Reviewed-by: Vitaly Andrianov <vitalya@ti.com>

  reply	other threads:[~2015-07-22 15:54 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-07-22 15:39 [U-Boot] [PATCH 0/8] ARM: keystone2: Clocls and PLLs cleanup Lokesh Vutla
2015-07-22 15:39 ` [U-Boot] [PATCH 1/8] ARM: keystone2: Cleanup SoC detection Lokesh Vutla
2015-07-22 15:54   ` Vitaly Andrianov [this message]
2015-07-23 19:29   ` Tom Rini
2015-07-24 11:50     ` Lokesh Vutla
2015-07-22 15:39 ` [U-Boot] [PATCH 2/8] ARM: keystone2: Enable CONFIG_DISPLAY_CPUINFO Lokesh Vutla
2015-07-22 15:56   ` Vitaly Andrianov
2015-07-23 19:29   ` Tom Rini
2015-07-22 15:39 ` [U-Boot] [PATCH 3/8] ARM: keystone2: Cleanup PLL init code Lokesh Vutla
2015-07-23 19:29   ` Tom Rini
2015-07-22 15:39 ` [U-Boot] [PATCH 4/8] ARM: keystone2: Fix dev and arm speed detection Lokesh Vutla
2015-07-23 19:29   ` Tom Rini
2015-07-22 15:39 ` [U-Boot] [PATCH 5/8] ARM: keystone2: Use common structure for PLLs Lokesh Vutla
2015-07-23 19:30   ` Tom Rini
2015-07-22 15:39 ` [U-Boot] [PATCH 6/8] ARM: keystone2: Cleanup init_pll definition Lokesh Vutla
2015-07-23 18:01   ` Vitaly Andrianov
2015-07-24  4:20     ` Lokesh Vutla
2015-07-24 11:48       ` Vitaly Andrianov
2015-07-23 19:30   ` Tom Rini
2015-07-22 15:39 ` [U-Boot] [PATCH 7/8] ARM: keystone2: Remove unsed external clocks Lokesh Vutla
2015-07-23 19:30   ` Tom Rini
2015-07-22 15:39 ` [U-Boot] [PATCH 8/8] ARM: keystone2: Use common definition for clk_get_rate Lokesh Vutla
2015-07-23 19:30   ` Tom Rini
2015-07-22 15:45 ` [U-Boot] [PATCH 0/8] ARM: keystone2: Clocls and PLLs cleanup Lokesh Vutla

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=55AFBCC3.5090902@ti.com \
    --to=vitalya@ti.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox