mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/3] Xilinx Zynq Ultrascale+ MPSoC support
@ 2018-11-23 13:35 Michael Tretter
  2018-11-23 13:35 ` [PATCH 1/3] ARM: lib64: .gitignore barebox.lds Michael Tretter
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Michael Tretter @ 2018-11-23 13:35 UTC (permalink / raw)
  To: barebox; +Cc: Michael Tretter

This series adds support for the Xilinx Zynq Ultrascale+ MPSoC platform and
the ZCU104 Evaluation Kit.

Barebox is executed as BL33, i.e, platform setup is already done by the First
Stage Boot Loader. This also implies that the Barebox image cannot be booted
as is, but must be added to a ZynqMP boot.bin binary first. See "mkimage -T
zynqmpbif" from U-Boot for how to generate such an image.

I'm not really happy how the entry function is implemented in
arch/arm/boards/xilinx-zcu104/lowlevel_init.S and any suggestions for
improvement are welcome.

Michael

Michael Tretter (3):
  ARM: lib64: .gitignore barebox.lds
  ARM: aarch64: compile with general-regs-only
  ARM: zynqmp: add support for Xilinx ZCU104 board

 arch/arm/Kconfig                              | 14 +++++++
 arch/arm/Makefile                             |  5 +++
 arch/arm/boards/Makefile                      |  1 +
 arch/arm/boards/xilinx-zcu104/Makefile        |  2 +
 arch/arm/boards/xilinx-zcu104/board.c         | 25 ++++++++++++
 arch/arm/boards/xilinx-zcu104/lowlevel.c      | 30 +++++++++++++++
 arch/arm/boards/xilinx-zcu104/lowlevel_init.S | 32 ++++++++++++++++
 arch/arm/configs/zynqmp_defconfig             | 38 +++++++++++++++++++
 arch/arm/dts/Makefile                         |  1 +
 arch/arm/lib64/.gitignore                     |  1 +
 arch/arm/mach-zynqmp/Kconfig                  |  9 +++++
 arch/arm/mach-zynqmp/Makefile                 |  1 +
 arch/arm/mach-zynqmp/include/mach/debug_ll.h  | 30 +++++++++++++++
 arch/arm/mach-zynqmp/zynqmp.c                 | 22 +++++++++++
 images/Makefile                               |  1 +
 images/Makefile.zynqmp                        |  7 ++++
 16 files changed, 219 insertions(+)
 create mode 100644 arch/arm/boards/xilinx-zcu104/Makefile
 create mode 100644 arch/arm/boards/xilinx-zcu104/board.c
 create mode 100644 arch/arm/boards/xilinx-zcu104/lowlevel.c
 create mode 100644 arch/arm/boards/xilinx-zcu104/lowlevel_init.S
 create mode 100644 arch/arm/configs/zynqmp_defconfig
 create mode 100644 arch/arm/lib64/.gitignore
 create mode 100644 arch/arm/mach-zynqmp/Kconfig
 create mode 100644 arch/arm/mach-zynqmp/Makefile
 create mode 100644 arch/arm/mach-zynqmp/include/mach/debug_ll.h
 create mode 100644 arch/arm/mach-zynqmp/zynqmp.c
 create mode 100644 images/Makefile.zynqmp

-- 
2.19.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 1/3] ARM: lib64: .gitignore barebox.lds
  2018-11-23 13:35 [PATCH 0/3] Xilinx Zynq Ultrascale+ MPSoC support Michael Tretter
@ 2018-11-23 13:35 ` Michael Tretter
  2018-11-23 13:35 ` [PATCH 2/3] ARM: aarch64: compile with general-regs-only Michael Tretter
  2018-11-23 13:35 ` [PATCH 3/3] ARM: zynqmp: add support for Xilinx ZCU104 board Michael Tretter
  2 siblings, 0 replies; 11+ messages in thread
From: Michael Tretter @ 2018-11-23 13:35 UTC (permalink / raw)
  To: barebox; +Cc: Michael Tretter

Commit e1287b1a8b27 ("arm: rework lib directory to support arm64")
restructured the lib directory and added the lib64 directory. It moved
the existing .gitignore to the lib32 directory but didn't add a new
.gitignore for lib64.

Thus building Barebox for arm64 results in stray barebox.lds files.

Copy the .gitignore from lib32 to lib64.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
 arch/arm/lib64/.gitignore | 1 +
 1 file changed, 1 insertion(+)
 create mode 100644 arch/arm/lib64/.gitignore

diff --git a/arch/arm/lib64/.gitignore b/arch/arm/lib64/.gitignore
new file mode 100644
index 0000000000..d1165788c9
--- /dev/null
+++ b/arch/arm/lib64/.gitignore
@@ -0,0 +1 @@
+barebox.lds
-- 
2.19.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 2/3] ARM: aarch64: compile with general-regs-only
  2018-11-23 13:35 [PATCH 0/3] Xilinx Zynq Ultrascale+ MPSoC support Michael Tretter
  2018-11-23 13:35 ` [PATCH 1/3] ARM: lib64: .gitignore barebox.lds Michael Tretter
@ 2018-11-23 13:35 ` Michael Tretter
  2018-11-23 13:48   ` Rouven Czerwinski
  2018-11-23 13:35 ` [PATCH 3/3] ARM: zynqmp: add support for Xilinx ZCU104 board Michael Tretter
  2 siblings, 1 reply; 11+ messages in thread
From: Michael Tretter @ 2018-11-23 13:35 UTC (permalink / raw)
  To: barebox; +Cc: Michael Tretter

Without this flag, gcc generates code to save the Q/V registers to the
stack for handling the va_list in pr_print(). Saving the registers is
use useless, as the registers are never restored, but this hangs the
CPU.

Follow the Linux arch/arm64/Makefile and the general-regs-only flag, to
prevent usage of floating point and Advanced SIMD register.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
 arch/arm/Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 5db67b9db8..50958b787f 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -27,6 +27,10 @@ else
 CFLAGS += -mstrict-align
 endif
 
+# Prevent use of floating point and Advanced SIMD registers.
+ifeq ($(CONFIG_CPU_V8),y)
+CFLAGS += -mgeneral-regs-only
+endif
 
 # This selects which instruction set is used.
 # Note that GCC does not numerically define an architecture version
-- 
2.19.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 3/3] ARM: zynqmp: add support for Xilinx ZCU104 board
  2018-11-23 13:35 [PATCH 0/3] Xilinx Zynq Ultrascale+ MPSoC support Michael Tretter
  2018-11-23 13:35 ` [PATCH 1/3] ARM: lib64: .gitignore barebox.lds Michael Tretter
  2018-11-23 13:35 ` [PATCH 2/3] ARM: aarch64: compile with general-regs-only Michael Tretter
