[U-Boot] [PATCH 2/4] mx25: Fix imx_get_perclk()

Stefano Babic sbabic at denx.de
Wed May 31 08:50:30 UTC 2017


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 at 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
=====================================================================


More information about the U-Boot mailing list