[PATCH v5 25/33] wdt: Move asm/utils.h to log2.h

Sean Anderson seanga2 at gmail.com
Tue Mar 3 15:11:21 CET 2020


On 3/3/20 1:58 AM, Rick Chen wrote:
> Hi Sean
> 
>> This header is needed outside of the arm architecture for the designware
>> watchdog.
>>
>> Signed-off-by: Sean Anderson <seanga2 at gmail.com>
>> Reviewed-by: Simon Glass <sjg at chromium.org>
>> ---
>> This patch previously appeared as
>> https://patchwork.ozlabs.org/patch/1232411/
>>
>> Changes in v5:
>> - New
> 
> I wonder why this is ARM architecture relative but be append to RISC-V
> patchsets.
> Maybe it shall be send as another patch individually.
> 
> Thanks
> Rick
> 

This header is used by the designware watchdog. However, it currently is
located in arch/arm/include, so it cannot be used on riscv. Marek's
suggestion to patch the wdt to not use log2() instead may be a better
solution to not touch so many arm files.

--Sean

>> - Include linux/err.h explicitly
>>
>>  arch/arm/cpu/armv7/cache_v7.c                  | 2 +-
>>  arch/arm/mach-davinci/spl.c                    | 2 +-
>>  arch/arm/mach-omap2/clocks-common.c            | 2 +-
>>  arch/arm/mach-omap2/emif-common.c              | 2 +-
>>  arch/arm/mach-omap2/omap4/emif.c               | 2 +-
>>  arch/arm/mach-omap2/omap5/dra7xx_iodelay.c     | 2 +-
>>  arch/arm/mach-omap2/omap5/emif.c               | 2 +-
>>  arch/arm/mach-omap2/omap5/hwinit.c             | 2 +-
>>  arch/arm/mach-socfpga/spl_a10.c                | 2 +-
>>  arch/arm/mach-socfpga/spl_agilex.c             | 2 +-
>>  arch/arm/mach-socfpga/spl_gen5.c               | 2 +-
>>  arch/arm/mach-socfpga/spl_s10.c                | 2 +-
>>  drivers/watchdog/designware_wdt.c              | 3 ++-
>>  arch/arm/include/asm/utils.h => include/log2.h | 4 ++--
>>  14 files changed, 16 insertions(+), 15 deletions(-)
>>  rename arch/arm/include/asm/utils.h => include/log2.h (93%)
>>
>> diff --git a/arch/arm/cpu/armv7/cache_v7.c b/arch/arm/cpu/armv7/cache_v7.c
>> index 99eb7db342..049a27cc92 100644
>> --- a/arch/arm/cpu/armv7/cache_v7.c
>> +++ b/arch/arm/cpu/armv7/cache_v7.c
>> @@ -8,7 +8,7 @@
>>  #include <linux/types.h>
>>  #include <common.h>
>>  #include <asm/armv7.h>
>> -#include <asm/utils.h>
>> +#include <log2.h>
>>
>>  #define ARMV7_DCACHE_INVAL_RANGE       1
>>  #define ARMV7_DCACHE_CLEAN_INVAL_RANGE 2
>> diff --git a/arch/arm/mach-davinci/spl.c b/arch/arm/mach-davinci/spl.c
>> index d44e840aa0..c1a62b662d 100644
>> --- a/arch/arm/mach-davinci/spl.c
>> +++ b/arch/arm/mach-davinci/spl.c
>> @@ -8,7 +8,7 @@
>>  #include <hang.h>
>>  #include <spl.h>
>>  #include <asm/u-boot.h>
>> -#include <asm/utils.h>
>> +#include <log2.h>
>>  #include <nand.h>
>>  #include <asm/arch/dm365_lowlevel.h>
>>  #include <ns16550.h>
>> diff --git a/arch/arm/mach-omap2/clocks-common.c b/arch/arm/mach-omap2/clocks-common.c
>> index 9aff83e9df..67c62e8eb0 100644
>> --- a/arch/arm/mach-omap2/clocks-common.c
>> +++ b/arch/arm/mach-omap2/clocks-common.c
>> @@ -19,7 +19,7 @@
>>  #include <asm/gpio.h>
>>  #include <asm/arch/clock.h>
>>  #include <asm/arch/sys_proto.h>
>> -#include <asm/utils.h>
>> +#include <log2.h>
>>  #include <asm/omap_gpio.h>
>>  #include <asm/emif.h>
>>
>> diff --git a/arch/arm/mach-omap2/emif-common.c b/arch/arm/mach-omap2/emif-common.c
>> index 4658f67e84..2762934092 100644
>> --- a/arch/arm/mach-omap2/emif-common.c
>> +++ b/arch/arm/mach-omap2/emif-common.c
>> @@ -17,7 +17,7 @@
>>  #include <asm/arch/sys_proto.h>
>>  #include <asm/omap_common.h>
>>  #include <asm/omap_sec_common.h>
>> -#include <asm/utils.h>
>> +#include <log2.h>
>>  #include <linux/compiler.h>
>>  #include <asm/ti-common/ti-edma3.h>
>>
>> diff --git a/arch/arm/mach-omap2/omap4/emif.c b/arch/arm/mach-omap2/omap4/emif.c
>> index 35a51645be..d2b530535e 100644
>> --- a/arch/arm/mach-omap2/omap4/emif.c
>> +++ b/arch/arm/mach-omap2/omap4/emif.c
>> @@ -11,7 +11,7 @@
>>  #include <common.h>
>>  #include <asm/emif.h>
>>  #include <asm/arch/sys_proto.h>
>> -#include <asm/utils.h>
>> +#include <log2.h>
>>
>>  #ifndef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS
>>  u32 *const T_num = (u32 *)OMAP_SRAM_SCRATCH_EMIF_T_NUM;
>> diff --git a/arch/arm/mach-omap2/omap5/dra7xx_iodelay.c b/arch/arm/mach-omap2/omap5/dra7xx_iodelay.c
>> index 598074ba21..607188bcae 100644
>> --- a/arch/arm/mach-omap2/omap5/dra7xx_iodelay.c
>> +++ b/arch/arm/mach-omap2/omap5/dra7xx_iodelay.c
>> @@ -8,7 +8,7 @@
>>
>>  #include <common.h>
>>  #include <hang.h>
>> -#include <asm/utils.h>
>> +#include <log2.h>
>>  #include <asm/arch/dra7xx_iodelay.h>
>>  #include <asm/arch/omap.h>
>>  #include <asm/arch/sys_proto.h>
>> diff --git a/arch/arm/mach-omap2/omap5/emif.c b/arch/arm/mach-omap2/omap5/emif.c
>> index f3661a0e74..a5c74261c0 100644
>> --- a/arch/arm/mach-omap2/omap5/emif.c
>> +++ b/arch/arm/mach-omap2/omap5/emif.c
>> @@ -11,7 +11,7 @@
>>  #include <common.h>
>>  #include <asm/emif.h>
>>  #include <asm/arch/sys_proto.h>
>> -#include <asm/utils.h>
>> +#include <log2.h>
>>
>>  #ifndef CONFIG_SYS_EMIF_PRECALCULATED_TIMING_REGS
>>  #define print_timing_reg(reg) debug(#reg" - 0x%08x\n", (reg))
>> diff --git a/arch/arm/mach-omap2/omap5/hwinit.c b/arch/arm/mach-omap2/omap5/hwinit.c
>> index 3b1733099f..290449e918 100644
>> --- a/arch/arm/mach-omap2/omap5/hwinit.c
>> +++ b/arch/arm/mach-omap2/omap5/hwinit.c
>> @@ -19,7 +19,7 @@
>>  #include <asm/arch/sys_proto.h>
>>  #include <asm/arch/clock.h>
>>  #include <linux/sizes.h>
>> -#include <asm/utils.h>
>> +#include <log2.h>
>>  #include <asm/arch/gpio.h>
>>  #include <asm/emif.h>
>>  #include <asm/omap_common.h>
>> diff --git a/arch/arm/mach-socfpga/spl_a10.c b/arch/arm/mach-socfpga/spl_a10.c
>> index d9ef851054..0f24bec4ef 100644
>> --- a/arch/arm/mach-socfpga/spl_a10.c
>> +++ b/arch/arm/mach-socfpga/spl_a10.c
>> @@ -9,7 +9,7 @@
>>  #include <asm/io.h>
>>  #include <asm/pl310.h>
>>  #include <asm/u-boot.h>
>> -#include <asm/utils.h>
>> +#include <log2.h>
>>  #include <image.h>
>>  #include <asm/arch/reset_manager.h>
>>  #include <spl.h>
>> diff --git a/arch/arm/mach-socfpga/spl_agilex.c b/arch/arm/mach-socfpga/spl_agilex.c
>> index ecc1a35c49..54b16c9061 100644
>> --- a/arch/arm/mach-socfpga/spl_agilex.c
>> +++ b/arch/arm/mach-socfpga/spl_agilex.c
>> @@ -6,7 +6,7 @@
>>
>>  #include <asm/io.h>
>>  #include <asm/u-boot.h>
>> -#include <asm/utils.h>
>> +#include <log2.h>
>>  #include <common.h>
>>  #include <hang.h>
>>  #include <image.h>
>> diff --git a/arch/arm/mach-socfpga/spl_gen5.c b/arch/arm/mach-socfpga/spl_gen5.c
>> index a01e2a5cb9..bab609ad29 100644
>> --- a/arch/arm/mach-socfpga/spl_gen5.c
>> +++ b/arch/arm/mach-socfpga/spl_gen5.c
>> @@ -7,7 +7,7 @@
>>  #include <hang.h>
>>  #include <asm/io.h>
>>  #include <asm/u-boot.h>
>> -#include <asm/utils.h>
>> +#include <log2.h>
>>  #include <image.h>
>>  #include <asm/arch/reset_manager.h>
>>  #include <spl.h>
>> diff --git a/arch/arm/mach-socfpga/spl_s10.c b/arch/arm/mach-socfpga/spl_s10.c
>> index d89151d902..48c64ef47a 100644
>> --- a/arch/arm/mach-socfpga/spl_s10.c
>> +++ b/arch/arm/mach-socfpga/spl_s10.c
>> @@ -7,7 +7,7 @@
>>  #include <hang.h>
>>  #include <asm/io.h>
>>  #include <asm/u-boot.h>
>> -#include <asm/utils.h>
>> +#include <log2.h>
>>  #include <common.h>
>>  #include <debug_uart.h>
>>  #include <image.h>
>> diff --git a/drivers/watchdog/designware_wdt.c b/drivers/watchdog/designware_wdt.c
>> index 1024a04596..a58a2dfca4 100644
>> --- a/drivers/watchdog/designware_wdt.c
>> +++ b/drivers/watchdog/designware_wdt.c
>> @@ -9,7 +9,8 @@
>>  #include <reset.h>
>>  #include <wdt.h>
>>  #include <asm/io.h>
>> -#include <asm/utils.h>
>> +#include <log2.h>
>> +#include <watchdog.h>
>>
>>  #define DW_WDT_CR      0x00
>>  #define DW_WDT_TORR    0x04
>> diff --git a/arch/arm/include/asm/utils.h b/include/log2.h
>> similarity index 93%
>> rename from arch/arm/include/asm/utils.h
>> rename to include/log2.h
>> index eee60c50e9..4f89d3dd76 100644
>> --- a/arch/arm/include/asm/utils.h
>> +++ b/include/log2.h
>> @@ -4,8 +4,8 @@
>>   * Texas Instruments, <www.ti.com>
>>   * Aneesh V <aneesh at ti.com>
>>   */
>> -#ifndef _UTILS_H_
>> -#define _UTILS_H_
>> +#ifndef _LOG2_H_
>> +#define _LOG2_H_
>>
>>  static inline s32 log_2_n_round_up(u32 n)
>>  {
>> --
>> 2.25.0
>>




More information about the U-Boot mailing list