@ 2018-11-23 13:35 ` Michael Tretter
  2018-11-23 13:55   ` Rouven Czerwinski
                     ` (2 more replies)
  2 siblings, 3 replies; 11+ messages in thread
From: Michael Tretter @ 2018-11-23 13:35 UTC (permalink / raw)
  To: barebox; +Cc: Michael Tretter

Add support for the Xilinx Zynq Ultrascale+ MPSoC architecture (ZynqMP)
and the Xilinx ZCU104 board.

Barebox is booted as BL33 in EL-1 and expects that a BL2 (i.e. the FSBL)
already took care of initializing the RAM. Also for debug_ll, the UART
is expected to be already setup correctly.

Thus, you have to add the Barebox binary to a boot image as described in
"Chapter 11: Boot and Configuration" of "Zynq Ultrascale+ Device
Technical Reference Manual".

The ENTRY_FUNCTION macro cannot be used in aarch64, because aarch64 does
not specify the __naked__ attribute and gcc add a function prologue to
the entry function which writes to the stack, but the stack is not set
up. Thus, the entry has to be implemented in assembly.

Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
---
 arch/arm/Kconfig                              | 14 +++++++
 arch/arm/Makefile                             |  1 +
 arch/arm/boards/Makefile                      |  1 +
 arch/arm/boards/xilinx-zcu104/Makefile        |  2 +
 arch/arm/boards/xilinx-zcu104/board.c         | 25 ++++++++++++
 arch/arm/boards/xilinx-zcu104/lowlevel.c      | 30 +++++++++++++++
 arch/arm/boards/xilinx-zcu104/lowlevel_init.S | 32 ++++++++++++++++
 arch/arm/configs/zynqmp_defconfig             | 38 +++++++++++++++++++
 arch/arm/dts/Makefile                         |  1 +
 arch/arm/mach-zynqmp/Kconfig                  |  9 +++++
 arch/arm/mach-zynqmp/Makefile                 |  1 +
 arch/arm/mach-zynqmp/include/mach/debug_ll.h  | 30 +++++++++++++++
 arch/arm/mach-zynqmp/zynqmp.c                 | 22 +++++++++++
 images/Makefile                               |  1 +
 images/Makefile.zynqmp                        |  7 ++++
 15 files changed, 214 insertions(+)
 create mode 100644 arch/arm/boards/xilinx-zcu104/Makefile
 create mode 100644 arch/arm/boards/xilinx-zcu104/board.c
 create mode 100644 arch/arm/boards/xilinx-zcu104/lowlevel.c
 create mode 100644 arch/arm/boards/xilinx-zcu104/lowlevel_init.S
 create mode 100644 arch/arm/configs/zynqmp_defconfig
 create mode 100644 arch/arm/mach-zynqmp/Kconfig
 create mode 100644 arch/arm/mach-zynqmp/Makefile
 create mode 100644 arch/arm/mach-zynqmp/include/mach/debug_ll.h
 create mode 100644 arch/arm/mach-zynqmp/zynqmp.c
 create mode 100644 images/Makefile.zynqmp

diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 3b486f7b8b..842cbb1485 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -245,6 +245,19 @@ config ARCH_ZYNQ
 	bool "Xilinx Zynq-based boards"
 	select HAS_DEBUG_LL
 
+config ARCH_ZYNQMP
+	bool "Xilinx ZynqMP-based boards"
+	select CPU_V8
+	select HAS_DEBUG_LL
+	select HAVE_PBL_MULTI_IMAGES
+	select COMMON_CLK
+	select COMMON_CLK_OF_PROVIDER
+	select CLKDEV_LOOKUP
+	select OFDEVICE
+	select OFTREE
+	select RELOCATABLE
+	select SYS_SUPPORTS_64BIT_KERNEL
+
 config ARCH_QEMU
 	bool "ARM QEMU boards"
 	select HAS_DEBUG_LL
@@ -275,6 +288,7 @@ source arch/arm/mach-tegra/Kconfig
 source arch/arm/mach-uemd/Kconfig
 source arch/arm/mach-zynq/Kconfig
 source arch/arm/mach-qemu/Kconfig
+source arch/arm/mach-zynqmp/Kconfig
 
 config ARM_ASM_UNIFIED
 	bool
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 50958b787f..675d3433cc 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -101,6 +101,7 @@ machine-$(CONFIG_ARCH_VEXPRESS)		:= vexpress
 machine-$(CONFIG_ARCH_TEGRA)		:= tegra
 machine-$(CONFIG_ARCH_UEMD)		:= uemd
 machine-$(CONFIG_ARCH_ZYNQ)		:= zynq
+machine-$(CONFIG_ARCH_ZYNQMP)		:= zynqmp
 machine-$(CONFIG_ARCH_QEMU)		:= qemu
 
 
diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
index 3bf176b14d..a15a24c02e 100644
--- a/arch/arm/boards/Makefile
+++ b/arch/arm/boards/Makefile
@@ -153,6 +153,7 @@ obj-$(CONFIG_MACH_VSCOM_BALTOS)			+= vscom-baltos/
 obj-$(CONFIG_MACH_QEMU_VIRT64)			+= qemu-virt64/
 obj-$(CONFIG_MACH_WARP7)			+= element14-warp7/
 obj-$(CONFIG_MACH_VF610_TWR)			+= freescale-vf610-twr/
+obj-$(CONFIG_MACH_XILINX_ZCU104)		+= xilinx-zcu104/
 obj-$(CONFIG_MACH_ZII_RDU1)			+= zii-imx51-rdu1/
 obj-$(CONFIG_MACH_ZII_RDU2)			+= zii-imx6q-rdu2/
 obj-$(CONFIG_MACH_ZII_VF610_DEV)		+= zii-vf610-dev/
diff --git a/arch/arm/boards/xilinx-zcu104/Makefile b/arch/arm/boards/xilinx-zcu104/Makefile
new file mode 100644
index 0000000000..918615bb76
--- /dev/null
+++ b/arch/arm/boards/xilinx-zcu104/Makefile
@@ -0,0 +1,2 @@
+obj-y += board.o
+lwl-y += lowlevel.o lowlevel_init.o
diff --git a/arch/arm/boards/xilinx-zcu104/board.c b/arch/arm/boards/xilinx-zcu104/board.c
new file mode 100644
index 0000000000..090c366e99
--- /dev/null
+++ b/arch/arm/boards/xilinx-zcu104/board.c
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2018 Michael Tretter <m.tretter@pengutronix.de>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ */
+
+#include <common.h>
+#include <init.h>
+
+static int zcu104_console_init(void)
+{
+	barebox_set_model("Xilinx Zynq UltraScale+ MPSoC ZCU104");
+	barebox_set_hostname("zcu104");
+
+	return 0;
+}
+console_initcall(zcu104_console_init);
diff --git a/arch/arm/boards/xilinx-zcu104/lowlevel.c b/arch/arm/boards/xilinx-zcu104/lowlevel.c
new file mode 100644
index 0000000000..94ce8b1af9
--- /dev/null
+++ b/arch/arm/boards/xilinx-zcu104/lowlevel.c
@@ -0,0 +1,30 @@
+/*
+ * (c) 2018 Michael Tretter <m.tretter@pengutronix.de>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ */
+
+#include <common.h>
+#include <debug_ll.h>
+#include <asm/barebox-arm.h>
+
+extern char __dtb_zynqmp_zcu104_revA_start[];
+
+void zynqmp_zcu104_start(uint32_t, uint32_t, uint32_t);
+
+void noinline zynqmp_zcu104_start(uint32_t r0, uint32_t r1, uint32_t r2)
+{
+	/* Assume that the first stage boot loader configured the UART */
+	putc_ll('>');
+
+	barebox_arm_entry(0, SZ_2G,
+			  __dtb_zynqmp_zcu104_revA_start + global_variable_offset());
+}
diff --git a/arch/arm/boards/xilinx-zcu104/lowlevel_init.S b/arch/arm/boards/xilinx-zcu104/lowlevel_init.S
new file mode 100644
index 0000000000..23f0ee99dd
--- /dev/null
+++ b/arch/arm/boards/xilinx-zcu104/lowlevel_init.S
@@ -0,0 +1,32 @@
+#include <linux/linkage.h>
+#include <init.h>
+#include <asm/barebox-arm-head.h>
+#include <asm/system.h>
+
+#define ENTRY_PROC(name) \
+	.section .text_head_entry_##name; \
+	ENTRY(##name); \
+		b 2f; \
+		nop; \
+		nop; \
+		nop; \
+		nop; \
+		nop; \
+		nop; \
+		nop; \
+		.asciz "barebox"; \
+		.word 0xffffffff; \
+		.word _barebox_image_size; \
+		.rept 8; \
+		.word 0x55555555; \
+		.endr; \
+		2:
+
+#define ENTRY_PROC_END(name) \
+	END(##name)
+
+ENTRY_PROC(start_zynqmp_zcu104)
+	mov x0, #0x7ffffff0
+	mov sp, x0
+	b zynqmp_zcu104_start
+ENTRY_PROC_END(start_zynqmp_zcu104)
diff --git a/arch/arm/configs/zynqmp_defconfig b/arch/arm/configs/zynqmp_defconfig
new file mode 100644
index 0000000000..4dea9647fe
--- /dev/null
+++ b/arch/arm/configs/zynqmp_defconfig
@@ -0,0 +1,38 @@
+CONFIG_ARCH_ZYNQMP=y
+CONFIG_MACH_XILINX_ZCU104=y
+CONFIG_MMU=y
+CONFIG_MALLOC_SIZE=0x0
+CONFIG_MALLOC_TLSF=y
+CONFIG_KALLSYMS=y
+CONFIG_HUSH_FANCY_PROMPT=y
+CONFIG_CMDLINE_EDITING=y
+CONFIG_AUTO_COMPLETE=y
+CONFIG_MENU=y
+CONFIG_BOOTM_SHOW_TYPE=y
+CONFIG_BOOTM_VERBOSE=y
+CONFIG_BOOTM_INITRD=y
+CONFIG_BOOTM_OFTREE=y
+CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
+CONFIG_LONGHELP=y
+CONFIG_CMD_MEMINFO=y
+CONFIG_CMD_GO=y
+CONFIG_CMD_RESET=y
+CONFIG_CMD_PARTITION=y
+CONFIG_CMD_EXPORT=y
+CONFIG_CMD_PRINTENV=y
+CONFIG_CMD_MAGICVAR=y
+CONFIG_CMD_MAGICVAR_HELP=y
+CONFIG_CMD_SAVEENV=y
+CONFIG_CMD_LN=y
+CONFIG_CMD_SLEEP=y
+CONFIG_CMD_EDIT=y
+CONFIG_CMD_MENU=y
+CONFIG_CMD_MENU_MANAGEMENT=y
+CONFIG_CMD_READLINE=y
+CONFIG_CMD_TIMEOUT=y
+CONFIG_CMD_CLK=y
+CONFIG_CMD_OFTREE=y
+CONFIG_CMD_TIME=y
+CONFIG_DRIVER_SERIAL_CADENCE=y
+# CONFIG_SPI is not set
+CONFIG_DIGEST=y
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
index 503d9b18f9..0ac3124c8c 100644
--- a/arch/arm/dts/Makefile
+++ b/arch/arm/dts/Makefile
@@ -119,6 +119,7 @@ pbl-dtb-$(CONFIG_MACH_ZII_VF610_DEV) += \
 pbl-dtb-$(CONFIG_MACH_AT91SAM9263EK_DT) += at91sam9263ek.dtb.o
 pbl-dtb-$(CONFIG_MACH_MICROCHIP_KSZ9477_EVB) += at91-microchip-ksz9477-evb.dtb.o
 pbl-dtb-$(CONFIG_MACH_AT91SAM9X5EK) += at91sam9x5ek.dtb.o
+pbl-dtb-$(CONFIG_MACH_XILINX_ZCU104) += zynqmp-zcu104-revA.dtb.o
 
 pbl-dtb-$(CONFIG_MACH_ZII_IMX7D_RPU2) += imx7d-zii-rpu2.dtb.o
 
diff --git a/arch/arm/mach-zynqmp/Kconfig b/arch/arm/mach-zynqmp/Kconfig
new file mode 100644
index 0000000000..1c7727d66c
--- /dev/null
+++ b/arch/arm/mach-zynqmp/Kconfig
@@ -0,0 +1,9 @@
+if ARCH_ZYNQMP
+
+config MACH_XILINX_ZCU104
+	bool "Xilinx Zynq UltraScale+ MPSoC ZCU104"
+	help
+	  Say Y here if you are using the Xilinx Zynq UltraScale+ MPSoC ZCU104
+	  evaluation board.
+
+endif
diff --git a/arch/arm/mach-zynqmp/Makefile b/arch/arm/mach-zynqmp/Makefile
new file mode 100644
index 0000000000..1f4e72abc1
--- /dev/null
+++ b/arch/arm/mach-zynqmp/Makefile
@@ -0,0 +1 @@
+obj-y += zynqmp.o
diff --git a/arch/arm/mach-zynqmp/include/mach/debug_ll.h b/arch/arm/mach-zynqmp/include/mach/debug_ll.h
new file mode 100644
index 0000000000..cd2583a35b
--- /dev/null
+++ b/arch/arm/mach-zynqmp/include/mach/debug_ll.h
@@ -0,0 +1,30 @@
+#ifndef __MACH_DEBUG_LL_H__
+#define __MACH_DEBUG_LL_H__
+
+#include <io.h>
+
+#define ZYNQMP_UART0_BASE		0xFF000000
+#define ZYNQMP_UART1_BASE		0xFF010000
+#define ZYNQMP_UART_BASE		ZYNQMP_UART0_BASE
+#define ZYNQMP_DEBUG_LL_UART_BASE 	ZYNQMP_UART_BASE
+
+#define ZYNQMP_UART_RXTXFIFO	0x30
+#define ZYNQMP_UART_CHANNEL_STS	0x2C
+
+#define ZYNQMP_UART_STS_TFUL	(1 << 4)
+#define ZYNQMP_UART_TXDIS		(1 << 5)
+
+static inline void PUTC_LL(int c)
+{
+	void __iomem *base = (void __iomem *)ZYNQMP_DEBUG_LL_UART_BASE;
+
+	if (readl(base) & ZYNQMP_UART_TXDIS)
+		return;
+
+	while ((readl(base + ZYNQMP_UART_CHANNEL_STS) & ZYNQMP_UART_STS_TFUL) != 0)
+		;
+
+	writel(c, base + 0x30);
+}
+
+#endif
diff --git a/arch/arm/mach-zynqmp/zynqmp.c b/arch/arm/mach-zynqmp/zynqmp.c
new file mode 100644
index 0000000000..04aedb59e0
--- /dev/null
+++ b/arch/arm/mach-zynqmp/zynqmp.c
@@ -0,0 +1,22 @@
+/*
+ * (c) 2018 Michael Tretter <m.tretter@pengutronix.de>
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the Free
+ * Software Foundation; either version 2 of the License, or (at your option)
+ * any later version.
+ *
+ * This program is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
+ * more details.
+ */
+
+#include <common.h>
+#include <init.h>
+
+static int zynqmp_init(void)
+{
+	return 0;
+}
+postcore_initcall(zynqmp_init);
diff --git a/images/Makefile b/images/Makefile
index 5c4d99ac5a..4d28f73a57 100644
--- a/images/Makefile
+++ b/images/Makefile
@@ -113,6 +113,7 @@ include $(srctree)/images/Makefile.socfpga
 include $(srctree)/images/Makefile.tegra
 include $(srctree)/images/Makefile.vexpress
 include $(srctree)/images/Makefile.at91
+include $(srctree)/images/Makefile.zynqmp
 
 targets += $(image-y) pbl.lds barebox.x barebox.z
 targets += $(patsubst %,%.pblx,$(pblx-y))
diff --git a/images/Makefile.zynqmp b/images/Makefile.zynqmp
new file mode 100644
index 0000000000..f977a6baff
--- /dev/null
+++ b/images/Makefile.zynqmp
@@ -0,0 +1,7 @@
+#
+# barebox image generation Makefile for Xilinx Zynq UltraScale+
+#
+
+pblx-$(CONFIG_MACH_XILINX_ZCU104) += start_zynqmp_zcu104
+FILE_barebox-zynqmp-zcu104.img = start_zynqmp_zcu104.pblx
+image-$(CONFIG_MACH_XILINX_ZCU104) += barebox-zynqmp-zcu104.img
-- 
2.19.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 2/3] ARM: aarch64: compile with general-regs-only
  2018-11-23 13:35 ` [PATCH 2/3] ARM: aarch64: compile with general-regs-only Michael Tretter
@ 2018-11-23 13:48   ` Rouven Czerwinski
  0 siblings, 0 replies; 11+ messages in thread
From: Rouven Czerwinski @ 2018-11-23 13:48 UTC (permalink / raw)
  To: Michael Tretter; +Cc: barebox


Michael Tretter <m.tretter@pengutronix.de> writes:

> Without this flag, gcc generates code to save the Q/V registers to the
> stack for handling the va_list in pr_print(). Saving the registers is
> use useless, as the registers are never restored, but this hangs the
  ^ nit: this use looks lost.
> CPU.
>
> Follow the Linux arch/arm64/Makefile and the general-regs-only flag, to
> prevent usage of floating point and Advanced SIMD register.
>
> Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
> ---
>  arch/arm/Makefile | 4 ++++
>  1 file changed, 4 insertions(+)
>
> diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> index 5db67b9db8..50958b787f 100644
> --- a/arch/arm/Makefile
> +++ b/arch/arm/Makefile
> @@ -27,6 +27,10 @@ else
>  CFLAGS += -mstrict-align
>  endif
>  
> +# Prevent use of floating point and Advanced SIMD registers.
> +ifeq ($(CONFIG_CPU_V8),y)
> +CFLAGS += -mgeneral-regs-only
> +endif
>  
>  # This selects which instruction set is used.
>  # Note that GCC does not numerically define an architecture version

- Rouven

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] ARM: zynqmp: add support for Xilinx ZCU104 board
  2018-11-23 13:35 ` [PATCH 3/3] ARM: zynqmp: add support for Xilinx ZCU104 board Michael Tretter
@ 2018-11-23 13:55   ` Rouven Czerwinski
  2018-11-26 10:37     ` Roland Hieber
  2018-11-23 14:38   ` Michael Tretter
  2018-11-23 15:08   ` Oleksij Rempel
  2 siblings, 1 reply; 11+ messages in thread
From: Rouven Czerwinski @ 2018-11-23 13:55 UTC (permalink / raw)
  To: Michael Tretter; +Cc: barebox


Michael Tretter <m.tretter@pengutronix.de> writes:

