[PATCH 18/22] ARM: k3: Add initial BeaglePlay board support
Sascha Hauer
s.hauer at pengutronix.de
Thu Aug 3 03:49:59 PDT 2023
This adds basic 2nd stage support for the BeaglePlay board, see
https://docs.beagle.cc/latest/boards/beagleplay/index.html
The BeaglePlay is based on the Texas Instruments AM62x (K3) SoC.
1st stage support is out of scope for now, but current support is enough
to be started as a Kernel from running U-Boot using the booti command.
When encapsulated in a FIT image the resulting image can replace
u-boot.img to directly boot into barebox.
Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
arch/arm/boards/Makefile | 1 +
arch/arm/boards/beagleplay/Makefile | 1 +
arch/arm/boards/beagleplay/entry.S | 29 +++++++++++++++++++++++
arch/arm/boards/beagleplay/lowlevel.c | 33 +++++++++++++++++++++++++++
arch/arm/dts/Makefile | 1 +
arch/arm/dts/k3-am625-beagleplay.dts | 9 ++++++++
arch/arm/mach-k3/Kconfig | 5 ++++
images/Makefile | 1 +
images/Makefile.k3 | 9 ++++++++
9 files changed, 89 insertions(+)
create mode 100644 arch/arm/boards/beagleplay/Makefile
create mode 100644 arch/arm/boards/beagleplay/entry.S
create mode 100644 arch/arm/boards/beagleplay/lowlevel.c
create mode 100644 arch/arm/dts/k3-am625-beagleplay.dts
create mode 100644 images/Makefile.k3
diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index 2877debad5..b34ef2e2cc 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -17,6 +17,7 @@ obj-$(CONFIG_MACH_AT91SAM9N12EK) += at91sam9n12ek/
obj-$(CONFIG_MACH_AT91SAM9X5EK) += at91sam9x5ek/
obj-$(CONFIG_MACH_BEAGLE) += beagle/
obj-$(CONFIG_MACH_BEAGLEBONE) += beaglebone/
+obj-$(CONFIG_MACH_BEAGLEPLAY) += beagleplay/
obj-$(CONFIG_MACH_CANON_A1100) += canon-a1100/
obj-$(CONFIG_MACH_CM_FX6) += cm-fx6/
obj-$(CONFIG_MACH_NITROGEN6) += boundarydevices-nitrogen6/
diff --git a/arch/arm/boards/beagleplay/Makefile b/arch/arm/boards/beagleplay/Makefile
new file mode 100644
index 0000000000..69935cc168
--- /dev/null
+++ b/arch/arm/boards/beagleplay/Makefile
@@ -0,0 +1 @@
+pbl-y += lowlevel.o entry.o
diff --git a/arch/arm/boards/beagleplay/entry.S b/arch/arm/boards/beagleplay/entry.S
new file mode 100644
index 0000000000..6e4c7196f3
--- /dev/null
+++ b/arch/arm/boards/beagleplay/entry.S
@@ -0,0 +1,29 @@
+/* SPDX-License-Identifier: GPL-2.0-or-later */
+#include <linux/linkage.h>
+#include <asm/barebox-arm64.h>
+#include <asm/image.h>
+
+#define IMAGE_FLAGS \
+ (ARM64_IMAGE_FLAG_PAGE_SIZE_4K << ARM64_IMAGE_FLAG_PAGE_SIZE_SHIFT) | \
+ (ARM64_IMAGE_FLAG_PHYS_BASE << ARM64_IMAGE_FLAG_PHYS_BASE_SHIFT)
+
+.section .text_head_entry_start_beagleplay
+ENTRY("start_beagleplay")
+ adr x1, 0 /* code0 */
+ b 2f /* code1 */
+ .xword 0x80000 /* Image load offset */
+ .xword _barebox_image_size /* Effective Image size */
+ .xword IMAGE_FLAGS /* Kernel flags */
+ .xword 0 /* reserved */
+ .xword 0 /* reserved */
+ .xword 0 /* reserved */
+ .ascii ARM64_IMAGE_MAGIC /* magic number */
+ .int 0 /* reserved (PE-COFF offset) */
+ .asciz "barebox" /* unused for now */
+2:
+ mov sp, x1
+ /* Stack now grows into the 0x80000 image load offset specified
+ * above. This is more than enough until FDT /memory is decoded.
+ */
+ b beagleplay
+ENTRY_PROC_END(start_beagleplay)
diff --git a/arch/arm/boards/beagleplay/lowlevel.c b/arch/arm/boards/beagleplay/lowlevel.c
new file mode 100644
index 0000000000..9d76dbd0a2
--- /dev/null
+++ b/arch/arm/boards/beagleplay/lowlevel.c
@@ -0,0 +1,33 @@
+// SPDX-License-Identifier: GPL-2.0-only
+
+#include <common.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/barebox-arm.h>
+#include <debug_ll.h>
+#include <pbl.h>
+
+/* Called from assembly */
+void beagleplay(void);
+
+static noinline void beagleplay_continue(void)
+{
+ unsigned long membase, memsize;
+ extern char __dtb_k3_am625_beagleplay_start[];
+
+ fdt_find_mem(__dtb_k3_am625_beagleplay_start, &membase, &memsize);
+
+ barebox_arm_entry(membase, memsize, __dtb_k3_am625_beagleplay_start);
+}
+
+void beagleplay(void)
+{
+ putc_ll('>');
+
+ arm_cpu_lowlevel_init();
+
+ relocate_to_current_adr();
+
+ setup_c();
+
+ beagleplay_continue();
+}
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 2a6823d988..b0d59749e5 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -7,6 +7,7 @@ obj- += dummy.o
lwl-$(CONFIG_MACH_ADVANTECH_ROM_742X) += imx6dl-advantech-rom-7421.dtb.o
lwl-$(CONFIG_MACH_AFI_GF) += am335x-afi-gf.dtb.o
lwl-$(CONFIG_MACH_BEAGLEBONE) += am335x-bone.dtb.o am335x-boneblack.dtb.o am335x-bone-common.dtb.o
+lwl-$(CONFIG_MACH_BEAGLEPLAY) += k3-am625-beagleplay.dtb.o
lwl-$(CONFIG_MACH_CANON_A1100) += canon-a1100.dtb.o
lwl-$(CONFIG_MACH_CLEP7212) += ep7212-clep7212.dtb.o
lwl-$(CONFIG_MACH_CM_FX6) += imx6dl-cm-fx6.dtb.o imx6q-cm-fx6.dtb.o imx6q-utilite.dtb.o
diff --git a/arch/arm/dts/k3-am625-beagleplay.dts b/arch/arm/dts/k3-am625-beagleplay.dts
new file mode 100644
index 0000000000..6efc178777
--- /dev/null
+++ b/arch/arm/dts/k3-am625-beagleplay.dts
@@ -0,0 +1,9 @@
+/dts-v1/;
+
+#include <arm64/ti/k3-am625-beagleplay.dts>
+
+/ {
+ chosen {
+ stdout-path = &main_uart0;
+ };
+};
diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig
index b2954493c4..152d231a56 100644
--- a/arch/arm/mach-k3/Kconfig
+++ b/arch/arm/mach-k3/Kconfig
@@ -3,4 +3,9 @@
menu "K3 boards"
depends on ARCH_K3
+config MACH_BEAGLEPLAY
+ bool "BeagleBoard BeaglePlay"
+ help
+ Say Y here if you are using a TI AM62x based BeaglePlay board
+
endmenu
diff --git a/images/Makefile b/images/Makefile
index c1cb56f5b1..d8cb45dbc0 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -166,6 +166,7 @@ include $(srctree)/images/Makefile.zynq
include $(srctree)/images/Makefile.zynqmp
include $(srctree)/images/Makefile.layerscape
include $(srctree)/images/Makefile.riscv
+include $(srctree)/images/Makefile.k3
pblb-$(CONFIG_BOARD_GENERIC_DT) += start_dt_2nd
diff --git a/images/Makefile.k3 b/images/Makefile.k3
new file mode 100644
index 0000000000..55d2e7ceeb
--- /dev/null
+++ b/images/Makefile.k3
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: GPL-2.0-only
+#
+# barebox image generation Makefile for K3 images
+#
+
+pblb-$(CONFIG_MACH_BEAGLEPLAY) += start_beagleplay
+FILE_barebox-beagleplay.img = start_beagleplay.pblb
+image-$(CONFIG_MACH_BEAGLEPLAY) += barebox-beagleplay.img
+
--
2.39.2
More information about the barebox
mailing list