Provide a generic io.h & address mapping functions
authorPaul Burton <[email protected]>
Thu, 14 Sep 2017 22:05:01 +0000 (15:05 -0700)
committerTom Rini <[email protected]>
Tue, 3 Oct 2017 01:52:19 +0000 (21:52 -0400)
commitd4150ca6dea5f81f527fb2a01fcffc3d8dd09fc4
tree1eaad2e5dfabab1393f2ab5806151a5f68905eb3
parent32c778637b999e874a5a92c2572b8c94bd9cdb11
Provide a generic io.h & address mapping functions

Most architectures currently supported by U-Boot use trivial
implementations of map_to_physmem & virt_to_phys which simply cast a
physical address to a pointer for use a virtual address & vice-versa.
This results in a lot of duplicate implementations of these mapping
functions.

The set of functions provided by different architectures also differs,
with some having implementations of phys_to_virt & others not. A later
patch will make use of phys_to_virt in architecture-neutral code, and so
requires that it be provided for all architectures.

This patch introduces an asm-generic/io.h which provides generic
implementations of address mapping functions, allowing the duplication
of them between architectures to be removed. Once architectures are
converted to make use of this generic header it will also ensure that
all of phys_to_virt, virt_to_phys, map_physmem & unmap_physmem are
provided. The 2 families of functions differ in that map_physmem may
create dynamic mappings whilst phys_to_virt may not & therefore is more
limited in scope but doesn't require information such as a length &
flags.

This patch doesn't convert any architectures to make use of this generic
header - later patches in the series will do so.

Signed-off-by: Paul Burton <[email protected]>
Cc: Albert Aribaud <[email protected]>
Cc: Alexey Brodkin <[email protected]>
Cc: Angelo Dureghello <[email protected]>
Cc: Bin Meng <[email protected]>
Cc: Daniel Schwierzeck <[email protected]>
Cc: Macpaul Lin <[email protected]>
Cc: Michal Simek <[email protected]>
Cc: Nobuhiro Iwamatsu <[email protected]>
Cc: Thomas Chou <[email protected]>
Cc: Wolfgang Denk <[email protected]>
Acked-by: Angelo Dureghello <[email protected]>
Tested-by: Angelo Dureghello <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Reviewed-by: Daniel Schwierzeck <[email protected]>
include/asm-generic/io.h [new file with mode: 0644]