diff options
author | Sean Anderson <seanga2@gmail.com> | 2021-03-11 05:02:17 +0300 |
---|---|---|
committer | Leo Yu-Chi Liang <ycliang@andestech.com> | 2021-04-08 10:37:27 +0300 |
commit | cb57811fbc726cb93da92c05cdfbb880a8c78c50 (patch) | |
tree | c0c2ff56abd0625e23170508867b8aac512db016 /drivers/watchdog/designware_wdt.c | |
parent | e9c99db7787e3b5c2ef05701177c43ed1c023c27 (diff) | |
download | u-boot-cb57811fbc726cb93da92c05cdfbb880a8c78c50.tar.xz |
wdt: dw: Switch to using fls for log2
log_2_n_round_up is only found in arm. fls performs the same job and is
generic.
Signed-off-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/watchdog/designware_wdt.c')
-rw-r--r-- | drivers/watchdog/designware_wdt.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/drivers/watchdog/designware_wdt.c b/drivers/watchdog/designware_wdt.c index c020324973..1f0c5a77c9 100644 --- a/drivers/watchdog/designware_wdt.c +++ b/drivers/watchdog/designware_wdt.c @@ -9,7 +9,6 @@ #include <reset.h> #include <wdt.h> #include <asm/io.h> -#include <asm/utils.h> #include <linux/bitops.h> #define DW_WDT_CR 0x00 @@ -35,7 +34,7 @@ static int designware_wdt_settimeout(void __iomem *base, unsigned int clk_khz, signed int i; /* calculate the timeout range value */ - i = log_2_n_round_up(timeout * clk_khz) - 16; + i = fls(timeout * clk_khz - 1) - 16; i = clamp(i, 0, 15); writel(i | (i << 4), base + DW_WDT_TORR); |