[PATCH 1/2] dm: core: Add functions to read 8/16-bit integers

Stefan Herbrechtsmeier stefan.herbrechtsmeier-oss at weidmueller.com
Tue Jul 12 20:31:41 CEST 2022


Hi Simon,

Am 12.07.2022 um 12:58 schrieb Simon Glass:
> Hi Stefan,
> 
> On Tue, 14 Jun 2022 at 07:22, Stefan Herbrechtsmeier
> <stefan.herbrechtsmeier-oss at weidmueller.com> wrote:
>>
>> From: Stefan Herbrechtsmeier <stefan.herbrechtsmeier at weidmueller.com>
>>
>> Add functions to read 8/16-bit integers like the existing functions for
>> 32/64-bit to simplify read of 8/16-bit integers from device tree
>> properties.
>>
>> Signed-off-by: Stefan Herbrechtsmeier <stefan.herbrechtsmeier at weidmueller.com>
>> ---
>>
>>   arch/sandbox/dts/test.dts |  2 ++
>>   drivers/core/of_access.c  | 38 +++++++++++++++++++++++
>>   drivers/core/ofnode.c     | 62 +++++++++++++++++++++++++++++++++++++
>>   drivers/core/read.c       | 21 +++++++++++++
>>   include/dm/of_access.h    | 32 +++++++++++++++++++
>>   include/dm/ofnode.h       | 40 ++++++++++++++++++++++++
>>   include/dm/read.h         | 65 +++++++++++++++++++++++++++++++++++++++
>>   test/dm/test-fdt.c        | 19 ++++++++++++
>>   8 files changed, 279 insertions(+)
> 
> This looks good but is very expensive in terms of code size. Can you
> update your u8 and u16 functions to reuse the existing u32 function
> and just convert the value?

The u32 function requires a 32 bit value inside the device tree because 
it checks the size and maybe swap the bytes.

The u8 and u16 function requires only a 8 and 16 bit value inside the 
device tree.

Regards
   Stefan


More information about the U-Boot mailing list