From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Nelson Date: Thu, 25 Jul 2013 09:31:01 -0700 Subject: [U-Boot] [PATCH v3 1/2] mx6: Factor out common HDMI setup code In-Reply-To: <1374701744-5366-1-git-send-email-b45784@freescale.com> References: <1374701744-5366-1-git-send-email-b45784@freescale.com> Message-ID: <51F152C5.5050006@boundarydevices.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de 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 > --- > Changes since v2: > Added new function enable_ipu_clock() to separate the functinality of ipu clock from hdmi setup. > Remove unnecessary include files. > > > > 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 > > > > + > +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); > > > > 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 > > > > @@ -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