> Add support for the Xilinx Zynq Ultrascale+ MPSoC architecture (ZynqMP)
> and the Xilinx ZCU104 board.
>
> Barebox is booted as BL33 in EL-1 and expects that a BL2 (i.e. the FSBL)
> already took care of initializing the RAM. Also for debug_ll, the UART
> is expected to be already setup correctly.
>
> Thus, you have to add the Barebox binary to a boot image as described in
> "Chapter 11: Boot and Configuration" of "Zynq Ultrascale+ Device
> Technical Reference Manual".
>
> The ENTRY_FUNCTION macro cannot be used in aarch64, because aarch64 does
> not specify the __naked__ attribute and gcc add a function prologue to
> the entry function which writes to the stack, but the stack is not set
> up. Thus, the entry has to be implemented in assembly.
>
> Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
> ---
>  arch/arm/Kconfig                              | 14 +++++++
>  arch/arm/Makefile                             |  1 +
>  arch/arm/boards/Makefile                      |  1 +
>  arch/arm/boards/xilinx-zcu104/Makefile        |  2 +
>  arch/arm/boards/xilinx-zcu104/board.c         | 25 ++++++++++++
>  arch/arm/boards/xilinx-zcu104/lowlevel.c      | 30 +++++++++++++++
>  arch/arm/boards/xilinx-zcu104/lowlevel_init.S | 32 ++++++++++++++++
>  arch/arm/configs/zynqmp_defconfig             | 38 +++++++++++++++++++
>  arch/arm/dts/Makefile                         |  1 +
>  arch/arm/mach-zynqmp/Kconfig                  |  9 +++++
>  arch/arm/mach-zynqmp/Makefile                 |  1 +
>  arch/arm/mach-zynqmp/include/mach/debug_ll.h  | 30 +++++++++++++++
>  arch/arm/mach-zynqmp/zynqmp.c                 | 22 +++++++++++
>  images/Makefile                               |  1 +
>  images/Makefile.zynqmp                        |  7 ++++
>  15 files changed, 214 insertions(+)
>  create mode 100644 arch/arm/boards/xilinx-zcu104/Makefile
>  create mode 100644 arch/arm/boards/xilinx-zcu104/board.c
>  create mode 100644 arch/arm/boards/xilinx-zcu104/lowlevel.c
>  create mode 100644 arch/arm/boards/xilinx-zcu104/lowlevel_init.S
>  create mode 100644 arch/arm/configs/zynqmp_defconfig
>  create mode 100644 arch/arm/mach-zynqmp/Kconfig
>  create mode 100644 arch/arm/mach-zynqmp/Makefile
>  create mode 100644 arch/arm/mach-zynqmp/include/mach/debug_ll.h
>  create mode 100644 arch/arm/mach-zynqmp/zynqmp.c
>  create mode 100644 images/Makefile.zynqmp
>
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 3b486f7b8b..842cbb1485 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -245,6 +245,19 @@ config ARCH_ZYNQ
>  	bool "Xilinx Zynq-based boards"
>  	select HAS_DEBUG_LL
>  
> +config ARCH_ZYNQMP
> +	bool "Xilinx ZynqMP-based boards"
> +	select CPU_V8
> +	select HAS_DEBUG_LL
> +	select HAVE_PBL_MULTI_IMAGES
> +	select COMMON_CLK
> +	select COMMON_CLK_OF_PROVIDER
> +	select CLKDEV_LOOKUP
> +	select OFDEVICE
> +	select OFTREE
> +	select RELOCATABLE
> +	select SYS_SUPPORTS_64BIT_KERNEL
> +
>  config ARCH_QEMU
>  	bool "ARM QEMU boards"
>  	select HAS_DEBUG_LL
> @@ -275,6 +288,7 @@ source arch/arm/mach-tegra/Kconfig
>  source arch/arm/mach-uemd/Kconfig
>  source arch/arm/mach-zynq/Kconfig
>  source arch/arm/mach-qemu/Kconfig
> +source arch/arm/mach-zynqmp/Kconfig
>  
>  config ARM_ASM_UNIFIED
>  	bool
> diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> index 50958b787f..675d3433cc 100644
> --- a/arch/arm/Makefile
> +++ b/arch/arm/Makefile
> @@ -101,6 +101,7 @@ machine-$(CONFIG_ARCH_VEXPRESS)		:= vexpress
>  machine-$(CONFIG_ARCH_TEGRA)		:= tegra
>  machine-$(CONFIG_ARCH_UEMD)		:= uemd
>  machine-$(CONFIG_ARCH_ZYNQ)		:= zynq
> +machine-$(CONFIG_ARCH_ZYNQMP)		:= zynqmp
>  machine-$(CONFIG_ARCH_QEMU)		:= qemu
>  
>  
> diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
> index 3bf176b14d..a15a24c02e 100644
> --- a/arch/arm/boards/Makefile
> +++ b/arch/arm/boards/Makefile
> @@ -153,6 +153,7 @@ obj-$(CONFIG_MACH_VSCOM_BALTOS)			+= vscom-baltos/
>  obj-$(CONFIG_MACH_QEMU_VIRT64)			+= qemu-virt64/
>  obj-$(CONFIG_MACH_WARP7)			+= element14-warp7/
>  obj-$(CONFIG_MACH_VF610_TWR)			+= freescale-vf610-twr/
> +obj-$(CONFIG_MACH_XILINX_ZCU104)		+= xilinx-zcu104/
>  obj-$(CONFIG_MACH_ZII_RDU1)			+= zii-imx51-rdu1/
>  obj-$(CONFIG_MACH_ZII_RDU2)			+= zii-imx6q-rdu2/
>  obj-$(CONFIG_MACH_ZII_VF610_DEV)		+= zii-vf610-dev/
> diff --git a/arch/arm/boards/xilinx-zcu104/Makefile b/arch/arm/boards/xilinx-zcu104/Makefile
> new file mode 100644
> index 0000000000..918615bb76
> --- /dev/null
> +++ b/arch/arm/boards/xilinx-zcu104/Makefile
> @@ -0,0 +1,2 @@
> +obj-y += board.o
> +lwl-y += lowlevel.o lowlevel_init.o
> diff --git a/arch/arm/boards/xilinx-zcu104/board.c b/arch/arm/boards/xilinx-zcu104/board.c
> new file mode 100644
> index 0000000000..090c366e99
> --- /dev/null
> +++ b/arch/arm/boards/xilinx-zcu104/board.c
> @@ -0,0 +1,25 @@
> +/*
> + * Copyright (C) 2018 Michael Tretter <m.tretter@pengutronix.de>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the Free
> + * Software Foundation; either version 2 of the License, or (at your option)
> + * any later version.
> + *
> + * This program is distributed in the hope that it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
> + * more details.
> + */
> +
> +#include <common.h>
> +#include <init.h>
> +
> +static int zcu104_console_init(void)
> +{
> +	barebox_set_model("Xilinx Zynq UltraScale+ MPSoC ZCU104");
> +	barebox_set_hostname("zcu104");
> +
> +	return 0;
> +}
> +console_initcall(zcu104_console_init);
> diff --git a/arch/arm/boards/xilinx-zcu104/lowlevel.c b/arch/arm/boards/xilinx-zcu104/lowlevel.c
> new file mode 100644
> index 0000000000..94ce8b1af9
> --- /dev/null
> +++ b/arch/arm/boards/xilinx-zcu104/lowlevel.c
> @@ -0,0 +1,30 @@
> +/*
> + * (c) 2018 Michael Tretter <m.tretter@pengutronix.de>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the Free
> + * Software Foundation; either version 2 of the License, or (at your option)
> + * any later version.
> + *
> + * This program is distributed in the hope that it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
> + * more details.
> + */
> +
> +#include <common.h>
> +#include <debug_ll.h>
> +#include <asm/barebox-arm.h>
> +
> +extern char __dtb_zynqmp_zcu104_revA_start[];
> +
> +void zynqmp_zcu104_start(uint32_t, uint32_t, uint32_t);
> +
> +void noinline zynqmp_zcu104_start(uint32_t r0, uint32_t r1, uint32_t r2)
> +{
> +	/* Assume that the first stage boot loader configured the UART */
> +	putc_ll('>');
> +
> +	barebox_arm_entry(0, SZ_2G,
> +			  __dtb_zynqmp_zcu104_revA_start + global_variable_offset());
> +}
> diff --git a/arch/arm/boards/xilinx-zcu104/lowlevel_init.S b/arch/arm/boards/xilinx-zcu104/lowlevel_init.S
> new file mode 100644
> index 0000000000..23f0ee99dd
> --- /dev/null
> +++ b/arch/arm/boards/xilinx-zcu104/lowlevel_init.S
> @@ -0,0 +1,32 @@
> +#include <linux/linkage.h>
> +#include <init.h>
> +#include <asm/barebox-arm-head.h>
> +#include <asm/system.h>
> +
> +#define ENTRY_PROC(name) \
> +	.section .text_head_entry_##name; \
> +	ENTRY(##name); \
> +		b 2f; \
> +		nop; \
> +		nop; \
> +		nop; \
> +		nop; \
> +		nop; \
> +		nop; \
> +		nop; \
> +		.asciz "barebox"; \
> +		.word 0xffffffff; \
> +		.word _barebox_image_size; \
> +		.rept 8; \
> +		.word 0x55555555; \
> +		.endr; \
> +		2:
> +
> +#define ENTRY_PROC_END(name) \
> +	END(##name)
> +
> +ENTRY_PROC(start_zynqmp_zcu104)
> +	mov x0, #0x7ffffff0
> +	mov sp, x0
> +	b zynqmp_zcu104_start
> +ENTRY_PROC_END(start_zynqmp_zcu104)
> diff --git a/arch/arm/configs/zynqmp_defconfig b/arch/arm/configs/zynqmp_defconfig
> new file mode 100644
> index 0000000000..4dea9647fe
> --- /dev/null
> +++ b/arch/arm/configs/zynqmp_defconfig
> @@ -0,0 +1,38 @@
> +CONFIG_ARCH_ZYNQMP=y
> +CONFIG_MACH_XILINX_ZCU104=y
> +CONFIG_MMU=y
> +CONFIG_MALLOC_SIZE=0x0
> +CONFIG_MALLOC_TLSF=y
> +CONFIG_KALLSYMS=y
> +CONFIG_HUSH_FANCY_PROMPT=y
> +CONFIG_CMDLINE_EDITING=y
> +CONFIG_AUTO_COMPLETE=y
> +CONFIG_MENU=y
> +CONFIG_BOOTM_SHOW_TYPE=y
> +CONFIG_BOOTM_VERBOSE=y
> +CONFIG_BOOTM_INITRD=y
> +CONFIG_BOOTM_OFTREE=y
> +CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
> +CONFIG_LONGHELP=y
> +CONFIG_CMD_MEMINFO=y
> +CONFIG_CMD_GO=y
> +CONFIG_CMD_RESET=y
> +CONFIG_CMD_PARTITION=y
> +CONFIG_CMD_EXPORT=y
> +CONFIG_CMD_PRINTENV=y
> +CONFIG_CMD_MAGICVAR=y
> +CONFIG_CMD_MAGICVAR_HELP=y
> +CONFIG_CMD_SAVEENV=y
> +CONFIG_CMD_LN=y
> +CONFIG_CMD_SLEEP=y
> +CONFIG_CMD_EDIT=y
> +CONFIG_CMD_MENU=y
> +CONFIG_CMD_MENU_MANAGEMENT=y
> +CONFIG_CMD_READLINE=y
> +CONFIG_CMD_TIMEOUT=y
> +CONFIG_CMD_CLK=y
> +CONFIG_CMD_OFTREE=y
> +CONFIG_CMD_TIME=y
> +CONFIG_DRIVER_SERIAL_CADENCE=y
> +# CONFIG_SPI is not set
> +CONFIG_DIGEST=y
> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> index 503d9b18f9..0ac3124c8c 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -119,6 +119,7 @@ pbl-dtb-$(CONFIG_MACH_ZII_VF610_DEV) += \
>  pbl-dtb-$(CONFIG_MACH_AT91SAM9263EK_DT) += at91sam9263ek.dtb.o
>  pbl-dtb-$(CONFIG_MACH_MICROCHIP_KSZ9477_EVB) += at91-microchip-ksz9477-evb.dtb.o
>  pbl-dtb-$(CONFIG_MACH_AT91SAM9X5EK) += at91sam9x5ek.dtb.o
> +pbl-dtb-$(CONFIG_MACH_XILINX_ZCU104) += zynqmp-zcu104-revA.dtb.o
>  
>  pbl-dtb-$(CONFIG_MACH_ZII_IMX7D_RPU2) += imx7d-zii-rpu2.dtb.o
>  
> diff --git a/arch/arm/mach-zynqmp/Kconfig b/arch/arm/mach-zynqmp/Kconfig
> new file mode 100644
> index 0000000000..1c7727d66c
> --- /dev/null
> +++ b/arch/arm/mach-zynqmp/Kconfig
> @@ -0,0 +1,9 @@
> +if ARCH_ZYNQMP
> +
> +config MACH_XILINX_ZCU104
> +	bool "Xilinx Zynq UltraScale+ MPSoC ZCU104"
> +	help
> +	  Say Y here if you are using the Xilinx Zynq UltraScale+ MPSoC ZCU104
> +	  evaluation board.
> +
> +endif
> diff --git a/arch/arm/mach-zynqmp/Makefile b/arch/arm/mach-zynqmp/Makefile
> new file mode 100644
> index 0000000000..1f4e72abc1
> --- /dev/null
> +++ b/arch/arm/mach-zynqmp/Makefile
> @@ -0,0 +1 @@
> +obj-y += zynqmp.o
> diff --git a/arch/arm/mach-zynqmp/include/mach/debug_ll.h b/arch/arm/mach-zynqmp/include/mach/debug_ll.h
> new file mode 100644
> index 0000000000..cd2583a35b
> --- /dev/null
> +++ b/arch/arm/mach-zynqmp/include/mach/debug_ll.h
> @@ -0,0 +1,30 @@
> +#ifndef __MACH_DEBUG_LL_H__
> +#define __MACH_DEBUG_LL_H__
> +
> +#include <io.h>
> +
> +#define ZYNQMP_UART0_BASE		0xFF000000
> +#define ZYNQMP_UART1_BASE		0xFF010000
> +#define ZYNQMP_UART_BASE		ZYNQMP_UART0_BASE
> +#define ZYNQMP_DEBUG_LL_UART_BASE 	ZYNQMP_UART_BASE
> +
> +#define ZYNQMP_UART_RXTXFIFO	0x30
> +#define ZYNQMP_UART_CHANNEL_STS	0x2C
> +
> +#define ZYNQMP_UART_STS_TFUL	(1 << 4)
> +#define ZYNQMP_UART_TXDIS		(1 << 5)
> +
> +static inline void PUTC_LL(int c)
> +{
> +	void __iomem *base = (void __iomem *)ZYNQMP_DEBUG_LL_UART_BASE;
> +
> +	if (readl(base) & ZYNQMP_UART_TXDIS)
> +		return;
> +
> +	while ((readl(base + ZYNQMP_UART_CHANNEL_STS) & ZYNQMP_UART_STS_TFUL) != 0)
> +		;
                ^ this should be in the previous line
> +
> +	writel(c, base + 0x30);
> +}
> +
> +#endif
> diff --git a/arch/arm/mach-zynqmp/zynqmp.c b/arch/arm/mach-zynqmp/zynqmp.c
> new file mode 100644
> index 0000000000..04aedb59e0
> --- /dev/null
> +++ b/arch/arm/mach-zynqmp/zynqmp.c
> @@ -0,0 +1,22 @@
> +/*
> + * (c) 2018 Michael Tretter <m.tretter@pengutronix.de>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the Free
> + * Software Foundation; either version 2 of the License, or (at your option)
> + * any later version.
> + *
> + * This program is distributed in the hope that it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
> + * more details.
> + */
> +
> +#include <common.h>
> +#include <init.h>
> +
> +static int zynqmp_init(void)
> +{
> +	return 0;
> +}
> +postcore_initcall(zynqmp_init);
> diff --git a/images/Makefile b/images/Makefile
> index 5c4d99ac5a..4d28f73a57 100644
> --- a/images/Makefile
> +++ b/images/Makefile
> @@ -113,6 +113,7 @@ include $(srctree)/images/Makefile.socfpga
>  include $(srctree)/images/Makefile.tegra
>  include $(srctree)/images/Makefile.vexpress
>  include $(srctree)/images/Makefile.at91
> +include $(srctree)/images/Makefile.zynqmp
>  
>  targets += $(image-y) pbl.lds barebox.x barebox.z
>  targets += $(patsubst %,%.pblx,$(pblx-y))
> diff --git a/images/Makefile.zynqmp b/images/Makefile.zynqmp
> new file mode 100644
> index 0000000000..f977a6baff
> --- /dev/null
> +++ b/images/Makefile.zynqmp
> @@ -0,0 +1,7 @@
> +#
> +# barebox image generation Makefile for Xilinx Zynq UltraScale+
> +#
> +
> +pblx-$(CONFIG_MACH_XILINX_ZCU104) += start_zynqmp_zcu104
> +FILE_barebox-zynqmp-zcu104.img = start_zynqmp_zcu104.pblx
> +image-$(CONFIG_MACH_XILINX_ZCU104) += barebox-zynqmp-zcu104.img

- Rouven

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] ARM: zynqmp: add support for Xilinx ZCU104 board
  2018-11-23 13:35 ` [PATCH 3/3] ARM: zynqmp: add support for Xilinx ZCU104 board Michael Tretter
  2018-11-23 13:55   ` Rouven Czerwinski
@ 2018-11-23 14:38   ` Michael Tretter
  2018-11-23 15:08   ` Oleksij Rempel
  2 siblings, 0 replies; 11+ messages in thread
From: Michael Tretter @ 2018-11-23 14:38 UTC (permalink / raw)
  To: barebox



On Fri, 23 Nov 2018 14:35:53 +0100, Michael Tretter wrote:
> Add support for the Xilinx Zynq Ultrascale+ MPSoC architecture (ZynqMP)
> and the Xilinx ZCU104 board.
> 
> Barebox is booted as BL33 in EL-1 and expects that a BL2 (i.e. the FSBL)
> already took care of initializing the RAM. Also for debug_ll, the UART
> is expected to be already setup correctly.
> 
> Thus, you have to add the Barebox binary to a boot image as described in
> "Chapter 11: Boot and Configuration" of "Zynq Ultrascale+ Device
> Technical Reference Manual".
> 
> The ENTRY_FUNCTION macro cannot be used in aarch64, because aarch64 does
> not specify the __naked__ attribute and gcc add a function prologue to
> the entry function which writes to the stack, but the stack is not set
> up. Thus, the entry has to be implemented in assembly.
> 
> Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
> ---
>  arch/arm/Kconfig                              | 14 +++++++
>  arch/arm/Makefile                             |  1 +
>  arch/arm/boards/Makefile                      |  1 +
>  arch/arm/boards/xilinx-zcu104/Makefile        |  2 +
>  arch/arm/boards/xilinx-zcu104/board.c         | 25 ++++++++++++
>  arch/arm/boards/xilinx-zcu104/lowlevel.c      | 30 +++++++++++++++
>  arch/arm/boards/xilinx-zcu104/lowlevel_init.S | 32 ++++++++++++++++
>  arch/arm/configs/zynqmp_defconfig             | 38 +++++++++++++++++++
>  arch/arm/dts/Makefile                         |  1 +
>  arch/arm/mach-zynqmp/Kconfig                  |  9 +++++
>  arch/arm/mach-zynqmp/Makefile                 |  1 +
>  arch/arm/mach-zynqmp/include/mach/debug_ll.h  | 30 +++++++++++++++
>  arch/arm/mach-zynqmp/zynqmp.c                 | 22 +++++++++++
>  images/Makefile                               |  1 +
>  images/Makefile.zynqmp                        |  7 ++++
>  15 files changed, 214 insertions(+)
>  create mode 100644 arch/arm/boards/xilinx-zcu104/Makefile
>  create mode 100644 arch/arm/boards/xilinx-zcu104/board.c
>  create mode 100644 arch/arm/boards/xilinx-zcu104/lowlevel.c
>  create mode 100644 arch/arm/boards/xilinx-zcu104/lowlevel_init.S
>  create mode 100644 arch/arm/configs/zynqmp_defconfig
>  create mode 100644 arch/arm/mach-zynqmp/Kconfig
>  create mode 100644 arch/arm/mach-zynqmp/Makefile
>  create mode 100644 arch/arm/mach-zynqmp/include/mach/debug_ll.h
>  create mode 100644 arch/arm/mach-zynqmp/zynqmp.c
>  create mode 100644 images/Makefile.zynqmp
> 
[...]
> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> index 503d9b18f9..0ac3124c8c 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -119,6 +119,7 @@ pbl-dtb-$(CONFIG_MACH_ZII_VF610_DEV) += \
>  pbl-dtb-$(CONFIG_MACH_AT91SAM9263EK_DT) += at91sam9263ek.dtb.o
>  pbl-dtb-$(CONFIG_MACH_MICROCHIP_KSZ9477_EVB) += at91-microchip-ksz9477-evb.dtb.o
>  pbl-dtb-$(CONFIG_MACH_AT91SAM9X5EK) += at91sam9x5ek.dtb.o
> +pbl-dtb-$(CONFIG_MACH_XILINX_ZCU104) += zynqmp-zcu104-revA.dtb.o

I forgot to add the dts file for barebox to the patch. Will do in v2.

Michael

>  
>  pbl-dtb-$(CONFIG_MACH_ZII_IMX7D_RPU2) += imx7d-zii-rpu2.dtb.o
>  

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] ARM: zynqmp: add support for Xilinx ZCU104 board
  2018-11-23 13:35 ` [PATCH 3/3] ARM: zynqmp: add support for Xilinx ZCU104 board Michael Tretter
  2018-11-23 13:55   ` Rouven Czerwinski
  2018-11-23 14:38   ` Michael Tretter
@ 2018-11-23 15:08   ` Oleksij Rempel
  2018-11-23 18:27     ` Michael Tretter
  2 siblings, 1 reply; 11+ messages in thread
From: Oleksij Rempel @ 2018-11-23 15:08 UTC (permalink / raw)
  To: Michael Tretter, barebox

Hi Michael,

Am 23.11.18 um 14:35 schrieb Michael Tretter:
> Add support for the Xilinx Zynq Ultrascale+ MPSoC architecture (ZynqMP)
> and the Xilinx ZCU104 board.
> 
> Barebox is booted as BL33 in EL-1 and expects that a BL2 (i.e. the FSBL)
> already took care of initializing the RAM. Also for debug_ll, the UART
> is expected to be already setup correctly.
> 
> Thus, you have to add the Barebox binary to a boot image as described in
> "Chapter 11: Boot and Configuration" of "Zynq Ultrascale+ Device
> Technical Reference Manual".
> 
> The ENTRY_FUNCTION macro cannot be used in aarch64, because aarch64 does
> not specify the __naked__ attribute and gcc add a function prologue to
> the entry function which writes to the stack, but the stack is not set
> up. Thus, the entry has to be implemented in assembly.
> 
> Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
> ---
>  arch/arm/Kconfig                              | 14 +++++++
>  arch/arm/Makefile                             |  1 +
>  arch/arm/boards/Makefile                      |  1 +
>  arch/arm/boards/xilinx-zcu104/Makefile        |  2 +
>  arch/arm/boards/xilinx-zcu104/board.c         | 25 ++++++++++++
>  arch/arm/boards/xilinx-zcu104/lowlevel.c      | 30 +++++++++++++++
>  arch/arm/boards/xilinx-zcu104/lowlevel_init.S | 32 ++++++++++++++++
>  arch/arm/configs/zynqmp_defconfig             | 38 +++++++++++++++++++
>  arch/arm/dts/Makefile                         |  1 +
>  arch/arm/mach-zynqmp/Kconfig                  |  9 +++++
>  arch/arm/mach-zynqmp/Makefile                 |  1 +
>  arch/arm/mach-zynqmp/include/mach/debug_ll.h  | 30 +++++++++++++++
>  arch/arm/mach-zynqmp/zynqmp.c                 | 22 +++++++++++
>  images/Makefile                               |  1 +
>  images/Makefile.zynqmp                        |  7 ++++
>  15 files changed, 214 insertions(+)
>  create mode 100644 arch/arm/boards/xilinx-zcu104/Makefile
>  create mode 100644 arch/arm/boards/xilinx-zcu104/board.c
>  create mode 100644 arch/arm/boards/xilinx-zcu104/lowlevel.c
>  create mode 100644 arch/arm/boards/xilinx-zcu104/lowlevel_init.S
>  create mode 100644 arch/arm/configs/zynqmp_defconfig
>  create mode 100644 arch/arm/mach-zynqmp/Kconfig
>  create mode 100644 arch/arm/mach-zynqmp/Makefile
>  create mode 100644 arch/arm/mach-zynqmp/include/mach/debug_ll.h
>  create mode 100644 arch/arm/mach-zynqmp/zynqmp.c
>  create mode 100644 images/Makefile.zynqmp
> 
> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> index 3b486f7b8b..842cbb1485 100644
> --- a/arch/arm/Kconfig
> +++ b/arch/arm/Kconfig
> @@ -245,6 +245,19 @@ config ARCH_ZYNQ
>  	bool "Xilinx Zynq-based boards"
>  	select HAS_DEBUG_LL
>  
> +config ARCH_ZYNQMP
> +	bool "Xilinx ZynqMP-based boards"
> +	select CPU_V8
> +	select HAS_DEBUG_LL
> +	select HAVE_PBL_MULTI_IMAGES
> +	select COMMON_CLK
> +	select COMMON_CLK_OF_PROVIDER
> +	select CLKDEV_LOOKUP
> +	select OFDEVICE
> +	select OFTREE
> +	select RELOCATABLE
> +	select SYS_SUPPORTS_64BIT_KERNEL
> +
>  config ARCH_QEMU
>  	bool "ARM QEMU boards"
>  	select HAS_DEBUG_LL
> @@ -275,6 +288,7 @@ source arch/arm/mach-tegra/Kconfig
>  source arch/arm/mach-uemd/Kconfig
>  source arch/arm/mach-zynq/Kconfig
>  source arch/arm/mach-qemu/Kconfig
> +source arch/arm/mach-zynqmp/Kconfig
>  
>  config ARM_ASM_UNIFIED
>  	bool
> diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> index 50958b787f..675d3433cc 100644
> --- a/arch/arm/Makefile
> +++ b/arch/arm/Makefile
> @@ -101,6 +101,7 @@ machine-$(CONFIG_ARCH_VEXPRESS)		:= vexpress
>  machine-$(CONFIG_ARCH_TEGRA)		:= tegra
>  machine-$(CONFIG_ARCH_UEMD)		:= uemd
>  machine-$(CONFIG_ARCH_ZYNQ)		:= zynq
> +machine-$(CONFIG_ARCH_ZYNQMP)		:= zynqmp
>  machine-$(CONFIG_ARCH_QEMU)		:= qemu
>  
>  
> diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
> index 3bf176b14d..a15a24c02e 100644
> --- a/arch/arm/boards/Makefile
> +++ b/arch/arm/boards/Makefile
> @@ -153,6 +153,7 @@ obj-$(CONFIG_MACH_VSCOM_BALTOS)			+= vscom-baltos/
>  obj-$(CONFIG_MACH_QEMU_VIRT64)			+= qemu-virt64/
>  obj-$(CONFIG_MACH_WARP7)			+= element14-warp7/
>  obj-$(CONFIG_MACH_VF610_TWR)			+= freescale-vf610-twr/
> +obj-$(CONFIG_MACH_XILINX_ZCU104)		+= xilinx-zcu104/
>  obj-$(CONFIG_MACH_ZII_RDU1)			+= zii-imx51-rdu1/
>  obj-$(CONFIG_MACH_ZII_RDU2)			+= zii-imx6q-rdu2/
>  obj-$(CONFIG_MACH_ZII_VF610_DEV)		+= zii-vf610-dev/
> diff --git a/arch/arm/boards/xilinx-zcu104/Makefile b/arch/arm/boards/xilinx-zcu104/Makefile
> new file mode 100644
> index 0000000000..918615bb76
> --- /dev/null
> +++ b/arch/arm/boards/xilinx-zcu104/Makefile
> @@ -0,0 +1,2 @@
> +obj-y += board.o
> +lwl-y += lowlevel.o lowlevel_init.o
> diff --git a/arch/arm/boards/xilinx-zcu104/board.c b/arch/arm/boards/xilinx-zcu104/board.c
> new file mode 100644
> index 0000000000..090c366e99
> --- /dev/null
> +++ b/arch/arm/boards/xilinx-zcu104/board.c
> @@ -0,0 +1,25 @@
> +/*
> + * Copyright (C) 2018 Michael Tretter <m.tretter@pengutronix.de>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the Free
> + * Software Foundation; either version 2 of the License, or (at your option)
> + * any later version.
> + *
> + * This program is distributed in the hope that it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
> + * more details.
> + */

It will be better to start use SPDX-License-Identifier for new files.

> +#include <common.h>
> +#include <init.h>
> +
> +static int zcu104_console_init(void)
> +{> +	barebox_set_model("Xilinx Zynq UltraScale+ MPSoC ZCU104");
> +	barebox_set_hostname("zcu104");

Latest barebox version can extract model and hostname from devicetree.
So, probably we do not need complete board.c file.

> +	return 0;
> +}
> +console_initcall(zcu104_console_init);
> diff --git a/arch/arm/boards/xilinx-zcu104/lowlevel.c b/arch/arm/boards/xilinx-zcu104/lowlevel.c
> new file mode 100644
> index 0000000000..94ce8b1af9
> --- /dev/null
> +++ b/arch/arm/boards/xilinx-zcu104/lowlevel.c
> @@ -0,0 +1,30 @@
> +/*
> + * (c) 2018 Michael Tretter <m.tretter@pengutronix.de>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the Free
> + * Software Foundation; either version 2 of the License, or (at your option)
> + * any later version.
> + *
> + * This program is distributed in the hope that it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
> + * more details.
> + */
> +
> +#include <common.h>
> +#include <debug_ll.h>
> +#include <asm/barebox-arm.h>
> +
> +extern char __dtb_zynqmp_zcu104_revA_start[];
> +
> +void zynqmp_zcu104_start(uint32_t, uint32_t, uint32_t);
> +
> +void noinline zynqmp_zcu104_start(uint32_t r0, uint32_t r1, uint32_t r2)
> +{
> +	/* Assume that the first stage boot loader configured the UART */
> +	putc_ll('>');
> +
> +	barebox_arm_entry(0, SZ_2G,
> +			  __dtb_zynqmp_zcu104_revA_start + global_variable_offset());
> +}
> diff --git a/arch/arm/boards/xilinx-zcu104/lowlevel_init.S b/arch/arm/boards/xilinx-zcu104/lowlevel_init.S
> new file mode 100644
> index 0000000000..23f0ee99dd
> --- /dev/null
> +++ b/arch/arm/boards/xilinx-zcu104/lowlevel_init.S
> @@ -0,0 +1,32 @@
> +#include <linux/linkage.h>
> +#include <init.h>
> +#include <asm/barebox-arm-head.h>
> +#include <asm/system.h>
> +
> +#define ENTRY_PROC(name) \
> +	.section .text_head_entry_##name; \
> +	ENTRY(##name); \
> +		b 2f; \
> +		nop; \
> +		nop; \
> +		nop; \
> +		nop; \
> +		nop; \
> +		nop; \
> +		nop; \
> +		.asciz "barebox"; \
> +		.word 0xffffffff; \
> +		.word _barebox_image_size; \
> +		.rept 8; \
> +		.word 0x55555555; \
> +		.endr; \
> +		2:

Is it some thing SoC specific, or we can move it to some generic place?

> +#define ENTRY_PROC_END(name) \
> +	END(##name)
> +
> +ENTRY_PROC(start_zynqmp_zcu104)
> +	mov x0, #0x7ffffff0
> +	mov sp, x0
> +	b zynqmp_zcu104_start
> +ENTRY_PROC_END(start_zynqmp_zcu104)
> diff --git a/arch/arm/configs/zynqmp_defconfig b/arch/arm/configs/zynqmp_defconfig
> new file mode 100644
> index 0000000000..4dea9647fe
> --- /dev/null
> +++ b/arch/arm/configs/zynqmp_defconfig
> @@ -0,0 +1,38 @@
> +CONFIG_ARCH_ZYNQMP=y
> +CONFIG_MACH_XILINX_ZCU104=y
> +CONFIG_MMU=y
> +CONFIG_MALLOC_SIZE=0x0
> +CONFIG_MALLOC_TLSF=y
> +CONFIG_KALLSYMS=y
> +CONFIG_HUSH_FANCY_PROMPT=y
> +CONFIG_CMDLINE_EDITING=y
> +CONFIG_AUTO_COMPLETE=y
> +CONFIG_MENU=y
> +CONFIG_BOOTM_SHOW_TYPE=y
> +CONFIG_BOOTM_VERBOSE=y
> +CONFIG_BOOTM_INITRD=y
> +CONFIG_BOOTM_OFTREE=y
> +CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
> +CONFIG_LONGHELP=y
> +CONFIG_CMD_MEMINFO=y
> +CONFIG_CMD_GO=y
> +CONFIG_CMD_RESET=y
> +CONFIG_CMD_PARTITION=y
> +CONFIG_CMD_EXPORT=y
> +CONFIG_CMD_PRINTENV=y
> +CONFIG_CMD_MAGICVAR=y
> +CONFIG_CMD_MAGICVAR_HELP=y
> +CONFIG_CMD_SAVEENV=y
> +CONFIG_CMD_LN=y
> +CONFIG_CMD_SLEEP=y
> +CONFIG_CMD_EDIT=y
> +CONFIG_CMD_MENU=y
> +CONFIG_CMD_MENU_MANAGEMENT=y
> +CONFIG_CMD_READLINE=y
> +CONFIG_CMD_TIMEOUT=y
> +CONFIG_CMD_CLK=y
> +CONFIG_CMD_OFTREE=y
> +CONFIG_CMD_TIME=y
> +CONFIG_DRIVER_SERIAL_CADENCE=y
> +# CONFIG_SPI is not set
> +CONFIG_DIGEST=y
> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> index 503d9b18f9..0ac3124c8c 100644
> --- a/arch/arm/dts/Makefile
> +++ b/arch/arm/dts/Makefile
> @@ -119,6 +119,7 @@ pbl-dtb-$(CONFIG_MACH_ZII_VF610_DEV) += \
>  pbl-dtb-$(CONFIG_MACH_AT91SAM9263EK_DT) += at91sam9263ek.dtb.o
>  pbl-dtb-$(CONFIG_MACH_MICROCHIP_KSZ9477_EVB) += at91-microchip-ksz9477-evb.dtb.o
>  pbl-dtb-$(CONFIG_MACH_AT91SAM9X5EK) += at91sam9x5ek.dtb.o
> +pbl-dtb-$(CONFIG_MACH_XILINX_ZCU104) += zynqmp-zcu104-revA.dtb.o
>  
>  pbl-dtb-$(CONFIG_MACH_ZII_IMX7D_RPU2) += imx7d-zii-rpu2.dtb.o
>  
> diff --git a/arch/arm/mach-zynqmp/Kconfig b/arch/arm/mach-zynqmp/Kconfig
> new file mode 100644
> index 0000000000..1c7727d66c
> --- /dev/null
> +++ b/arch/arm/mach-zynqmp/Kconfig
> @@ -0,0 +1,9 @@
> +if ARCH_ZYNQMP
> +
> +config MACH_XILINX_ZCU104
> +	bool "Xilinx Zynq UltraScale+ MPSoC ZCU104"
> +	help
> +	  Say Y here if you are using the Xilinx Zynq UltraScale+ MPSoC ZCU104
> +	  evaluation board.
> +
> +endif
> diff --git a/arch/arm/mach-zynqmp/Makefile b/arch/arm/mach-zynqmp/Makefile
> new file mode 100644
> index 0000000000..1f4e72abc1
> --- /dev/null
> +++ b/arch/arm/mach-zynqmp/Makefile
> @@ -0,0 +1 @@
> +obj-y += zynqmp.o
> diff --git a/arch/arm/mach-zynqmp/include/mach/debug_ll.h b/arch/arm/mach-zynqmp/include/mach/debug_ll.h
> new file mode 100644
> index 0000000000..cd2583a35b
> --- /dev/null
> +++ b/arch/arm/mach-zynqmp/include/mach/debug_ll.h
> @@ -0,0 +1,30 @@
> +#ifndef __MACH_DEBUG_LL_H__
> +#define __MACH_DEBUG_LL_H__
> +
> +#include <io.h>
> +
> +#define ZYNQMP_UART0_BASE		0xFF000000
> +#define ZYNQMP_UART1_BASE		0xFF010000
> +#define ZYNQMP_UART_BASE		ZYNQMP_UART0_BASE
> +#define ZYNQMP_DEBUG_LL_UART_BASE 	ZYNQMP_UART_BASE
> +
> +#define ZYNQMP_UART_RXTXFIFO	0x30
> +#define ZYNQMP_UART_CHANNEL_STS	0x2C
> +
> +#define ZYNQMP_UART_STS_TFUL	(1 << 4)
> +#define ZYNQMP_UART_TXDIS		(1 << 5)
> +
> +static inline void PUTC_LL(int c)
> +{
> +	void __iomem *base = (void __iomem *)ZYNQMP_DEBUG_LL_UART_BASE;
> +
> +	if (readl(base) & ZYNQMP_UART_TXDIS)
> +		return;
> +
> +	while ((readl(base + ZYNQMP_UART_CHANNEL_STS) & ZYNQMP_UART_STS_TFUL) != 0)
> +		;
> +
> +	writel(c, base + 0x30);
> +}
> +
> +#endif
> diff --git a/arch/arm/mach-zynqmp/zynqmp.c b/arch/arm/mach-zynqmp/zynqmp.c
> new file mode 100644
> index 0000000000..04aedb59e0
> --- /dev/null
> +++ b/arch/arm/mach-zynqmp/zynqmp.c
> @@ -0,0 +1,22 @@
> +/*
> + * (c) 2018 Michael Tretter <m.tretter@pengutronix.de>
> + *
> + * This program is free software; you can redistribute it and/or modify it
> + * under the terms of the GNU General Public License as published by the Free
> + * Software Foundation; either version 2 of the License, or (at your option)
> + * any later version.
> + *
> + * This program is distributed in the hope that it will be useful, but WITHOUT
> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
> + * more details.
> + */
> +
> +#include <common.h>
> +#include <init.h>

Do we need it?

> +static int zynqmp_init(void)
> +{
> +	return 0;
> +}
> +postcore_initcall(zynqmp_init);
> diff --git a/images/Makefile b/images/Makefile
> index 5c4d99ac5a..4d28f73a57 100644
> --- a/images/Makefile
> +++ b/images/Makefile
> @@ -113,6 +113,7 @@ include $(srctree)/images/Makefile.socfpga
>  include $(srctree)/images/Makefile.tegra
>  include $(srctree)/images/Makefile.vexpress
>  include $(srctree)/images/Makefile.at91
> +include $(srctree)/images/Makefile.zynqmp
>  
>  targets += $(image-y) pbl.lds barebox.x barebox.z
>  targets += $(patsubst %,%.pblx,$(pblx-y))
> diff --git a/images/Makefile.zynqmp b/images/Makefile.zynqmp
> new file mode 100644
> index 0000000000..f977a6baff
> --- /dev/null
> +++ b/images/Makefile.zynqmp
> @@ -0,0 +1,7 @@
> +#
> +# barebox image generation Makefile for Xilinx Zynq UltraScale+
> +#
> +
> +pblx-$(CONFIG_MACH_XILINX_ZCU104) += start_zynqmp_zcu104
> +FILE_barebox-zynqmp-zcu104.img = start_zynqmp_zcu104.pblx
> +image-$(CONFIG_MACH_XILINX_ZCU104) += barebox-zynqmp-zcu104.img
> 

Sasha posted "ARM: images: Use piggydata" patches. It will be great if
you can test you patches on top of piggy patchset.
-- 
Regards,
Oleksij

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] ARM: zynqmp: add support for Xilinx ZCU104 board
  2018-11-23 15:08   ` Oleksij Rempel
