imx8: add rom api wrappers
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>
Mon, 20 Jun 2022 08:53:19 +0000 (10:53 +0200)
committerStefano Babic <sbabic@denx.de>
Mon, 25 Jul 2022 13:35:34 +0000 (15:35 +0200)
commit748da8abb0d020bedbfa4dbc7b3cafdaf9bc60f1
tree7c4d901c63072ec40119b90cd99ea90df65e232e
parentde20c5d405a39cd4560495c342412e388fa73a52
imx8: add rom api wrappers

The ROM API is thoroughly undocumented, but apparently passing the xor
of the real arguments as an extra argument is required [1]. Also, we
need to do the "save gd/restore gd" dance. These are both error-prone,
and lead to a lot of code duplication.

Since both imx8m[np] and imx8ulp SOCs have this, add a separate
translation unit which is included precisely when the new
CONFIG_IMX8_ROMAPI symbol is set, which provide convenience wrappers
that take care of computing the xor value as well as doing the gd
dance, and that thus have a more intuitive API. Subsequent patches
will make use of these to reduce boilerplate.

[1] One wonders, for example, if the check is only applied to the
lower 32 bits, or if we're implicitly relying on all 64-bit pointer
values we're passing effectively have 0 in the upper 32 bits.

Reviewed-by: Peng Fan <peng.fan@nxp.com>
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
arch/arm/include/asm/mach-imx/sys_proto.h
arch/arm/mach-imx/Makefile
arch/arm/mach-imx/romapi.c [new file with mode: 0644]