[PATCH] Adding IPU clock query functions for i.MX31 and i.MX35

Sascha Hauer s.hauer at pengutronix.de
Wed Nov 25 02:39:16 EST 2009


On Tue, Nov 24, 2009 at 05:04:17PM +0100, Juergen Beisert wrote:
> Adding IPU clock query functions for i.MX31 and i.MX35
> (used to generate their LCD timing).
> 
> BTW: All functions are declared with the 'ulong' return type, but some are
> defined with 'unsigned long'. And yes, its the same, but IMHO one type should
> be used for all.
> 
> Signed-off-by: Juergen Beisert <jbe at pengutronix.de>

Applied

Sascha

> 
> ---
>  arch/arm/mach-imx/speed-imx31.c |   12 ++++++++++++
>  arch/arm/mach-imx/speed-imx35.c |   31 +++++++++++++++++++++++++++++++
>  2 files changed, 43 insertions(+)
> 
> Index: u-boot-v2/arch/arm/mach-imx/speed-imx35.c
> ===================================================================
> --- u-boot-v2.orig/arch/arm/mach-imx/speed-imx35.c
> +++ u-boot-v2/arch/arm/mach-imx/speed-imx35.c
> @@ -118,6 +118,37 @@ unsigned long imx_get_gptclk(void)
>  	return imx_get_ipgclk();
>  }
>  
> +/**
> + * Calculate the current pixel clock speed (aka HSP or IPU)
> + * @return 0 on failure or current frequency in Hz
> + */
> +unsigned long imx_get_lcdclk(void)
> +{
> +	unsigned long hsp_podf = (readl(IMX_CCM_BASE + CCM_PDR0) >> 20) & 0x03;
> +	unsigned long base_clk = imx_get_armclk();
> +
> +	if (base_clk > 400 * 1000 * 1000) {
> +		switch(hsp_podf) {
> +		case 0:
> +			return base_clk >> 2;
> +		case 1:
> +			return base_clk >> 3;
> +		case 2:
> +			return base_clk / 3;
> +		}
> +	} else {
> +		switch(hsp_podf) {
> +		case 0:
> +		case 2:
> +			return base_clk / 3;
> +		case 1:
> +			return base_clk / 6;
> +		}
> +	}
> +
> +	return 0;
> +}
> +
>  unsigned long imx_get_uartclk(void)
>  {
>  	unsigned long pdr3 = readl(IMX_CCM_BASE + CCM_PDR3);
> Index: u-boot-v2/arch/arm/mach-imx/speed-imx31.c
> ===================================================================
> --- u-boot-v2.orig/arch/arm/mach-imx/speed-imx31.c
> +++ u-boot-v2/arch/arm/mach-imx/speed-imx31.c
> @@ -41,6 +41,18 @@ ulong imx_get_mcu_main_clk(void)
>  	return imx_get_mpl_dpdgck_clk();
>  }
>  
> +/**
> + * Calculate the current pixel clock speed (aka HSP or IPU)
> + * @return 0 on failure or current frequency in Hz
> + */
> +ulong imx_get_lcdclk(void)
> +{
> +	ulong hsp_podf = (readl(IMX_CCM_BASE + CCM_PDR0) >> 11) & 0x03;
> +	ulong base_clk = imx_get_mcu_main_clk();
> +
> +	return base_clk / (hsp_podf + 1);
> +}
> +
>  ulong imx_get_perclk1(void)
>  {
>  	u32 freq = imx_get_mcu_main_clk();
> 
> -- 
> Pengutronix e.K.                              | Juergen Beisert             |
> Linux Solutions for Science and Industry      | Phone: +49-8766-939 228     |
> Vertretung Sued/Muenchen, Germany             | Fax:   +49-5121-206917-5555 |
> Amtsgericht Hildesheim, HRA 2686              | http://www.pengutronix.de/  |
> 
> _______________________________________________
> u-boot-v2 mailing list
> u-boot-v2 at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/u-boot-v2
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




More information about the barebox mailing list