@ 2018-11-23 18:27     ` Michael Tretter
  2018-11-23 18:41       ` Oleksij Rempel
  0 siblings, 1 reply; 11+ messages in thread
From: Michael Tretter @ 2018-11-23 18:27 UTC (permalink / raw)
  To: barebox

On Fri, 23 Nov 2018 16:08:18 +0100, Oleksij Rempel wrote:
> Hi Michael,
> 
> Am 23.11.18 um 14:35 schrieb Michael Tretter:
> > Add support for the Xilinx Zynq Ultrascale+ MPSoC architecture (ZynqMP)
> > and the Xilinx ZCU104 board.
> > 
> > Barebox is booted as BL33 in EL-1 and expects that a BL2 (i.e. the FSBL)
> > already took care of initializing the RAM. Also for debug_ll, the UART
> > is expected to be already setup correctly.
> > 
> > Thus, you have to add the Barebox binary to a boot image as described in
> > "Chapter 11: Boot and Configuration" of "Zynq Ultrascale+ Device
> > Technical Reference Manual".
> > 
> > The ENTRY_FUNCTION macro cannot be used in aarch64, because aarch64 does
> > not specify the __naked__ attribute and gcc add a function prologue to
> > the entry function which writes to the stack, but the stack is not set
> > up. Thus, the entry has to be implemented in assembly.
> > 
> > Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
> > ---
> >  arch/arm/Kconfig                              | 14 +++++++
> >  arch/arm/Makefile                             |  1 +
> >  arch/arm/boards/Makefile                      |  1 +
> >  arch/arm/boards/xilinx-zcu104/Makefile        |  2 +
> >  arch/arm/boards/xilinx-zcu104/board.c         | 25 ++++++++++++
> >  arch/arm/boards/xilinx-zcu104/lowlevel.c      | 30 +++++++++++++++
> >  arch/arm/boards/xilinx-zcu104/lowlevel_init.S | 32 ++++++++++++++++
> >  arch/arm/configs/zynqmp_defconfig             | 38 +++++++++++++++++++
> >  arch/arm/dts/Makefile                         |  1 +
> >  arch/arm/mach-zynqmp/Kconfig                  |  9 +++++
> >  arch/arm/mach-zynqmp/Makefile                 |  1 +
> >  arch/arm/mach-zynqmp/include/mach/debug_ll.h  | 30 +++++++++++++++
> >  arch/arm/mach-zynqmp/zynqmp.c                 | 22 +++++++++++
> >  images/Makefile                               |  1 +
> >  images/Makefile.zynqmp                        |  7 ++++
> >  15 files changed, 214 insertions(+)
> >  create mode 100644 arch/arm/boards/xilinx-zcu104/Makefile
> >  create mode 100644 arch/arm/boards/xilinx-zcu104/board.c
> >  create mode 100644 arch/arm/boards/xilinx-zcu104/lowlevel.c
> >  create mode 100644 arch/arm/boards/xilinx-zcu104/lowlevel_init.S
> >  create mode 100644 arch/arm/configs/zynqmp_defconfig
> >  create mode 100644 arch/arm/mach-zynqmp/Kconfig
> >  create mode 100644 arch/arm/mach-zynqmp/Makefile
> >  create mode 100644 arch/arm/mach-zynqmp/include/mach/debug_ll.h
> >  create mode 100644 arch/arm/mach-zynqmp/zynqmp.c
> >  create mode 100644 images/Makefile.zynqmp
> > 
> > diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
> > index 3b486f7b8b..842cbb1485 100644
> > --- a/arch/arm/Kconfig
> > +++ b/arch/arm/Kconfig
> > @@ -245,6 +245,19 @@ config ARCH_ZYNQ
> >  	bool "Xilinx Zynq-based boards"
> >  	select HAS_DEBUG_LL
> >  
> > +config ARCH_ZYNQMP
> > +	bool "Xilinx ZynqMP-based boards"
> > +	select CPU_V8
> > +	select HAS_DEBUG_LL
> > +	select HAVE_PBL_MULTI_IMAGES
> > +	select COMMON_CLK
> > +	select COMMON_CLK_OF_PROVIDER
> > +	select CLKDEV_LOOKUP
> > +	select OFDEVICE
> > +	select OFTREE
> > +	select RELOCATABLE
> > +	select SYS_SUPPORTS_64BIT_KERNEL
> > +
> >  config ARCH_QEMU
> >  	bool "ARM QEMU boards"
> >  	select HAS_DEBUG_LL
> > @@ -275,6 +288,7 @@ source arch/arm/mach-tegra/Kconfig
> >  source arch/arm/mach-uemd/Kconfig
> >  source arch/arm/mach-zynq/Kconfig
> >  source arch/arm/mach-qemu/Kconfig
> > +source arch/arm/mach-zynqmp/Kconfig
> >  
> >  config ARM_ASM_UNIFIED
> >  	bool
> > diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> > index 50958b787f..675d3433cc 100644
> > --- a/arch/arm/Makefile
> > +++ b/arch/arm/Makefile
> > @@ -101,6 +101,7 @@ machine-$(CONFIG_ARCH_VEXPRESS)		:= vexpress
> >  machine-$(CONFIG_ARCH_TEGRA)		:= tegra
> >  machine-$(CONFIG_ARCH_UEMD)		:= uemd
> >  machine-$(CONFIG_ARCH_ZYNQ)		:= zynq
> > +machine-$(CONFIG_ARCH_ZYNQMP)		:= zynqmp
> >  machine-$(CONFIG_ARCH_QEMU)		:= qemu
> >  
> >  
> > diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
> > index 3bf176b14d..a15a24c02e 100644
> > --- a/arch/arm/boards/Makefile
> > +++ b/arch/arm/boards/Makefile
> > @@ -153,6 +153,7 @@ obj-$(CONFIG_MACH_VSCOM_BALTOS)			+= vscom-baltos/
> >  obj-$(CONFIG_MACH_QEMU_VIRT64)			+= qemu-virt64/
> >  obj-$(CONFIG_MACH_WARP7)			+= element14-warp7/
> >  obj-$(CONFIG_MACH_VF610_TWR)			+= freescale-vf610-twr/
> > +obj-$(CONFIG_MACH_XILINX_ZCU104)		+= xilinx-zcu104/
> >  obj-$(CONFIG_MACH_ZII_RDU1)			+= zii-imx51-rdu1/
> >  obj-$(CONFIG_MACH_ZII_RDU2)			+= zii-imx6q-rdu2/
> >  obj-$(CONFIG_MACH_ZII_VF610_DEV)		+= zii-vf610-dev/
> > diff --git a/arch/arm/boards/xilinx-zcu104/Makefile b/arch/arm/boards/xilinx-zcu104/Makefile
> > new file mode 100644
> > index 0000000000..918615bb76
> > --- /dev/null
> > +++ b/arch/arm/boards/xilinx-zcu104/Makefile
> > @@ -0,0 +1,2 @@
> > +obj-y += board.o
> > +lwl-y += lowlevel.o lowlevel_init.o
> > diff --git a/arch/arm/boards/xilinx-zcu104/board.c b/arch/arm/boards/xilinx-zcu104/board.c
> > new file mode 100644
> > index 0000000000..090c366e99
> > --- /dev/null
> > +++ b/arch/arm/boards/xilinx-zcu104/board.c
> > @@ -0,0 +1,25 @@
> > +/*
> > + * Copyright (C) 2018 Michael Tretter <m.tretter@pengutronix.de>
> > + *
> > + * This program is free software; you can redistribute it and/or modify it
> > + * under the terms of the GNU General Public License as published by the Free
> > + * Software Foundation; either version 2 of the License, or (at your option)
> > + * any later version.
> > + *
> > + * This program is distributed in the hope that it will be useful, but WITHOUT
> > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> > + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
> > + * more details.
> > + */  
> 
> It will be better to start use SPDX-License-Identifier for new files.

