All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefano Babic <sbabic@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/4] mx25: Fix imx_get_perclk()
Date: Wed, 31 May 2017 10:50:30 +0200	[thread overview]
Message-ID: <1e43a131-eb07-c4df-4b20-49a96c1b5e91@denx.de> (raw)
In-Reply-To: <1493805546-3567-2-git-send-email-benoit@wsystem.com>

On 03/05/2017 11:59, Benoît Thébaudeau wrote:
> imx_get_perclk() used the AHB clock as the clock source for all PER
> clocks, but the USB PLL output can also be a PER clock source if the
> corresponding PER CLK MUX bit is set in CCM.MCR.
> 
> Signed-off-by: Benoît Thébaudeau <benoit@wsystem.com>
> ---
>  arch/arm/cpu/arm926ejs/mx25/generic.c | 11 ++++++++++-
>  1 file changed, 10 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/cpu/arm926ejs/mx25/generic.c b/arch/arm/cpu/arm926ejs/mx25/generic.c
> index 0b1a8f4..f02cffb 100644
> --- a/arch/arm/cpu/arm926ejs/mx25/generic.c
> +++ b/arch/arm/cpu/arm926ejs/mx25/generic.c
> @@ -58,6 +58,14 @@ static ulong imx_get_mpllclk(void)
>  	return imx_decode_pll(readl(&ccm->mpctl), fref);
>  }
>  
> +static ulong imx_get_upllclk(void)
> +{
> +	struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE;
> +	ulong fref = MXC_HCLK;
> +
> +	return imx_decode_pll(readl(&ccm->upctl), fref);
> +}
> +
>  static ulong imx_get_armclk(void)
>  {
>  	struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE;
> @@ -95,7 +103,8 @@ static ulong imx_get_ipgclk(void)
>  static ulong imx_get_perclk(int clk)
>  {
>  	struct ccm_regs *ccm = (struct ccm_regs *)IMX_CCM_BASE;
> -	ulong fref = imx_get_ahbclk();
> +	ulong fref = readl(&ccm->mcr) & (1 << clk) ? imx_get_upllclk() :
> +						     imx_get_ahbclk();
>  	ulong div;
>  
>  	div = readl(&ccm->pcdr[CCM_PERCLK_REG(clk)]);
> 
Applied to u-boot-imx -master, thanks !

Best regards,
Stefano Babic


-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

  parent reply	other threads:[~2017-05-31  8:50 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-03  9:59 [U-Boot] [PATCH 1/4] mmc: fsl_esdhc: Allow all supported prescaler values Benoît Thébaudeau
2017-05-03  9:59 ` [U-Boot] [PATCH 2/4] mx25: Fix imx_get_perclk() Benoît Thébaudeau
2017-05-29 11:18   ` Fabio Estevam
2017-05-31  8:50   ` Stefano Babic [this message]
2017-05-03  9:59 ` [U-Boot] [PATCH 3/4] mx25: Add function to set PER clocks Benoît Thébaudeau
2017-05-29 11:19   ` Fabio Estevam
2017-05-31  8:50   ` Stefano Babic
2017-05-03  9:59 ` [U-Boot] [PATCH 4/4] mx25pdk: Set the eSDHC PER clock to 48 MHz Benoît Thébaudeau
2017-05-29 11:20   ` Fabio Estevam
2017-05-31  8:50   ` Stefano Babic
2017-05-29 11:17 ` [U-Boot] [PATCH 1/4] mmc: fsl_esdhc: Allow all supported prescaler values Fabio Estevam
2017-05-31  8:50 ` Stefano Babic

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=1e43a131-eb07-c4df-4b20-49a96c1b5e91@denx.de \
    --to=sbabic@denx.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.