[PATCH 01/11] lib: Import iomem_copy from Linux Kernel
Kumar, Udit
u-kumar1 at ti.com
Tue Oct 14 11:32:28 CEST 2025
Hi Peng.
On 10/14/2025 7:31 AM, Peng Fan wrote:
> On Mon, Oct 13, 2025 at 11:41:25PM +0530, Kumar, Udit wrote:
>> On 10/13/2025 8:19 AM, Peng Fan (OSS) wrote:
>>> From: Peng Fan <peng.fan at nxp.com>
>>>
>>> memcpy_{from,to}io and memset_io is needed for i.MX8M to write
>>> TCM area. So import the APIs from Linux Kernel 6.17.
>>>
>>> Reviewed-by: Ye Li <ye.li at nxp.com>
>>> Signed-off-by: Peng Fan <peng.fan at nxp.com>
>>> ---
>>> include/asm-generic/io.h | 37 +++++++++++++
>>> lib/Makefile | 1 +
>>> lib/iomem_copy.c | 136 +++++++++++++++++++++++++++++++++++++++++++++++
>>> 3 files changed, 174 insertions(+)
>>>
>>> diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h
>>> index 13d99cfb5973399209c00adee0080ff83414c064..cf981ad3501f935c714b7580536540e7aba249c1 100644
>>> --- a/include/asm-generic/io.h
>>> +++ b/include/asm-generic/io.h
>>> @@ -3,6 +3,7 @@
>>> * Generic I/O functions.
>>> *
>>> * Copyright (c) 2016 Imagination Technologies Ltd.
>>> + * Copyright 2025 NXP
>>> */
>>> #ifndef __ASM_GENERIC_IO_H__
>>> @@ -453,5 +454,41 @@ static inline void iowrite64_rep(volatile void __iomem *addr,
>>> #endif
>>> #endif /* CONFIG_64BIT */
>>> +#ifndef memset_io
>> If you are on arm, then
>>
>> arch/arm/include/asm/io.h defines these io functions, for ARM64 and non-ARM64
>> platform,
>>
>> In your SOC, how this works.
> Thanks for pointing this out, I thought these helpers were not defined,
> so I import this file from Linux. So on my platform, the arm64 io helpers
> are used, the functions in this file are not used because there is
> "#ifndef xx".
>
> But anyway, for non-ARM/ARM64 platforms, this file is still useful.
>
> I could drop this if you prefer. Or keep this for other ARCH.
if you are test on other ARCH, please keep otherwise, you can drop this.
>
> Thanks
> Peng
>
>>> +/**
>>> + * memset_io - Set a range of I/O memory to a constant value
>>> + * @addr: The beginning of the I/O-memory range to set
>>> + * @val: The value to set the memory to
>>> + * @count: The number of bytes to set
>>> + *
>>> + * Set a range of I/O memory to a given value.
>>> + */
>>> +void memset_io(volatile void __iomem *addr, int val, size_t count);
>>> +#endif
>>> +
>>> +#ifndef memcpy_fromio
>>> +/**
>>> [..]
More information about the U-Boot
mailing list