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:
Sean Anderson 2021-03-10 21:02:17 -05:00 committed by Leo Yu-Chi Liang
parent e9c99db778
commit cb57811fbc

View File

@ -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);