[U-Boot] [PATCH v3 1/2] mx6: Factor out common HDMI setup code

Eric Nelson eric.nelson at boundarydevices.com
Thu Jul 25 18:31:01 CEST 2013


Hi Pardeep,

On 07/24/2013 02:35 PM, Pardeep Kumar Singla wrote:
> Instead of duplicating HDMI setup code for every mx6 board, factor out the common code
>
> Signed-off-by: Pardeep Kumar Singla <b45784 at freescale.com>
> ---
> Changes since v2:
> Added new function enable_ipu_clock() to separate the functinality of ipu clock from hdmi setup.
> Remove unnecessary include files.
>
> <snip>
 >
> diff --git a/arch/arm/cpu/armv7/mx6/clock.c b/arch/arm/cpu/armv7/mx6/clock.c
> index 3c0d908..a724e66 100644
> --- a/arch/arm/cpu/armv7/mx6/clock.c
> +++ b/arch/arm/cpu/armv7/mx6/clock.c
> @@ -468,6 +468,14 @@ int do_mx6_showclocks(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
>   	return 0;
>   }
>
> +void enable_ipu_clock()

If this is public, it should be declared in
	arch/arm/include/asm/arch-mx6/clock.h

> +{
> +	struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
> +	int reg;
> +	reg = readl(&mxc_ccm->CCGR3);
> +	reg |= MXC_CCM_CCGR3_IPU1_IPU_DI0_OFFSET;
> +	writel(reg, &mxc_ccm->CCGR3);
> +}
>   /***************************************************/
>
>   U_BOOT_CMD(
> diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
> index fc436fb..8f78d7e 100644
> --- a/arch/arm/cpu/armv7/mx6/soc.c
> +++ b/arch/arm/cpu/armv7/mx6/soc.c
>
> <snip>
>
> +
> +void imx_setup_hdmi(void)
> +{
> +	struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
> +	struct hdmi_regs *hdmi  = (struct hdmi_regs *)HDMI_ARB_BASE_ADDR;
> +	int reg;
> +
> +	enable_ipu_clock();

I think this enabling belongs in the routines which call
imx_setup_hdmi(), since folks will (and probably have) create
custom boards based on those shells and this is also
required to support for LDB and RGB displays.

> +
> +	/* Turn on HDMI PHY clock */
> +	reg = readl(&mxc_ccm->CCGR2);
> +	reg |=  MXC_CCM_CCGR2_HDMI_TX_IAHBCLK_MASK|
> +		 MXC_CCM_CCGR2_HDMI_TX_ISFRCLK_MASK;
> +	writel(reg, &mxc_ccm->CCGR2);
 >
 > <snip>
 >

> diff --git a/arch/arm/include/asm/arch-mx6/mxc_hdmi.h b/arch/arm/include/asm/arch-mx6/mxc_hdmi.h
> index 9dccb3f..5cd6aa6 100644
> --- a/arch/arm/include/asm/arch-mx6/mxc_hdmi.h
> +++ b/arch/arm/include/asm/arch-mx6/mxc_hdmi.h
> @@ -21,6 +21,11 @@
>   #ifndef __MXC_HDMI_H__
>   #define __MXC_HDMI_H__
>
> +#ifdef CONFIG_IMX_HDMI
> +void imx_enable_hdmi_phy(void);
> +void imx_setup_hdmi(void);
> +#endif
> +
>   /*
>    * Hdmi controller registers
>    */
> diff --git a/board/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c
> index 8f0f9b8..45a8f7a 100644
> --- a/board/boundary/nitrogen6x/nitrogen6x.c
> +++ b/board/boundary/nitrogen6x/nitrogen6x.c
>
> <snip>
>
> @@ -653,25 +640,14 @@ static void setup_display(void)
>   	struct mxc_ccm_reg *mxc_ccm = (struct mxc_ccm_reg *)CCM_BASE_ADDR;
>   	struct anatop_regs *anatop = (struct anatop_regs *)ANATOP_BASE_ADDR;
>   	struct iomuxc *iomux = (struct iomuxc *)IOMUXC_BASE_ADDR;
> -	struct hdmi_regs *hdmi	= (struct hdmi_regs *)HDMI_ARB_BASE_ADDR;
> -
>   	int reg;
>

This is probably where the enable_ipu_clock() call belongs.

> +	imx_setup_hdmi();
>   	/* Turn on LDB0,IPU,IPU DI0 clocks */

Regards,


Eric



More information about the U-Boot mailing list