diff options
author | Masahiro Yamada <yamada.m@jp.panasonic.com> | 2014-11-07 03:03:26 +0900 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2014-11-20 11:28:25 -0500 |
commit | 4515992fc7849c51997e3ff2d00352e36e14ebd7 (patch) | |
tree | b077195b0059735c2a4ed5648672b5a1d4e6e8f3 /arch/arm/cpu/armv7/omap-common/abb.c | |
parent | 3fd968e9314942f2840f8f9fda98079cc0d82288 (diff) | |
download | u-boot-imx-4515992fc7849c51997e3ff2d00352e36e14ebd7.zip u-boot-imx-4515992fc7849c51997e3ff2d00352e36e14ebd7.tar.gz u-boot-imx-4515992fc7849c51997e3ff2d00352e36e14ebd7.tar.bz2 |
replace DIV_ROUND with DIV_ROUND_CLOSEST
The Linux-compatible macro DIV_ROUND_CLOSEST is a bit more flexible
and safer than DIV_ROUND.
For example,
foo = DIV_ROUND_CLOSEST(x, y++)
works expectedly, but
foo = DIV_ROUND(x, y++)
does not. (y is incremented twice.)
Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Diffstat (limited to 'arch/arm/cpu/armv7/omap-common/abb.c')
-rw-r--r-- | arch/arm/cpu/armv7/omap-common/abb.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/arm/cpu/armv7/omap-common/abb.c b/arch/arm/cpu/armv7/omap-common/abb.c index 423aeb9..a0add66 100644 --- a/arch/arm/cpu/armv7/omap-common/abb.c +++ b/arch/arm/cpu/armv7/omap-common/abb.c @@ -48,9 +48,9 @@ static void abb_setup_timings(u32 setup) */ /* calculate SR2_WTCNT_VALUE */ - sys_rate = DIV_ROUND(V_OSCK, 1000000); - clk_cycles = DIV_ROUND(OMAP_ABB_CLOCK_CYCLES * 10, sys_rate); - sr2_cnt = DIV_ROUND(OMAP_ABB_SETTLING_TIME * 10, clk_cycles); + sys_rate = DIV_ROUND_CLOSEST(V_OSCK, 1000000); + clk_cycles = DIV_ROUND_CLOSEST(OMAP_ABB_CLOCK_CYCLES * 10, sys_rate); + sr2_cnt = DIV_ROUND_CLOSEST(OMAP_ABB_SETTLING_TIME * 10, clk_cycles); setbits_le32(setup, sr2_cnt << (ffs(OMAP_ABB_SETUP_SR2_WTCNT_VALUE_MASK) - 1)); |