All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Niebel <list-09_u-boot@tqsc.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/4] imx: mx6: display max cpu frequency in print_cpuinfo()
Date: Wed, 29 Apr 2015 10:08:22 +0200	[thread overview]
Message-ID: <55409176.2020208@tqsc.de> (raw)
In-Reply-To: <1430235865-17808-2-git-send-email-tharvey@gateworks.com>

Hello Tim,

Am 28.04.2015 um 17:44 schrieb Tim Harvey:
> The IMX6 has four different speed grades determined by eFUSE SPEED_GRADING
> (OCOTP_CFG3[17:16]).
> 
> Display this value to make it clear the difference regarding the CPU speed
> currently running at vs the max speed allowed per grade. Note that the power
> on CPU speed is determined by OCOTP_CFG4[18].
> 
> I see no indication in the IMX6SX reference manual that it has the same CPU
> speed grades in this OTP register.
> 

AFAIK there is no speed grading info for i.MX6 Solo / DualLight in OTP. 

> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> ---
>  arch/arm/cpu/armv7/mx6/soc.c              | 26 ++++++++++++++++++++++++++
>  arch/arm/imx-common/cpu.c                 | 17 +++++++++++++++++
>  arch/arm/include/asm/arch-mx6/sys_proto.h |  1 +
>  arch/arm/include/asm/proc                 |  1 +
>  4 files changed, 45 insertions(+)
>  create mode 120000 arch/arm/include/asm/proc
> 
> diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
> index dd34138..dc422a6 100644
> --- a/arch/arm/cpu/armv7/mx6/soc.c
> +++ b/arch/arm/cpu/armv7/mx6/soc.c
> @@ -83,6 +83,32 @@ u32 get_cpu_rev(void)
>  	return (type << 12) | (reg + 0x10);
>  }
>  
> +#define OCOTP_CFG3_SPEED_SHIFT          16
> +#define OCOTP_CFG3_SPEED_1P2GHZ         0x3
> +#define OCOTP_CFG3_SPEED_996MHZ         0x2
> +#define OCOTP_CFG3_SPEED_852MHZ         0x1
> +
> +u32 get_cpu_speed_grade_hz(void)
> +{
> +	struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR;
> +	struct fuse_bank *bank = &ocotp->bank[0];
> +	struct fuse_bank0_regs *fuse =
> +		(struct fuse_bank0_regs *)bank->fuse_regs;
> +	uint32_t val;
> +
> +	val = readl(&fuse->cfg3);
> +	val >>= OCOTP_CFG3_SPEED_SHIFT;
> +	val &= 0x3;
> +
> +	if (val == OCOTP_CFG3_SPEED_1P2GHZ)
> +		return 1200000000;
> +	if (val == OCOTP_CFG3_SPEED_996MHZ)
> +		return 996000000;
> +	if (val == OCOTP_CFG3_SPEED_852MHZ)
> +		return 852000000;
> +	return 792000000;
> +}
> +
>  #ifdef CONFIG_REVISION_TAG
>  u32 __weak get_board_rev(void)
>  {
> diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
> index 067d08f..ead7f08 100644
> --- a/arch/arm/imx-common/cpu.c
> +++ b/arch/arm/imx-common/cpu.c
> @@ -151,11 +151,28 @@ int print_cpuinfo(void)
>  
>  	cpurev = get_cpu_rev();
>  
> +#if defined(CONFIG_MX6)
> +	printf("CPU:   Freescale i.MX%s rev%d.%d",
> +		get_imx_type((cpurev & 0xFF000) >> 12),
> +		(cpurev & 0x000F0) >> 4,
> +		(cpurev & 0x0000F) >> 0);
> +	if (is_cpu_type(MXC_CPU_MX6SX))
> +		printf(" at %d MHz", mxc_get_clock(MXC_ARM_CLK) / 1000000);
> +	else {
> +		printf(" %d MHz", get_cpu_speed_grade_hz() / 1000000);
> +		if (get_cpu_speed_grade_hz() != mxc_get_clock(MXC_ARM_CLK)) {
> +			printf(" (at %d MHz)",
> +			       mxc_get_clock(MXC_ARM_CLK) / 1000000);
> +		}
> +	}
> +	puts("\n");
> +#else
>  	printf("CPU:   Freescale i.MX%s rev%d.%d at %d MHz\n",
>  		get_imx_type((cpurev & 0xFF000) >> 12),
>  		(cpurev & 0x000F0) >> 4,
>  		(cpurev & 0x0000F) >> 0,
>  		mxc_get_clock(MXC_ARM_CLK) / 1000000);
> +#endif
>  
>  #if defined(CONFIG_MX6) && defined(CONFIG_IMX6_THERMAL)
>  	ret = uclass_get_device(UCLASS_THERMAL, 0, &thermal_dev);
> diff --git a/arch/arm/include/asm/arch-mx6/sys_proto.h b/arch/arm/include/asm/arch-mx6/sys_proto.h
> index 28ba844..a2cd0a9 100644
> --- a/arch/arm/include/asm/arch-mx6/sys_proto.h
> +++ b/arch/arm/include/asm/arch-mx6/sys_proto.h
> @@ -16,6 +16,7 @@
>  
>  u32 get_nr_cpus(void);
>  u32 get_cpu_rev(void);
> +u32 get_cpu_speed_grade_hz(void);
>  
>  /* returns MXC_CPU_ value */
>  #define cpu_type(rev) (((rev) >> 12)&0xff)
> diff --git a/arch/arm/include/asm/proc b/arch/arm/include/asm/proc
> new file mode 120000
> index 0000000..c7f3c20
> --- /dev/null
> +++ b/arch/arm/include/asm/proc
> @@ -0,0 +1 @@
> +proc-armv
> \ No newline at end of file
> 

  reply	other threads:[~2015-04-29  8:08 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-28 15:44 [U-Boot] [PATCH 0/4]: imx: mx6: use OTP for temperature grade and freq grade Tim Harvey
2015-04-28 15:44 ` [U-Boot] [PATCH 1/4] imx: mx6: display max cpu frequency in print_cpuinfo() Tim Harvey
2015-04-29  8:08   ` Markus Niebel [this message]
2015-04-28 15:44 ` [U-Boot] [PATCH 2/4] mx6: add OTP bank1 registers Tim Harvey
2015-04-28 15:44 ` [U-Boot] [PATCH 3/4] imx: mx6: add display of temperature grade of processor in cpu_printinfo() Tim Harvey
2015-05-10 14:54   ` Fabio Estevam
2015-05-11 19:59     ` Tim Harvey
2015-05-11 20:04       ` Fabio Estevam
2015-04-28 15:44 ` [U-Boot] [PATCH 4/4] thermal: imx_thermal: use CPU temperature grade for trip points Tim Harvey
2015-04-28 17:11 ` [U-Boot] [PATCH 0/4]: imx: mx6: use OTP for temperature grade and freq grade Stefan Roese
2015-04-28 17:31   ` Tim Harvey
2015-05-07 15:55     ` Tim Harvey
2015-05-07 16:01       ` Stefan Roese
2015-05-07 16:07       ` Stefano Babic
2015-05-07 16:12       ` Christian Gmeiner
2015-05-08  6:57       ` Markus Niebel
2015-05-08 15:42         ` Tim Harvey
2015-05-08 17:35           ` Nikolay Dimitrov
2015-05-08 19:26             ` Tim Harvey
2015-05-10 13:46               ` Nikolay Dimitrov
2015-05-10 13:52                 ` Nikolay Dimitrov

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=55409176.2020208@tqsc.de \
    --to=list-09_u-boot@tqsc.de \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.