[U-Boot] [PATCH 1/2] mx31: make HSP clock for mx3fb driver available

Marek Vasut marek.vasut at gmail.com
Mon Aug 22 16:00:39 CEST 2011


On Monday, August 22, 2011 03:41:36 PM Helmut Raiger wrote:
> Signed-off-by: Helmut Raiger <helmut.raiger at hale.at>
> ---
>  arch/arm/cpu/arm1136/mx31/generic.c    |   14 ++++++++++++++
>  arch/arm/include/asm/arch-mx31/clock.h |    1 +
>  2 files changed, 15 insertions(+), 0 deletions(-)
> 
> diff --git a/arch/arm/cpu/arm1136/mx31/generic.c
> b/arch/arm/cpu/arm1136/mx31/generic.c index 248431b..b077d29 100644
> --- a/arch/arm/cpu/arm1136/mx31/generic.c
> +++ b/arch/arm/cpu/arm1136/mx31/generic.c
> @@ -72,6 +72,18 @@ static u32 mx31_get_ipg_clk(void)
>  	return freq;
>  }
> 
> +/* hsp is the clock for the ipu */
> +static u32 mx31_get_hsp_clk(void)
> +{
> +	u32 freq = mx31_get_mcu_main_clk();
> +	u32 pdr0 = __REG(CCM_PDR0);

Can't we do readl() here?

> +
> +	/* divided by HSP_PODF in PDR0 */
> +	freq /= ((pdr0 >> 11) & 0x7) + 1;

Um, don't we have defined constants for those magic numbers already?

> +
> +	return freq;
> +}
> +
>  void mx31_dump_clocks(void)
>  {
>  	u32 cpufreq = mx31_get_mcu_main_clk();
> @@ -88,6 +100,8 @@ unsigned int mxc_get_clock(enum mxc_clock clk)
>  	case MXC_CSPI_CLK:
>  	case MXC_UART_CLK:
>  		return mx31_get_ipg_clk();
> +	case MXC_IPU_CLK:
> +		return mx31_get_hsp_clk();
>  	}
>  	return -1;
>  }
> diff --git a/arch/arm/include/asm/arch-mx31/clock.h
> b/arch/arm/include/asm/arch-mx31/clock.h index fb035c4..b0aa1ce 100644
> --- a/arch/arm/include/asm/arch-mx31/clock.h
> +++ b/arch/arm/include/asm/arch-mx31/clock.h
> @@ -29,6 +29,7 @@ enum mxc_clock {
>  	MXC_IPG_CLK,
>  	MXC_CSPI_CLK,
>  	MXC_UART_CLK,
> +	MXC_IPU_CLK
>  };
> 
>  unsigned int mxc_get_clock(enum mxc_clock clk);

Cheers


More information about the U-Boot mailing list