[U-Boot] [PATCH 06/10] mx5 clocks: Fix get_ipg_per_clk()
Benoît Thébaudeau
benoit.thebaudeau at advansee.com
Tue Aug 14 20:07:31 CEST 2012
This fixes the "IPG PERCLK" frequency printed by the clocks command.
It also fixes i2c support.
Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau at advansee.com>
Cc: Stefano Babic <sbabic at denx.de>
---
.../arch/arm/cpu/armv7/mx5/clock.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
diff --git u-boot-4d3c95f.orig/arch/arm/cpu/armv7/mx5/clock.c u-boot-4d3c95f/arch/arm/cpu/armv7/mx5/clock.c
index b92ac49..b13c55a 100644
--- u-boot-4d3c95f.orig/arch/arm/cpu/armv7/mx5/clock.c
+++ u-boot-4d3c95f/arch/arm/cpu/armv7/mx5/clock.c
@@ -359,11 +359,15 @@ static u32 get_ipg_clk(void)
*/
static u32 get_ipg_per_clk(void)
{
- u32 pred1, pred2, podf;
+ u32 freq, pred1, pred2, podf;
if (__raw_readl(&mxc_ccm->cbcmr) & MXC_CCM_CBCMR_PERCLK_IPG_CLK_SEL)
return get_ipg_clk();
- /* Fixme: not handle what about lpm*/
+
+ if (__raw_readl(&mxc_ccm->cbcmr) & MXC_CCM_CBCMR_PERCLK_LP_APM_CLK_SEL)
+ freq = get_lp_apm();
+ else
+ freq = get_periph_clk();
podf = __raw_readl(&mxc_ccm->cbcdr);
pred1 = (podf & MXC_CCM_CBCDR_PERCLK_PRED1_MASK) >>
MXC_CCM_CBCDR_PERCLK_PRED1_OFFSET;
@@ -371,8 +375,7 @@ static u32 get_ipg_per_clk(void)
MXC_CCM_CBCDR_PERCLK_PRED2_OFFSET;
podf = (podf & MXC_CCM_CBCDR_PERCLK_PODF_MASK) >>
MXC_CCM_CBCDR_PERCLK_PODF_OFFSET;
-
- return get_periph_clk() / ((pred1 + 1) * (pred2 + 1) * (podf + 1));
+ return freq / ((pred1 + 1) * (pred2 + 1) * (podf + 1));
}
/*
More information about the U-Boot
mailing list