summaryrefslogtreecommitdiff
path: root/arch/arm/cpu/arm926ejs/mx25
diff options
context:
space:
mode:
authorBenoît Thébaudeau <benoit.thebaudeau@advansee.com>2012-09-27 10:27:14 +0000
committerTom Rini <trini@ti.com>2012-10-15 11:54:12 -0700
commitfac7c817c31e6c60b2e03e8fcb4b745d0c8d10ab (patch)
treebd947986d9033381bb3f88857b3add8afde979c7 /arch/arm/cpu/arm926ejs/mx25
parent3c76add2628116872befc230cdd4df8e3a6ac5e3 (diff)
downloadu-boot-imx-fac7c817c31e6c60b2e03e8fcb4b745d0c8d10ab.zip
u-boot-imx-fac7c817c31e6c60b2e03e8fcb4b745d0c8d10ab.tar.gz
u-boot-imx-fac7c817c31e6c60b2e03e8fcb4b745d0c8d10ab.tar.bz2
mx25: Clean up clock calculations
Avoid possible overflow in clock calculations, and do not waste calls to lldiv() to divide simple ulongs. Signed-off-by: Benoît Thébaudeau <benoit.thebaudeau@advansee.com> Cc: Stefano Babic <sbabic@denx.de>
Diffstat (limited to 'arch/arm/cpu/arm926ejs/mx25')
-rw-r--r--arch/arm/cpu/arm926ejs/mx25/generic.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/arm/cpu/arm926ejs/mx25/generic.c b/arch/arm/cpu/arm926ejs/mx25/generic.c
index d34e84c..e25a695 100644
--- a/arch/arm/cpu/arm926ejs/mx25/generic.c
+++ b/arch/arm/cpu/arm926ejs/mx25/generic.c
@@ -80,12 +80,12 @@ ulong imx_get_armclk(void)
ulong div;
if (cctl & CCM_CCTL_ARM_SRC)
- fref = lldiv((fref * 3), 4);
+ fref = lldiv((u64) fref * 3, 4);
div = ((cctl >> CCM_CCTL_ARM_DIV_SHIFT)
& CCM_CCTL_ARM_DIV_MASK) + 1;
- return lldiv(fref, div);
+ return fref / div;
}
ulong imx_get_ahbclk(void)
@@ -98,7 +98,7 @@ ulong imx_get_ahbclk(void)
div = ((cctl >> CCM_CCTL_AHB_DIV_SHIFT)
& CCM_CCTL_AHB_DIV_MASK) + 1;
- return lldiv(fref, div);
+ return fref / div;
}
ulong imx_get_perclk(int clk)
@@ -110,7 +110,7 @@ ulong imx_get_perclk(int clk)
div = readl(&ccm->pcdr[CCM_PERCLK_REG(clk)]);
div = ((div >> CCM_PERCLK_SHIFT(clk)) & CCM_PERCLK_MASK) + 1;
- return lldiv(fref, div);
+ return fref / div;
}
unsigned int mxc_get_clock(enum mxc_clock clk)