[U-Boot] [PATCH v2 1/2] mx6: Factor out common HDMI setup code
Eric Nelson
eric.nelson at boundarydevices.com
Wed Jul 24 19:02:12 CEST 2013
Hi Pardeep,
On 07/24/2013 09:31 AM, 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 v1:
> Remove dev paramter from imx_enable_hdmi_phy function to make interface clearer.
> Boards that support auto-detect (mx6qsabrelite/nitrogen6x) are wrapping it.
>
> arch/arm/cpu/armv7/mx6/soc.c | 48 +++++++++++++++++++++++++
> arch/arm/include/asm/arch-mx6/mxc_hdmi.h | 6 ++++
> board/boundary/nitrogen6x/nitrogen6x.c | 43 ++++------------------
> board/freescale/mx6qsabrelite/mx6qsabrelite.c | 45 ++++-------------------
> board/wandboard/wandboard.c | 43 ++--------------------
> include/configs/mx6qsabrelite.h | 1 +
> include/configs/nitrogen6x.h | 1 +
> include/configs/wandboard.h | 1 +
> 8 files changed, 73 insertions(+), 115 deletions(-)
>
> diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
> index fc436fb..2c89c59 100644
> --- a/arch/arm/cpu/armv7/mx6/soc.c
> +++ b/arch/arm/cpu/armv7/mx6/soc.c
> @@ -32,6 +32,8 @@
> #include <asm/imx-common/boot_mode.h>
> #include <asm/imx-common/dma.h>
> #include <stdbool.h>
> +#include <asm/arch/mxc_hdmi.h>
> +#include <asm/arch/crm_regs.h>
>
> struct scu_regs {
> u32 ctrl;
> @@ -228,3 +230,49 @@ const struct boot_mode soc_boot_modes[] = {
> void s_init(void)
> {
> }
> +
> +#ifdef CONFIG_IMX_HDMI
> +void imx_enable_hdmi_phy(void)
> +{
> + struct hdmi_regs *hdmi = (struct hdmi_regs *)HDMI_ARB_BASE_ADDR;
> + u8 reg;
> + reg = readb(&hdmi->phy_conf0);
> + reg |= HDMI_PHY_CONF0_PDZ_MASK;
> + writeb(reg, &hdmi->phy_conf0);
> + udelay(3000);
> + reg |= HDMI_PHY_CONF0_ENTMDS_MASK;
> + writeb(reg, &hdmi->phy_conf0);
> + udelay(3000);
> + reg |= HDMI_PHY_CONF0_GEN2_TXPWRON_MASK;
> + writeb(reg, &hdmi->phy_conf0);
> + writeb(HDMI_MC_PHYRSTZ_ASSERT, &hdmi->mc_phyrstz);
> +}
> +
> +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;
> +
This should probably not go here, or at least should
be visible elsewhere because it's needed for boards
which don't have HDMI exposed:
> + /* Turn on IPU clock */
> + reg = readl(&mxc_ccm->CCGR3);
> + reg |= MXC_CCM_CCGR3_IPU1_IPU_DI0_OFFSET;
> + writel(reg, &mxc_ccm->CCGR3);
> +
If (when) someone builds a board file that doesn't have
HDMI, they'll probably search a while for the
We probably want an 'enable_ipu_clock()' routine in
.../cpu/mx6/clock.c.
> + /* 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);
> + writeb(HDMI_MC_PHYRSTZ_DEASSERT, &hdmi->mc_phyrstz);
> + reg = readl(&mxc_ccm->chsccdr);
> + reg &= ~(MXC_CCM_CHSCCDR_IPU1_DI0_PRE_CLK_SEL_MASK|
> + MXC_CCM_CHSCCDR_IPU1_DI0_PODF_MASK|
> + MXC_CCM_CHSCCDR_IPU1_DI0_CLK_SEL_MASK);
> + reg |= (CHSCCDR_PODF_DIVIDE_BY_3
> + << MXC_CCM_CHSCCDR_IPU1_DI0_PODF_OFFSET)
> + |(CHSCCDR_IPU_PRE_CLK_540M_PFD
> + << MXC_CCM_CHSCCDR_IPU1_DI0_PRE_CLK_SEL_OFFSET);
> + writel(reg, &mxc_ccm->chsccdr);
> +}
> +#endif
> diff --git a/arch/arm/include/asm/arch-mx6/mxc_hdmi.h b/arch/arm/include/asm/arch-mx6/mxc_hdmi.h
> index 9dccb3f..06e2bc4 100644
> --- a/arch/arm/include/asm/arch-mx6/mxc_hdmi.h
> +++ b/arch/arm/include/asm/arch-mx6/mxc_hdmi.h
> @@ -21,6 +21,12 @@
> #ifndef __MXC_HDMI_H__
> #define __MXC_HDMI_H__
>
> +#ifdef CONFIG_IMX_HDMI
Why sys_proto.h?
> +#include<asm/arch/sys_proto.h>
> +void imx_enable_hdmi_phy(void);
> +void imx_setup_hdmi(void);
> +#endif
> +
The rest looks good to me.
Regards,
Eric
More information about the U-Boot
mailing list