uboot-tools/AW64-add-spl-atf-support.patch
2017-08-01 09:43:10 +01:00

195 lines
5.7 KiB
Diff

From patchwork Fri Mar 31 22:31:26 2017
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [U-Boot,v3,14/19] sunxi: 64-bit SoCs: introduce FIT generator script
From: Andre Przywara <andre.przywara@arm.com>
X-Patchwork-Id: 745831
X-Patchwork-Delegate: jagannadh.teki@gmail.com
Message-Id: <1490999491-14899-15-git-send-email-andre.przywara@arm.com>
To: Maxime Ripard <maxime.ripard@free-electrons.com>,
Jagan Teki <jagan@openedev.com>, Simon Glass <sjg@chromium.org>,
Tom Rini <trini@konsulko.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>,
Michal Simek <michal.simek@xilinx.com>, u-boot@lists.denx.de,
Icenowy Zheng <icenowy@aosc.xyz>
Date: Fri, 31 Mar 2017 23:31:26 +0100
Now that the Makefile can call a generator script to build a more
advanced FIT image, let's use this feature to address the needs of
Allwinner boards with 64-bit SoCs (A64 and H5).
The (DTB stripped) U-Boot binary and the ATF are static, but we allow
an arbitrary number of supported device trees to be passed.
The script enters both a DT entry in the /images node and the respective
subnode in /configurations to support all listed DTBs.
This requires to copy the ARM Trusted Firmware build (bl31.bin) into
the U-Boot source directory (or to create a symlink to it).
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
board/sunxi/mksunxi_fit_atf.sh | 73 ++++++++++++++++++++++++++++++++++++++++++
1 file changed, 73 insertions(+)
create mode 100755 board/sunxi/mksunxi_fit_atf.sh
diff --git a/board/sunxi/mksunxi_fit_atf.sh b/board/sunxi/mksunxi_fit_atf.sh
new file mode 100755
index 0000000..afa22e8
--- /dev/null
+++ b/board/sunxi/mksunxi_fit_atf.sh
@@ -0,0 +1,73 @@
+#!/bin/sh
+#
+# script to generate FIT image source for 64-bit sunxi boards with
+# ARM Trusted Firmware and multiple device trees (given on the command line)
+#
+# usage: $0 <dt_name> [<dt_name> [<dt_name] ...]
+
+cat << __HEADER_EOF
+/dts-v1/;
+
+/ {
+ description = "Configuration to load ATF before U-Boot";
+ #address-cells = <1>;
+
+ images {
+ uboot@1 {
+ description = "U-Boot (64-bit)";
+ data = /incbin/("u-boot-nodtb.bin");
+ type = "standalone";
+ arch = "arm64";
+ compression = "none";
+ load = <0x4a000000>;
+ };
+ atf@1 {
+ description = "ARM Trusted Firmware";
+ data = /incbin/("bl31.bin");
+ type = "firmware";
+ arch = "arm64";
+ compression = "none";
+ load = <0x44000>;
+ entry = <0x44000>;
+ };
+__HEADER_EOF
+
+cnt=1
+for dtname in $*
+do
+ cat << __FDT_IMAGE_EOF
+ fdt@$cnt {
+ description = "$(basename $dtname .dtb)";
+ data = /incbin/("$dtname");
+ type = "flat_dt";
+ compression = "none";
+ };
+__FDT_IMAGE_EOF
+ cnt=$((cnt+1))
+done
+
+cat << __CONF_HEADER_EOF
+ };
+ configurations {
+ default = "config@1";
+
+__CONF_HEADER_EOF
+
+cnt=1
+for dtname in $*
+do
+ cat << __CONF_SECTION_EOF
+ config@$cnt {
+ description = "$(basename $dtname .dtb)";
+ firmware = "uboot@1";
+ loadables = "atf@1";
+ fdt = "fdt@$cnt";
+ };
+__CONF_SECTION_EOF
+ cnt=$((cnt+1))
+done
+
+cat << __ITS_EOF
+ };
+};
+__ITS_EOF
From patchwork Fri Mar 31 22:31:28 2017
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Subject: [U-Boot,v3,16/19] sunxi: enable automatic FIT build for 64-bit SoCs
From: Andre Przywara <andre.przywara@arm.com>
X-Patchwork-Id: 745840
X-Patchwork-Delegate: jagannadh.teki@gmail.com
Message-Id: <1490999491-14899-17-git-send-email-andre.przywara@arm.com>
To: Maxime Ripard <maxime.ripard@free-electrons.com>,
Jagan Teki <jagan@openedev.com>, Simon Glass <sjg@chromium.org>,
Tom Rini <trini@konsulko.com>
Cc: Philipp Tomsich <philipp.tomsich@theobroma-systems.com>,
Michal Simek <michal.simek@xilinx.com>, u-boot@lists.denx.de,
Icenowy Zheng <icenowy@aosc.xyz>
Date: Fri, 31 Mar 2017 23:31:28 +0100
The Allwinner SoCs with 64-bit cores use an ARM Trusted Firmware binary,
which needs to be loaded alongside U-Boot proper.
Set the respective Kconfig options to let them select this feature and
also automatically build the FIT image.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Acked-by: Maxime Ripard <maxime.ripard@free-electrons.com>
---
Kconfig | 1 +
board/sunxi/Kconfig | 4 ++++
include/configs/sunxi-common.h | 4 ++++
3 files changed, 9 insertions(+)
diff --git a/Kconfig b/Kconfig
index 5c82788..ffea4c3 100644
--- a/Kconfig
+++ b/Kconfig
@@ -252,6 +252,7 @@ config SPL_FIT_SOURCE
config SPL_FIT_GENERATOR
string ".its file generator script for U-Boot FIT image"
depends on SPL_FIT
+ default "board/sunxi/mksunxi_fit_atf.sh" if SPL_LOAD_FIT && ARCH_SUNXI
help
Specifies a (platform specific) script file to generate the FIT
source file used to build the U-Boot FIT image file. This gets
diff --git a/board/sunxi/Kconfig b/board/sunxi/Kconfig
index 3e0e262..b629f3b 100644
--- a/board/sunxi/Kconfig
+++ b/board/sunxi/Kconfig
@@ -145,12 +145,16 @@ config MACH_SUN50I
select SUNXI_GEN_SUN6I
select SUNXI_HIGH_SRAM
select SUPPORT_SPL
+ select FIT
+ select SPL_LOAD_FIT
config MACH_SUN50I_H5
bool "sun50i (Allwinner H5)"
select ARM64
select MACH_SUNXI_H3_H5
select SUNXI_HIGH_SRAM
+ select FIT
+ select SPL_LOAD_FIT
endchoice
diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index b7eb95e..1982063 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -32,6 +32,10 @@
# define CONFIG_MACH_TYPE_COMPAT_REV 1
#endif
+#ifdef CONFIG_ARM64
+#define CONFIG_BUILD_TARGET "u-boot.itb"
+#endif
+
/* Serial & console */
#define CONFIG_SYS_NS16550_SERIAL
/* ns16550 reg in the low bits of cpu reg */