mirror of
https://github.com/smaeul/u-boot.git
synced 2025-11-18 01:40:58 +00:00
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>
This commit is contained in:
parent
e9c99db778
commit
cb57811fbc
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user