allwinner: Find DTB in BL33 image
authorAndre Przywara <andre.przywara@arm.com>
Sun, 16 Sep 2018 01:08:06 +0000 (02:08 +0100)
committerAndre Przywara <andre.przywara@arm.com>
Sat, 20 Oct 2018 15:23:59 +0000 (16:23 +0100)
commit41538930555182e4c36f44677e5df2b97d266350
treebb5d0afe3daa706c2514931a1710e43bd1feb4cb
parenteae5fe79558c0c2744f74ca88970b16ce45450b1
allwinner: Find DTB in BL33 image

The initial PMIC setup for the Allwinner platform is quite board
specific, and used to be guarded by reading the .dtb stub *name* from the
SPL image in the legacy ATF port. This doesn't scale particularly well,
and requires constant maintainance.
Instead having the actual .dtb available would be much better, as the PMIC
setup requirements could be read from there directly.
The only available BL33 for Allwinner platforms so far is U-Boot, and
fortunately U-Boot comes with the full featured .dtb, appended to the
end of the U-Boot image.

Introduce some code that scans the beginning of the BL33 image to look
for the load address, which is followed by the image size. Adding those
two values together gives us the end of the image and thus the .dtb
address. Verify that this heuristic is valid by sanitising some values
and checking the DTB magic.

Print out the DTB address and the model name, if specified in the root
node.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
plat/allwinner/common/allwinner-common.mk
plat/allwinner/common/include/platform_def.h
plat/allwinner/common/sunxi_bl31_setup.c