[PATCH 15/18] rockchip: migrate hardware.h inclusion into appropriate files

Quentin Schulz quentin.schulz at theobroma-systems.com
Wed Jan 24 12:12:14 CET 2024


Hi Kever,

On 1/24/24 11:46, Kever Yang wrote:
> Hi Quentin,
> 
> On 2024/1/23 22:49, Quentin Schulz wrote:
>> From: Quentin Schulz <quentin.schulz at theobroma-systems.com>
>>
>> Nothing of the hardware.h is used in include/configs, therefore, let's
>> move that include to the files that actually require this include.
> 
> hardware.h is one of common header for soc level, it's reasonable in the 
> soc_common.h.
> 

hardware.h is only defining macros which are "wrappers" around writel().

writel() is NOT available in hardware.h, we need to include <asm/io.h>. 
Which means someone who wants to use the wrappers defined in hardware.h 
also needs to include the <asm/io.h> header, which doesn't make much sense.

Why this is done is because if I include <asm/io.h> in hardware.h but do 
not remove hardware.h from the SoC configs header files, some boards 
stop compiling in arch/arm/cpu/armv8/u-boot.lds with a non-existing 
ALIGN signature (expects two arguments instead of 1). I assume this is 
because there's an ALIGN macro somewhere in asm/io.h that redefines the 
ALIGN assembly directive (c.f. 
https://developer.arm.com/documentation/dui0473/m/directives-reference/align) 
and that u-boot.lds somehow includes the SoC config header file (because 
IIRC this is also included in the autogenerated include/config.h which 
is included by "everything" ?)

Basically, if I don't do that, then I need to manually add <asm/io.h> to 
any file that also include <asm/mach-rockchip/hardware.h>, which isn't 
really nice (but doable, we've done this until now).

If you still prefer to keep hardware.h include in the SoC config header 
file, then lemme know and I'll drop the hardware.h and io.h patches from 
that patch series.

Cheers,
Quentin


More information about the U-Boot mailing list