summaryrefslogtreecommitdiff
path: root/arch/arm/cpu/armv7/mx5/clock.c
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2013-04-21 05:52:26 +0000
committerStefano Babic <sbabic@denx.de>2013-05-05 17:45:05 +0200
commitf399f63647033d59d1c029b6ad9ddb48a2a19f9e (patch)
tree3ab61addb293c4600c959fe8de89efc726d0e947 /arch/arm/cpu/armv7/mx5/clock.c
parentcfb8e87a8e0997a2baecfa7f0cbe10fb9fa8e62e (diff)
downloadu-boot-imx-f399f63647033d59d1c029b6ad9ddb48a2a19f9e.zip
u-boot-imx-f399f63647033d59d1c029b6ad9ddb48a2a19f9e.tar.gz
u-boot-imx-f399f63647033d59d1c029b6ad9ddb48a2a19f9e.tar.bz2
arm: mx5: Add NAND clock handling
Augment the MX5 clock code with function to enable and configure NFC clock. This is necessary to get NFC working on MX5. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Albert ARIBAUD <albert.u.boot@aribaud.net> Cc: Benoît Thébaudeau <benoit.thebaudeau@advansee.com> Cc: Fabio Estevam <fabio.estevam@freescale.com> Cc: Scott Wood <scottwood@freescale.com> Cc: Stefano Babic <sbabic@denx.de> Cc: Tom Rini <trini@ti.com>
Diffstat (limited to 'arch/arm/cpu/armv7/mx5/clock.c')
-rw-r--r--arch/arm/cpu/armv7/mx5/clock.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/arch/arm/cpu/armv7/mx5/clock.c b/arch/arm/cpu/armv7/mx5/clock.c
index 76c2c52..431756e 100644
--- a/arch/arm/cpu/armv7/mx5/clock.c
+++ b/arch/arm/cpu/armv7/mx5/clock.c
@@ -739,10 +739,11 @@ static int config_core_clk(u32 ref, u32 freq)
static int config_nfc_clk(u32 nfc_clk)
{
u32 parent_rate = get_emi_slow_clk();
- u32 div = parent_rate / nfc_clk;
+ u32 div;
- if (nfc_clk <= 0)
+ if (nfc_clk == 0)
return -EINVAL;
+ div = parent_rate / nfc_clk;
if (div == 0)
div++;
if (parent_rate / div > NFC_CLK_MAX)
@@ -755,6 +756,15 @@ static int config_nfc_clk(u32 nfc_clk)
return 0;
}
+void enable_nfc_clk(unsigned char enable)
+{
+ unsigned int cg = enable ? MXC_CCM_CCGR_CG_ON : MXC_CCM_CCGR_CG_OFF;
+
+ clrsetbits_le32(&mxc_ccm->CCGR5,
+ MXC_CCM_CCGR5_EMI_ENFC(MXC_CCM_CCGR_CG_MASK),
+ MXC_CCM_CCGR5_EMI_ENFC(cg));
+}
+
/* Config main_bus_clock for periphs */
static int config_periph_clk(u32 ref, u32 freq)
{