summaryrefslogtreecommitdiff
path: root/arch/arm/cpu/armv7/mx5/clock.c
diff options
context:
space:
mode:
authorBenoît Thébaudeau <benoit.thebaudeau@advansee.com>2012-09-27 10:23:08 +0000
committerTom Rini <trini@ti.com>2012-10-15 11:54:11 -0700
commitf124e718f43297d60066974d3ccbbb721fb30c0c (patch)
tree8e520586be8dd7120075ccd19f22f1db42994fc1 /arch/arm/cpu/armv7/mx5/clock.c
parent55c8df0cb14843d4e19af18e0431f3d9b293c22a (diff)
downloadu-boot-imx-f124e718f43297d60066974d3ccbbb721fb30c0c.zip
u-boot-imx-f124e718f43297d60066974d3ccbbb721fb30c0c.tar.gz
u-boot-imx-f124e718f43297d60066974d3ccbbb721fb30c0c.tar.bz2
mx5 clocks: Fix get_ipg_per_clk()
This fixes the "IPG PERCLK" frequency printed by the clocks command. The issue was that get_ipg_per_clk() used periph_clk instead of lp_apm in the case CCM.CBCMR.perclk_lp_apm_sel is set. It also fixes I²C support. Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com> Cc: Stefano Babic <sbabic@denx.de>
Diffstat (limited to 'arch/arm/cpu/armv7/mx5/clock.c')
-rw-r--r--arch/arm/cpu/armv7/mx5/clock.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/arch/arm/cpu/armv7/mx5/clock.c b/arch/arm/cpu/armv7/mx5/clock.c
index e6eae7e..c5a93a0 100644
--- a/arch/arm/cpu/armv7/mx5/clock.c
+++ b/arch/arm/cpu/armv7/mx5/clock.c
@@ -315,16 +315,20 @@ static u32 get_ipg_clk(void)
*/
static u32 get_ipg_per_clk(void)
{
- u32 pred1, pred2, podf;
+ u32 freq, pred1, pred2, podf;
if (readl(&mxc_ccm->cbcmr) & MXC_CCM_CBCMR_PERCLK_IPG_CLK_SEL)
return get_ipg_clk();
- /* Fixme: not handle what about lpm*/
+
+ if (readl(&mxc_ccm->cbcmr) & MXC_CCM_CBCMR_PERCLK_LP_APM_CLK_SEL)
+ freq = get_lp_apm();
+ else
+ freq = get_periph_clk();
podf = readl(&mxc_ccm->cbcdr);
pred1 = MXC_CCM_CBCDR_PERCLK_PRED1_RD(podf);
pred2 = MXC_CCM_CBCDR_PERCLK_PRED2_RD(podf);
podf = MXC_CCM_CBCDR_PERCLK_PODF_RD(podf);
- return get_periph_clk() / ((pred1 + 1) * (pred2 + 1) * (podf + 1));
+ return freq / ((pred1 + 1) * (pred2 + 1) * (podf + 1));
}
/*