Ok.
 
> > +#include <common.h>
> > +#include <init.h>
> > +
> > +static int zcu104_console_init(void)  
> > +{> +	barebox_set_model("Xilinx Zynq UltraScale+ MPSoC ZCU104");  
> > +	barebox_set_hostname("zcu104");  
> 
> Latest barebox version can extract model and hostname from devicetree.
> So, probably we do not need complete board.c file.

I am assuming that we will need a board.c file once we have more
devices working. I will remove the board.c anyway and wait until it is
actually required.

> > +	return 0;
> > +}
> > +console_initcall(zcu104_console_init);
> > diff --git a/arch/arm/boards/xilinx-zcu104/lowlevel.c b/arch/arm/boards/xilinx-zcu104/lowlevel.c
> > new file mode 100644
> > index 0000000000..94ce8b1af9
> > --- /dev/null
> > +++ b/arch/arm/boards/xilinx-zcu104/lowlevel.c
> > @@ -0,0 +1,30 @@
> > +/*
> > + * (c) 2018 Michael Tretter <m.tretter@pengutronix.de>
> > + *
> > + * This program is free software; you can redistribute it and/or modify it
> > + * under the terms of the GNU General Public License as published by the Free
> > + * Software Foundation; either version 2 of the License, or (at your option)
> > + * any later version.
> > + *
> > + * This program is distributed in the hope that it will be useful, but WITHOUT
> > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> > + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
> > + * more details.
> > + */
> > +
> > +#include <common.h>
> > +#include <debug_ll.h>
> > +#include <asm/barebox-arm.h>
> > +
> > +extern char __dtb_zynqmp_zcu104_revA_start[];
> > +
> > +void zynqmp_zcu104_start(uint32_t, uint32_t, uint32_t);
> > +
> > +void noinline zynqmp_zcu104_start(uint32_t r0, uint32_t r1, uint32_t r2)
> > +{
> > +	/* Assume that the first stage boot loader configured the UART */
> > +	putc_ll('>');
> > +
> > +	barebox_arm_entry(0, SZ_2G,
> > +			  __dtb_zynqmp_zcu104_revA_start + global_variable_offset());
> > +}
> > diff --git a/arch/arm/boards/xilinx-zcu104/lowlevel_init.S b/arch/arm/boards/xilinx-zcu104/lowlevel_init.S
> > new file mode 100644
> > index 0000000000..23f0ee99dd
> > --- /dev/null
> > +++ b/arch/arm/boards/xilinx-zcu104/lowlevel_init.S
> > @@ -0,0 +1,32 @@
> > +#include <linux/linkage.h>
> > +#include <init.h>
> > +#include <asm/barebox-arm-head.h>
> > +#include <asm/system.h>
> > +
> > +#define ENTRY_PROC(name) \
> > +	.section .text_head_entry_##name; \
> > +	ENTRY(##name); \
> > +		b 2f; \
> > +		nop; \
> > +		nop; \
> > +		nop; \
> > +		nop; \
> > +		nop; \
> > +		nop; \
> > +		nop; \
> > +		.asciz "barebox"; \
> > +		.word 0xffffffff; \
> > +		.word _barebox_image_size; \
> > +		.rept 8; \
> > +		.word 0x55555555; \
> > +		.endr; \
> > +		2:  
> 
> Is it some thing SoC specific, or we can move it to some generic place?

This is a replacement for the ENTRY_FUNCTION(...) macro. I am expecting
that other arm64 SoCs will use the same macro. However, I wasn't really
sure how to call it and where to put it. I am thinking about an arm64
header, but any suggestions are welcome.

> 
> > +#define ENTRY_PROC_END(name) \
> > +	END(##name)
> > +
> > +ENTRY_PROC(start_zynqmp_zcu104)
> > +	mov x0, #0x7ffffff0
> > +	mov sp, x0
> > +	b zynqmp_zcu104_start
> > +ENTRY_PROC_END(start_zynqmp_zcu104)
> > diff --git a/arch/arm/configs/zynqmp_defconfig b/arch/arm/configs/zynqmp_defconfig
> > new file mode 100644
> > index 0000000000..4dea9647fe
> > --- /dev/null
> > +++ b/arch/arm/configs/zynqmp_defconfig
> > @@ -0,0 +1,38 @@
> > +CONFIG_ARCH_ZYNQMP=y
> > +CONFIG_MACH_XILINX_ZCU104=y
> > +CONFIG_MMU=y
> > +CONFIG_MALLOC_SIZE=0x0
> > +CONFIG_MALLOC_TLSF=y
> > +CONFIG_KALLSYMS=y
> > +CONFIG_HUSH_FANCY_PROMPT=y
> > +CONFIG_CMDLINE_EDITING=y
> > +CONFIG_AUTO_COMPLETE=y
> > +CONFIG_MENU=y
> > +CONFIG_BOOTM_SHOW_TYPE=y
> > +CONFIG_BOOTM_VERBOSE=y
> > +CONFIG_BOOTM_INITRD=y
> > +CONFIG_BOOTM_OFTREE=y
> > +CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
> > +CONFIG_LONGHELP=y
> > +CONFIG_CMD_MEMINFO=y
> > +CONFIG_CMD_GO=y
> > +CONFIG_CMD_RESET=y
> > +CONFIG_CMD_PARTITION=y
> > +CONFIG_CMD_EXPORT=y
> > +CONFIG_CMD_PRINTENV=y
> > +CONFIG_CMD_MAGICVAR=y
> > +CONFIG_CMD_MAGICVAR_HELP=y
> > +CONFIG_CMD_SAVEENV=y
> > +CONFIG_CMD_LN=y
> > +CONFIG_CMD_SLEEP=y
> > +CONFIG_CMD_EDIT=y
> > +CONFIG_CMD_MENU=y
> > +CONFIG_CMD_MENU_MANAGEMENT=y
> > +CONFIG_CMD_READLINE=y
> > +CONFIG_CMD_TIMEOUT=y
> > +CONFIG_CMD_CLK=y
> > +CONFIG_CMD_OFTREE=y
> > +CONFIG_CMD_TIME=y
> > +CONFIG_DRIVER_SERIAL_CADENCE=y
> > +# CONFIG_SPI is not set
> > +CONFIG_DIGEST=y
> > diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
> > index 503d9b18f9..0ac3124c8c 100644
> > --- a/arch/arm/dts/Makefile
> > +++ b/arch/arm/dts/Makefile
> > @@ -119,6 +119,7 @@ pbl-dtb-$(CONFIG_MACH_ZII_VF610_DEV) += \
> >  pbl-dtb-$(CONFIG_MACH_AT91SAM9263EK_DT) += at91sam9263ek.dtb.o
> >  pbl-dtb-$(CONFIG_MACH_MICROCHIP_KSZ9477_EVB) += at91-microchip-ksz9477-evb.dtb.o
> >  pbl-dtb-$(CONFIG_MACH_AT91SAM9X5EK) += at91sam9x5ek.dtb.o
> > +pbl-dtb-$(CONFIG_MACH_XILINX_ZCU104) += zynqmp-zcu104-revA.dtb.o
> >  
> >  pbl-dtb-$(CONFIG_MACH_ZII_IMX7D_RPU2) += imx7d-zii-rpu2.dtb.o
> >  
> > diff --git a/arch/arm/mach-zynqmp/Kconfig b/arch/arm/mach-zynqmp/Kconfig
> > new file mode 100644
> > index 0000000000..1c7727d66c
> > --- /dev/null
> > +++ b/arch/arm/mach-zynqmp/Kconfig
> > @@ -0,0 +1,9 @@
> > +if ARCH_ZYNQMP
> > +
> > +config MACH_XILINX_ZCU104
> > +	bool "Xilinx Zynq UltraScale+ MPSoC ZCU104"
> > +	help
> > +	  Say Y here if you are using the Xilinx Zynq UltraScale+ MPSoC ZCU104
> > +	  evaluation board.
> > +
> > +endif
> > diff --git a/arch/arm/mach-zynqmp/Makefile b/arch/arm/mach-zynqmp/Makefile
> > new file mode 100644
> > index 0000000000..1f4e72abc1
> > --- /dev/null
> > +++ b/arch/arm/mach-zynqmp/Makefile
> > @@ -0,0 +1 @@
> > +obj-y += zynqmp.o
> > diff --git a/arch/arm/mach-zynqmp/include/mach/debug_ll.h b/arch/arm/mach-zynqmp/include/mach/debug_ll.h
> > new file mode 100644
> > index 0000000000..cd2583a35b
> > --- /dev/null
> > +++ b/arch/arm/mach-zynqmp/include/mach/debug_ll.h
> > @@ -0,0 +1,30 @@
> > +#ifndef __MACH_DEBUG_LL_H__
> > +#define __MACH_DEBUG_LL_H__
> > +
> > +#include <io.h>
> > +
> > +#define ZYNQMP_UART0_BASE		0xFF000000
> > +#define ZYNQMP_UART1_BASE		0xFF010000
> > +#define ZYNQMP_UART_BASE		ZYNQMP_UART0_BASE
> > +#define ZYNQMP_DEBUG_LL_UART_BASE 	ZYNQMP_UART_BASE
> > +
> > +#define ZYNQMP_UART_RXTXFIFO	0x30
> > +#define ZYNQMP_UART_CHANNEL_STS	0x2C
> > +
> > +#define ZYNQMP_UART_STS_TFUL	(1 << 4)
> > +#define ZYNQMP_UART_TXDIS		(1 << 5)
> > +
> > +static inline void PUTC_LL(int c)
> > +{
> > +	void __iomem *base = (void __iomem *)ZYNQMP_DEBUG_LL_UART_BASE;
> > +
> > +	if (readl(base) & ZYNQMP_UART_TXDIS)
> > +		return;
> > +
> > +	while ((readl(base + ZYNQMP_UART_CHANNEL_STS) & ZYNQMP_UART_STS_TFUL) != 0)
> > +		;
> > +
> > +	writel(c, base + 0x30);
> > +}
> > +
> > +#endif
> > diff --git a/arch/arm/mach-zynqmp/zynqmp.c b/arch/arm/mach-zynqmp/zynqmp.c
> > new file mode 100644
> > index 0000000000..04aedb59e0
> > --- /dev/null
> > +++ b/arch/arm/mach-zynqmp/zynqmp.c
> > @@ -0,0 +1,22 @@
> > +/*
> > + * (c) 2018 Michael Tretter <m.tretter@pengutronix.de>
> > + *
> > + * This program is free software; you can redistribute it and/or modify it
> > + * under the terms of the GNU General Public License as published by the Free
> > + * Software Foundation; either version 2 of the License, or (at your option)
> > + * any later version.
> > + *
> > + * This program is distributed in the hope that it will be useful, but WITHOUT
> > + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
> > + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
> > + * more details.
> > + */
> > +
> > +#include <common.h>
> > +#include <init.h>  
> 
> Do we need it?

Same as for board.c, but I will remove the file as well.

> 
> > +static int zynqmp_init(void)
> > +{
> > +	return 0;
> > +}
> > +postcore_initcall(zynqmp_init);
> > diff --git a/images/Makefile b/images/Makefile
> > index 5c4d99ac5a..4d28f73a57 100644
> > --- a/images/Makefile
> > +++ b/images/Makefile
> > @@ -113,6 +113,7 @@ include $(srctree)/images/Makefile.socfpga
> >  include $(srctree)/images/Makefile.tegra
> >  include $(srctree)/images/Makefile.vexpress
> >  include $(srctree)/images/Makefile.at91
> > +include $(srctree)/images/Makefile.zynqmp
> >  
> >  targets += $(image-y) pbl.lds barebox.x barebox.z
> >  targets += $(patsubst %,%.pblx,$(pblx-y))
> > diff --git a/images/Makefile.zynqmp b/images/Makefile.zynqmp
> > new file mode 100644
> > index 0000000000..f977a6baff
> > --- /dev/null
> > +++ b/images/Makefile.zynqmp
> > @@ -0,0 +1,7 @@
> > +#
> > +# barebox image generation Makefile for Xilinx Zynq UltraScale+
> > +#
> > +
> > +pblx-$(CONFIG_MACH_XILINX_ZCU104) += start_zynqmp_zcu104
> > +FILE_barebox-zynqmp-zcu104.img = start_zynqmp_zcu104.pblx
> > +image-$(CONFIG_MACH_XILINX_ZCU104) += barebox-zynqmp-zcu104.img
> >   
> 
> Sasha posted "ARM: images: Use piggydata" patches. It will be great if
> you can test you patches on top of piggy patchset.

Will do.

Thanks,

Michael

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] ARM: zynqmp: add support for Xilinx ZCU104 board
  2018-11-23 18:27     ` Michael Tretter
@ 2018-11-23 18:41       ` Oleksij Rempel
  0 siblings, 0 replies; 11+ messages in thread
From: Oleksij Rempel @ 2018-11-23 18:41 UTC (permalink / raw)
  To: Michael Tretter, barebox

Am 23.11.18 um 19:27 schrieb Michael Tretter:
> On Fri, 23 Nov 2018 16:08:18 +0100, Oleksij Rempel wrote:
>> Hi Michael,
>>
>> Am 23.11.18 um 14:35 schrieb Michael Tretter:
>>> Add support for the Xilinx Zynq Ultrascale+ MPSoC architecture (ZynqMP)
>>> and the Xilinx ZCU104 board.
>>>
>>> Barebox is booted as BL33 in EL-1 and expects that a BL2 (i.e. the FSBL)
>>> already took care of initializing the RAM. Also for debug_ll, the UART
>>> is expected to be already setup correctly.
>>>
>>> Thus, you have to add the Barebox binary to a boot image as described in
>>> "Chapter 11: Boot and Configuration" of "Zynq Ultrascale+ Device
>>> Technical Reference Manual".
>>>
>>> The ENTRY_FUNCTION macro cannot be used in aarch64, because aarch64 does
>>> not specify the __naked__ attribute and gcc add a function prologue to
>>> the entry function which writes to the stack, but the stack is not set
>>> up. Thus, the entry has to be implemented in assembly.
>>>
>>> Signed-off-by: Michael Tretter <m.tretter@pengutronix.de>
>>> ---
>>>  arch/arm/Kconfig                              | 14 +++++++
>>>  arch/arm/Makefile                             |  1 +
>>>  arch/arm/boards/Makefile                      |  1 +
>>>  arch/arm/boards/xilinx-zcu104/Makefile        |  2 +
>>>  arch/arm/boards/xilinx-zcu104/board.c         | 25 ++++++++++++
>>>  arch/arm/boards/xilinx-zcu104/lowlevel.c      | 30 +++++++++++++++
>>>  arch/arm/boards/xilinx-zcu104/lowlevel_init.S | 32 ++++++++++++++++
>>>  arch/arm/configs/zynqmp_defconfig             | 38 +++++++++++++++++++
>>>  arch/arm/dts/Makefile                         |  1 +
>>>  arch/arm/mach-zynqmp/Kconfig                  |  9 +++++
>>>  arch/arm/mach-zynqmp/Makefile                 |  1 +
>>>  arch/arm/mach-zynqmp/include/mach/debug_ll.h  | 30 +++++++++++++++
>>>  arch/arm/mach-zynqmp/zynqmp.c                 | 22 +++++++++++
>>>  images/Makefile                               |  1 +
>>>  images/Makefile.zynqmp                        |  7 ++++
>>>  15 files changed, 214 insertions(+)
>>>  create mode 100644 arch/arm/boards/xilinx-zcu104/Makefile
>>>  create mode 100644 arch/arm/boards/xilinx-zcu104/board.c
>>>  create mode 100644 arch/arm/boards/xilinx-zcu104/lowlevel.c
>>>  create mode 100644 arch/arm/boards/xilinx-zcu104/lowlevel_init.S
>>>  create mode 100644 arch/arm/configs/zynqmp_defconfig
>>>  create mode 100644 arch/arm/mach-zynqmp/Kconfig
>>>  create mode 100644 arch/arm/mach-zynqmp/Makefile
>>>  create mode 100644 arch/arm/mach-zynqmp/include/mach/debug_ll.h
>>>  create mode 100644 arch/arm/mach-zynqmp/zynqmp.c
>>>  create mode 100644 images/Makefile.zynqmp
>>>
>>> diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
>>> index 3b486f7b8b..842cbb1485 100644
>>> --- a/arch/arm/Kconfig
>>> +++ b/arch/arm/Kconfig
>>> @@ -245,6 +245,19 @@ config ARCH_ZYNQ
>>>  	bool "Xilinx Zynq-based boards"
>>>  	select HAS_DEBUG_LL
>>>  
>>> +config ARCH_ZYNQMP
>>> +	bool "Xilinx ZynqMP-based boards"
>>> +	select CPU_V8
>>> +	select HAS_DEBUG_LL
>>> +	select HAVE_PBL_MULTI_IMAGES
>>> +	select COMMON_CLK
>>> +	select COMMON_CLK_OF_PROVIDER
>>> +	select CLKDEV_LOOKUP
>>> +	select OFDEVICE
>>> +	select OFTREE
>>> +	select RELOCATABLE
>>> +	select SYS_SUPPORTS_64BIT_KERNEL
>>> +
>>>  config ARCH_QEMU
>>>  	bool "ARM QEMU boards"
>>>  	select HAS_DEBUG_LL
>>> @@ -275,6 +288,7 @@ source arch/arm/mach-tegra/Kconfig
>>>  source arch/arm/mach-uemd/Kconfig
>>>  source arch/arm/mach-zynq/Kconfig
>>>  source arch/arm/mach-qemu/Kconfig
>>> +source arch/arm/mach-zynqmp/Kconfig
>>>  
>>>  config ARM_ASM_UNIFIED
>>>  	bool
>>> diff --git a/arch/arm/Makefile b/arch/arm/Makefile
>>> index 50958b787f..675d3433cc 100644
>>> --- a/arch/arm/Makefile
>>> +++ b/arch/arm/Makefile
>>> @@ -101,6 +101,7 @@ machine-$(CONFIG_ARCH_VEXPRESS)		:= vexpress
>>>  machine-$(CONFIG_ARCH_TEGRA)		:= tegra
>>>  machine-$(CONFIG_ARCH_UEMD)		:= uemd
>>>  machine-$(CONFIG_ARCH_ZYNQ)		:= zynq
>>> +machine-$(CONFIG_ARCH_ZYNQMP)		:= zynqmp
>>>  machine-$(CONFIG_ARCH_QEMU)		:= qemu
>>>  
>>>  
>>> diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
>>> index 3bf176b14d..a15a24c02e 100644
>>> --- a/arch/arm/boards/Makefile
>>> +++ b/arch/arm/boards/Makefile
>>> @@ -153,6 +153,7 @@ obj-$(CONFIG_MACH_VSCOM_BALTOS)			+= vscom-baltos/
>>>  obj-$(CONFIG_MACH_QEMU_VIRT64)			+= qemu-virt64/
>>>  obj-$(CONFIG_MACH_WARP7)			+= element14-warp7/
>>>  obj-$(CONFIG_MACH_VF610_TWR)			+= freescale-vf610-twr/
>>> +obj-$(CONFIG_MACH_XILINX_ZCU104)		+= xilinx-zcu104/
>>>  obj-$(CONFIG_MACH_ZII_RDU1)			+= zii-imx51-rdu1/
>>>  obj-$(CONFIG_MACH_ZII_RDU2)			+= zii-imx6q-rdu2/
>>>  obj-$(CONFIG_MACH_ZII_VF610_DEV)		+= zii-vf610-dev/
>>> diff --git a/arch/arm/boards/xilinx-zcu104/Makefile b/arch/arm/boards/xilinx-zcu104/Makefile
>>> new file mode 100644
>>> index 0000000000..918615bb76
>>> --- /dev/null
>>> +++ b/arch/arm/boards/xilinx-zcu104/Makefile
>>> @@ -0,0 +1,2 @@
>>> +obj-y += board.o
>>> +lwl-y += lowlevel.o lowlevel_init.o
>>> diff --git a/arch/arm/boards/xilinx-zcu104/board.c b/arch/arm/boards/xilinx-zcu104/board.c
>>> new file mode 100644
>>> index 0000000000..090c366e99
>>> --- /dev/null
>>> +++ b/arch/arm/boards/xilinx-zcu104/board.c
>>> @@ -0,0 +1,25 @@
>>> +/*
>>> + * Copyright (C) 2018 Michael Tretter <m.tretter@pengutronix.de>
>>> + *
>>> + * This program is free software; you can redistribute it and/or modify it
>>> + * under the terms of the GNU General Public License as published by the Free
>>> + * Software Foundation; either version 2 of the License, or (at your option)
>>> + * any later version.
>>> + *
>>> + * This program is distributed in the hope that it will be useful, but WITHOUT
>>> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
>>> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
>>> + * more details.
>>> + */  
>>
>> It will be better to start use SPDX-License-Identifier for new files.
> 
> Ok.
>  
>>> +#include <common.h>
>>> +#include <init.h>
>>> +
>>> +static int zcu104_console_init(void)  
>>> +{> +	barebox_set_model("Xilinx Zynq UltraScale+ MPSoC ZCU104");  
>>> +	barebox_set_hostname("zcu104");  
>>
>> Latest barebox version can extract model and hostname from devicetree.
>> So, probably we do not need complete board.c file.
> 
> I am assuming that we will need a board.c file once we have more
> devices working. I will remove the board.c anyway and wait until it is
> actually required.
> 
>>> +	return 0;
>>> +}
>>> +console_initcall(zcu104_console_init);
>>> diff --git a/arch/arm/boards/xilinx-zcu104/lowlevel.c b/arch/arm/boards/xilinx-zcu104/lowlevel.c
>>> new file mode 100644
>>> index 0000000000..94ce8b1af9
>>> --- /dev/null
>>> +++ b/arch/arm/boards/xilinx-zcu104/lowlevel.c
>>> @@ -0,0 +1,30 @@
>>> +/*
>>> + * (c) 2018 Michael Tretter <m.tretter@pengutronix.de>
>>> + *
>>> + * This program is free software; you can redistribute it and/or modify it
>>> + * under the terms of the GNU General Public License as published by the Free
>>> + * Software Foundation; either version 2 of the License, or (at your option)
>>> + * any later version.
>>> + *
>>> + * This program is distributed in the hope that it will be useful, but WITHOUT
>>> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
>>> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
>>> + * more details.
>>> + */
>>> +
>>> +#include <common.h>
>>> +#include <debug_ll.h>
>>> +#include <asm/barebox-arm.h>
>>> +
>>> +extern char __dtb_zynqmp_zcu104_revA_start[];
>>> +
>>> +void zynqmp_zcu104_start(uint32_t, uint32_t, uint32_t);
>>> +
>>> +void noinline zynqmp_zcu104_start(uint32_t r0, uint32_t r1, uint32_t r2)
>>> +{
>>> +	/* Assume that the first stage boot loader configured the UART */
>>> +	putc_ll('>');
>>> +
>>> +	barebox_arm_entry(0, SZ_2G,
>>> +			  __dtb_zynqmp_zcu104_revA_start + global_variable_offset());
>>> +}
>>> diff --git a/arch/arm/boards/xilinx-zcu104/lowlevel_init.S b/arch/arm/boards/xilinx-zcu104/lowlevel_init.S
>>> new file mode 100644
>>> index 0000000000..23f0ee99dd
>>> --- /dev/null
>>> +++ b/arch/arm/boards/xilinx-zcu104/lowlevel_init.S
>>> @@ -0,0 +1,32 @@
>>> +#include <linux/linkage.h>
>>> +#include <init.h>
>>> +#include <asm/barebox-arm-head.h>
>>> +#include <asm/system.h>
>>> +
>>> +#define ENTRY_PROC(name) \
>>> +	.section .text_head_entry_##name; \
>>> +	ENTRY(##name); \
>>> +		b 2f; \
>>> +		nop; \
>>> +		nop; \
>>> +		nop; \
>>> +		nop; \
>>> +		nop; \
>>> +		nop; \
>>> +		nop; \
>>> +		.asciz "barebox"; \
>>> +		.word 0xffffffff; \
>>> +		.word _barebox_image_size; \
>>> +		.rept 8; \
>>> +		.word 0x55555555; \
>>> +		.endr; \
>>> +		2:  
>>
>> Is it some thing SoC specific, or we can move it to some generic place?
> 
> This is a replacement for the ENTRY_FUNCTION(...) macro. I am expecting
> that other arm64 SoCs will use the same macro. However, I wasn't really
> sure how to call it and where to put it. I am thinking about an arm64
> header, but any suggestions are welcome.

I added some thing similar for MIPS, but it was not reviewed
https://github.com/olerem/barebox/commit/43bb4233c0da97bb0b9de53ef89c441bbf1ef4f4


>>
>>> +#define ENTRY_PROC_END(name) \
>>> +	END(##name)
>>> +
>>> +ENTRY_PROC(start_zynqmp_zcu104)
>>> +	mov x0, #0x7ffffff0
>>> +	mov sp, x0
>>> +	b zynqmp_zcu104_start
>>> +ENTRY_PROC_END(start_zynqmp_zcu104)
>>> diff --git a/arch/arm/configs/zynqmp_defconfig b/arch/arm/configs/zynqmp_defconfig
>>> new file mode 100644
>>> index 0000000000..4dea9647fe
>>> --- /dev/null
>>> +++ b/arch/arm/configs/zynqmp_defconfig
>>> @@ -0,0 +1,38 @@
>>> +CONFIG_ARCH_ZYNQMP=y
>>> +CONFIG_MACH_XILINX_ZCU104=y
>>> +CONFIG_MMU=y
>>> +CONFIG_MALLOC_SIZE=0x0
>>> +CONFIG_MALLOC_TLSF=y
>>> +CONFIG_KALLSYMS=y
>>> +CONFIG_HUSH_FANCY_PROMPT=y
>>> +CONFIG_CMDLINE_EDITING=y
>>> +CONFIG_AUTO_COMPLETE=y
>>> +CONFIG_MENU=y
>>> +CONFIG_BOOTM_SHOW_TYPE=y
>>> +CONFIG_BOOTM_VERBOSE=y
>>> +CONFIG_BOOTM_INITRD=y
>>> +CONFIG_BOOTM_OFTREE=y
>>> +CONFIG_DEFAULT_ENVIRONMENT_GENERIC_NEW=y
>>> +CONFIG_LONGHELP=y
>>> +CONFIG_CMD_MEMINFO=y
>>> +CONFIG_CMD_GO=y
>>> +CONFIG_CMD_RESET=y
>>> +CONFIG_CMD_PARTITION=y
>>> +CONFIG_CMD_EXPORT=y
>>> +CONFIG_CMD_PRINTENV=y
>>> +CONFIG_CMD_MAGICVAR=y
>>> +CONFIG_CMD_MAGICVAR_HELP=y
>>> +CONFIG_CMD_SAVEENV=y
>>> +CONFIG_CMD_LN=y
>>> +CONFIG_CMD_SLEEP=y
>>> +CONFIG_CMD_EDIT=y
>>> +CONFIG_CMD_MENU=y
>>> +CONFIG_CMD_MENU_MANAGEMENT=y
>>> +CONFIG_CMD_READLINE=y
>>> +CONFIG_CMD_TIMEOUT=y
>>> +CONFIG_CMD_CLK=y
>>> +CONFIG_CMD_OFTREE=y
>>> +CONFIG_CMD_TIME=y
>>> +CONFIG_DRIVER_SERIAL_CADENCE=y
>>> +# CONFIG_SPI is not set
>>> +CONFIG_DIGEST=y
>>> diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile
>>> index 503d9b18f9..0ac3124c8c 100644
>>> --- a/arch/arm/dts/Makefile
>>> +++ b/arch/arm/dts/Makefile
>>> @@ -119,6 +119,7 @@ pbl-dtb-$(CONFIG_MACH_ZII_VF610_DEV) += \
>>>  pbl-dtb-$(CONFIG_MACH_AT91SAM9263EK_DT) += at91sam9263ek.dtb.o
>>>  pbl-dtb-$(CONFIG_MACH_MICROCHIP_KSZ9477_EVB) += at91-microchip-ksz9477-evb.dtb.o
>>>  pbl-dtb-$(CONFIG_MACH_AT91SAM9X5EK) += at91sam9x5ek.dtb.o
>>> +pbl-dtb-$(CONFIG_MACH_XILINX_ZCU104) += zynqmp-zcu104-revA.dtb.o
>>>  
>>>  pbl-dtb-$(CONFIG_MACH_ZII_IMX7D_RPU2) += imx7d-zii-rpu2.dtb.o
>>>  
>>> diff --git a/arch/arm/mach-zynqmp/Kconfig b/arch/arm/mach-zynqmp/Kconfig
>>> new file mode 100644
>>> index 0000000000..1c7727d66c
>>> --- /dev/null
>>> +++ b/arch/arm/mach-zynqmp/Kconfig
>>> @@ -0,0 +1,9 @@
>>> +if ARCH_ZYNQMP
>>> +
>>> +config MACH_XILINX_ZCU104
>>> +	bool "Xilinx Zynq UltraScale+ MPSoC ZCU104"
>>> +	help
>>> +	  Say Y here if you are using the Xilinx Zynq UltraScale+ MPSoC ZCU104
>>> +	  evaluation board.
>>> +
>>> +endif
>>> diff --git a/arch/arm/mach-zynqmp/Makefile b/arch/arm/mach-zynqmp/Makefile
>>> new file mode 100644
>>> index 0000000000..1f4e72abc1
>>> --- /dev/null
>>> +++ b/arch/arm/mach-zynqmp/Makefile
>>> @@ -0,0 +1 @@
>>> +obj-y += zynqmp.o
>>> diff --git a/arch/arm/mach-zynqmp/include/mach/debug_ll.h b/arch/arm/mach-zynqmp/include/mach/debug_ll.h
>>> new file mode 100644
>>> index 0000000000..cd2583a35b
>>> --- /dev/null
>>> +++ b/arch/arm/mach-zynqmp/include/mach/debug_ll.h
>>> @@ -0,0 +1,30 @@
>>> +#ifndef __MACH_DEBUG_LL_H__
>>> +#define __MACH_DEBUG_LL_H__
>>> +
>>> +#include <io.h>
>>> +
>>> +#define ZYNQMP_UART0_BASE		0xFF000000
>>> +#define ZYNQMP_UART1_BASE		0xFF010000
>>> +#define ZYNQMP_UART_BASE		ZYNQMP_UART0_BASE
>>> +#define ZYNQMP_DEBUG_LL_UART_BASE 	ZYNQMP_UART_BASE
>>> +
>>> +#define ZYNQMP_UART_RXTXFIFO	0x30
>>> +#define ZYNQMP_UART_CHANNEL_STS	0x2C
>>> +
>>> +#define ZYNQMP_UART_STS_TFUL	(1 << 4)
>>> +#define ZYNQMP_UART_TXDIS		(1 << 5)
>>> +
>>> +static inline void PUTC_LL(int c)
>>> +{
>>> +	void __iomem *base = (void __iomem *)ZYNQMP_DEBUG_LL_UART_BASE;
>>> +
>>> +	if (readl(base) & ZYNQMP_UART_TXDIS)
>>> +		return;
>>> +
>>> +	while ((readl(base + ZYNQMP_UART_CHANNEL_STS) & ZYNQMP_UART_STS_TFUL) != 0)
>>> +		;
>>> +
>>> +	writel(c, base + 0x30);
>>> +}
>>> +
>>> +#endif
>>> diff --git a/arch/arm/mach-zynqmp/zynqmp.c b/arch/arm/mach-zynqmp/zynqmp.c
>>> new file mode 100644
>>> index 0000000000..04aedb59e0
>>> --- /dev/null
>>> +++ b/arch/arm/mach-zynqmp/zynqmp.c
>>> @@ -0,0 +1,22 @@
>>> +/*
>>> + * (c) 2018 Michael Tretter <m.tretter@pengutronix.de>
>>> + *
>>> + * This program is free software; you can redistribute it and/or modify it
>>> + * under the terms of the GNU General Public License as published by the Free
>>> + * Software Foundation; either version 2 of the License, or (at your option)
>>> + * any later version.
>>> + *
>>> + * This program is distributed in the hope that it will be useful, but WITHOUT
>>> + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
>>> + * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
>>> + * more details.
>>> + */
>>> +
>>> +#include <common.h>
>>> +#include <init.h>  
>>
>> Do we need it?
> 
> Same as for board.c, but I will remove the file as well.
> 
>>
>>> +static int zynqmp_init(void)
>>> +{
>>> +	return 0;
>>> +}
>>> +postcore_initcall(zynqmp_init);
>>> diff --git a/images/Makefile b/images/Makefile
>>> index 5c4d99ac5a..4d28f73a57 100644
>>> --- a/images/Makefile
>>> +++ b/images/Makefile
>>> @@ -113,6 +113,7 @@ include $(srctree)/images/Makefile.socfpga
>>>  include $(srctree)/images/Makefile.tegra
>>>  include $(srctree)/images/Makefile.vexpress
>>>  include $(srctree)/images/Makefile.at91
>>> +include $(srctree)/images/Makefile.zynqmp
>>>  
>>>  targets += $(image-y) pbl.lds barebox.x barebox.z
>>>  targets += $(patsubst %,%.pblx,$(pblx-y))
>>> diff --git a/images/Makefile.zynqmp b/images/Makefile.zynqmp
>>> new file mode 100644
>>> index 0000000000..f977a6baff
>>> --- /dev/null
>>> +++ b/images/Makefile.zynqmp
>>> @@ -0,0 +1,7 @@
>>> +#
>>> +# barebox image generation Makefile for Xilinx Zynq UltraScale+
>>> +#
>>> +
>>> +pblx-$(CONFIG_MACH_XILINX_ZCU104) += start_zynqmp_zcu104
>>> +FILE_barebox-zynqmp-zcu104.img = start_zynqmp_zcu104.pblx
>>> +image-$(CONFIG_MACH_XILINX_ZCU104) += barebox-zynqmp-zcu104.img
>>>   
>>
>> Sasha posted "ARM: images: Use piggydata" patches. It will be great if
>> you can test you patches on top of piggy patchset.
> 
> Will do.
> 
> Thanks,
> 
> Michael
> 
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
> 


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 3/3] ARM: zynqmp: add support for Xilinx ZCU104 board
  2018-11-23 13:55   ` Rouven Czerwinski
@ 2018-11-26 10:37     ` Roland Hieber
  0 siblings, 0 replies; 11+ messages in thread
From: Roland Hieber @ 2018-11-26 10:37 UTC (permalink / raw)
  To: Rouven Czerwinski; +Cc: barebox, Michael Tretter

On Fri, Nov 23, 2018 at 02:55:24PM +0100, Rouven Czerwinski wrote:
> Michael Tretter <m.tretter@pengutronix.de> writes:
[...]
> > +static inline void PUTC_LL(int c)
> > +{
> > +	void __iomem *base = (void __iomem *)ZYNQMP_DEBUG_LL_UART_BASE;
> > +
> > +	if (readl(base) & ZYNQMP_UART_TXDIS)
> > +		return;
> > +
> > +	while ((readl(base + ZYNQMP_UART_CHANNEL_STS) & ZYNQMP_UART_STS_TFUL) != 0)
> > +		;
>                 ^ this should be in the previous line

Is there a coding style for that? I find the semicolon better in a
single line to make it more obvious that this is an empty while loop.

 - Roland

> > +
> > +	writel(c, base + 0x30);
> > +}
> > +
> > +#endif

-- 
Roland Hieber                     | r.hieber@pengutronix.de     |
Pengutronix e.K.                  | https://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim | Phone: +49-5121-206917-5086 |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2018-11-26 10:37 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-23 13:35 [PATCH 0/3] Xilinx Zynq Ultrascale+ MPSoC support Michael Tretter
2018-11-23 13:35 ` [PATCH 1/3] ARM: lib64: .gitignore barebox.lds Michael Tretter
2018-11-23 13:35 ` [PATCH 2/3] ARM: aarch64: compile with general-regs-only Michael Tretter
2018-11-23 13:48   ` Rouven Czerwinski
2018-11-23 13:35 ` [PATCH 3/3] ARM: zynqmp: add support for Xilinx ZCU104 board Michael Tretter
2018-11-23 13:55   ` Rouven Czerwinski
2018-11-26 10:37     ` Roland Hieber
2018-11-23 14:38   ` Michael Tretter
2018-11-23 15:08   ` Oleksij Rempel
2018-11-23 18:27     ` Michael Tretter
2018-11-23 18:41       ` Oleksij Rempel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox