[PATCH v2 02/16] linux/io.h: Use map_physmem to implement ioremap

Simon Glass sjg at chromium.org
Thu Jul 2 12:21:56 CEST 2026


Hi Jiaxun,

On 2026-07-01T11:17:53, Yao Zi <me at ziyao.cc> wrote:
> linux/io.h: Use map_physmem to implement ioremap
>
> ioremap API is here to be compatible with Linux drivers,
> to maintain compatibility we need to ensure we are using
> the same way to determine virtual address for IO devices
> from physical address.
>
> map_physmem is U-Boot's standard way for doing the trick,
> we should follow that. For architectures VA == PA it has
> no impact, for MIPS it has it's own ioremap implementation
> in asm/io.h anyway.
>
> Signed-off-by: Jiaxun Yang <jiaxun.yang at flygoat.com>
> Signed-off-by: Yao Zi <me at ziyao.cc>
>
> include/linux/io.h | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)

> diff --git a/include/linux/io.h b/include/linux/io.h
> @@ -59,11 +59,12 @@ static inline void iowrite64(u64 value, volatile void __iomem *addr)
>  static inline void __iomem *ioremap(resource_size_t offset,
>                                   resource_size_t size)
>  {
> -     return (void __iomem *)(unsigned long)offset;
> +     return (void __iomem *)map_physmem(offset, size, MAP_NOCACHE);
>  }

This affects sandbox, but should be fine.

Reviewed-by: Simon Glass <sjg at chromium.org>

Regards,
Simon


More information about the U-Boot mailing list