Skip to contentSkip to conversation

arm: Add (back) VExpress boards support

PATCH In review Andre Przywara 2 participants 7 messages Jun 29, 2021 – Jun 30, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm: Add (back) VExpress boards support

The v2021.07 merge window saw the removal of the Arm Ltd. Versatile Express platform, along with their CA5, CA9 and TC2 boards. The trigger was the missing conversion of the MMC driver.

Some folks complained about that internally, so bring those boards back, but better than ever:
- Use DM and OF_CONTROL for all the boards. Use the .dts files from the latest Linux kernel (5.13) for that.
- Move the board selection choice into the platform's Kconfig.
- Clean up some shared config and common definitions.
- Drop obsolete features like ATAGs support.
- Switch to the DM_ETH version of the SMC911X Ethernet driver.
- Drop MMC support.

The PL180 MMC driver actually supports DM_MMC, but that requires a DM_GPIO driver for the card detect GPIO, which we don't have. This specific GPIO is actually handled via the "sysregs" device, so we would need a driver for that. QEMU does not emulate this part, also the DT description is somewhat "special", so this is left for later.

This version compiles without any warning for all three boards now. Tested on QEMU.

---
Hi,

this relies on the SMC911x driver DT changes, as posted here:
https://lists.denx.de/pipermail/u-boot/2021-June/452989.html
I put a version with the changes broken down here:
https://github.com/Andre-ARM/u-boot/commits/tc2-history

This was tested on QEMU, for vexpress_ca15_tc2_defconfig with:

$ qemu-system-arm -M vexpress-a15,secure=on -cpu cortex-a15 -m 1G -smp 1 \
  -drive file=tramp-tc2.bin,if=pflash,format=raw,read-only \
  -device loader,file=u-boot.bin,addr=0x80800000 -nographic

Where tramp-tc2.bin is a trampoline replacing the board's firmware:
00000000 00 00 a0 e3 80 00 48 e3 10 ff 2f e1
(mov r0, #0; movt r0, #0x8080; bx r0)

The vexpress_ca9x4_defconfig uses a different memory map, so the runes are:

$ qemu-system-arm -M vexpress-a9 -cpu cortex-a9 -m 1G -smp 1 \
  -drive file=tramp-ca9.bin,if=pflash,format=raw,read-only \
  -device loader,file=u-boot.bin,addr=0x60800000 -nographic

tramp-ca9.bin:
00000000 00 00 a0 e3 80 00 46 e3 10 ff 2f e1
(mov r0, #0; movt r0, #0x6080; bx r0)

Cheers,
Andre

 .azure-pipelines.yml                          |   6 +
 .gitlab-ci.yml                                |  12 +
 Kconfig                                       |   2 +-
 arch/arm/Kconfig                              |  16 +
 arch/arm/dts/Makefile                         |   5 +
 arch/arm/dts/vexpress-v2m-rs1.dtsi            | 441 +++++++++++
 arch/arm/dts/vexpress-v2m.dtsi                | 454 ++++++++++++
 arch/arm/dts/vexpress-v2p-ca15_a7.dts         | 691 ++++++++++++++++++
 arch/arm/dts/vexpress-v2p-ca5s.dts            | 280 +++++++
 arch/arm/dts/vexpress-v2p-ca9.dts             | 368 ++++++++++
 board/armltd/vexpress/Kconfig                 |  39 +
 board/armltd/vexpress/MAINTAINERS             |   8 +
 board/armltd/vexpress/Makefile                |   7 +
 board/armltd/vexpress/vexpress_common.c       | 196 +++++
 board/armltd/vexpress/vexpress_tc2.c          |  82 +++
 configs/vexpress_ca15_tc2_defconfig           |  16 +
 configs/vexpress_ca5x2_defconfig              |  15 +
 configs/vexpress_ca9x4_defconfig              |  15 +
 drivers/i2c/Kconfig                           |   2 +-
 env/Kconfig                                   |   5 +-
 .../configs/{vexpress_common.h => vexpress.h} |  99 +--
 scripts/config_whitelist.txt                  |   1 -
 22 files changed, 2671 insertions(+), 89 deletions(-)
 create mode 100644 arch/arm/dts/vexpress-v2m-rs1.dtsi
 create mode 100644 arch/arm/dts/vexpress-v2m.dtsi
 create mode 100644 arch/arm/dts/vexpress-v2p-ca15_a7.dts
 create mode 100644 arch/arm/dts/vexpress-v2p-ca5s.dts
 create mode 100644 arch/arm/dts/vexpress-v2p-ca9.dts
 create mode 100644 board/armltd/vexpress/Kconfig
 create mode 100644 board/armltd/vexpress/MAINTAINERS
 create mode 100644 board/armltd/vexpress/Makefile
 create mode 100644 board/armltd/vexpress/vexpress_common.c
 create mode 100644 board/armltd/vexpress/vexpress_tc2.c
 create mode 100644 configs/vexpress_ca15_tc2_defconfig
 create mode 100644 configs/vexpress_ca5x2_defconfig
 create mode 100644 configs/vexpress_ca9x4_defconfig
 rename include/configs/{vexpress_common.h => vexpress.h} (62%)
.azure-pipelines.yml +6 -0
index 221e6008062..ddfbd606530 100644
@@ -195,6 +195,12 @@ jobs:
         evb_ast2500:
           TEST_PY_BD: "evb-ast2500"
           TEST_PY_ID: "--id qemu"
+        vexpress_ca15_tc2:
+          TEST_PY_BD: "vexpress_ca15_tc2"
+          TEST_PY_ID: "--id qemu"
+        vexpress_ca9x4:
+          TEST_PY_BD: "vexpress_ca9x4"
+          TEST_PY_ID: "--id qemu"
         integratorcp_cm926ejs:
           TEST_PY_BD: "integratorcp_cm926ejs"
           TEST_PY_ID: "--id qemu"
.gitlab-ci.yml +12 -0
index d072e833a3d..c6498e3b4fd 100644
@@ -205,6 +205,18 @@ sandbox_flattree test.py:
     TEST_PY_BD: "sandbox_flattree"
   <<: *buildman_and_testpy_dfn
 
+vexpress_ca15_tc2 test.py:
+  variables:
+    TEST_PY_BD: "vexpress_ca15_tc2"
+    TEST_PY_ID: "--id qemu"
+  <<: *buildman_and_testpy_dfn
+
+vexpress_ca9x4 test.py:
+  variables:
+    TEST_PY_BD: "vexpress_ca9x4"
+    TEST_PY_ID: "--id qemu"
+  <<: *buildman_and_testpy_dfn
+
 integratorcp_cm926ejs test.py:
   variables:
     TEST_PY_BD: "integratorcp_cm926ejs"
Kconfig +1 -1
index f8c1a77bedb..4d0673ad327 100644
@@ -189,7 +189,7 @@ config ENV_VARS_UBOOT_CONFIG
 
 config NR_DRAM_BANKS
 	int "Number of DRAM banks"
-	default 1 if ARCH_SUNXI || ARCH_OWL
+	default 1 if ARCH_SUNXI || ARCH_OWL || ARCH_VEXPRESS
 	default 4
 	help
 	  This defines the number of DRAM banks.
arch/arm/Kconfig +16 -0
index 0448787b8bc..3a94849e20e 100644
@@ -646,6 +646,21 @@ config ARCH_BCM6858
 	select OF_CONTROL
 	imply CMD_DM
 
+config ARCH_VEXPRESS
+	bool "Support Arm Ltd. Versatile Express (VExpress) family"
+	select CPU_V7A
+	select PL01X_SERIAL
+	select DM
+	select DM_SERIAL
+	select DM_ETH
+	select OF_CONTROL
+	select OF_SEPARATE
+	imply DISTRO_DEFAULTS
+	select MTD
+	select MTD_NOR_FLASH
+	select FLASH_CFI_DRIVER
+	imply CONS_INDEX_0
+
 config ARCH_BCMSTB
 	bool "Broadcom BCM7XXX family"
 	select CPU_V7A
@@ -1992,6 +2007,7 @@ source "board/Marvell/aspenite/Kconfig"
 source "board/Marvell/gplugd/Kconfig"
 source "board/Marvell/octeontx/Kconfig"
 source "board/Marvell/octeontx2/Kconfig"
+source "board/armltd/vexpress/Kconfig"
 source "board/armltd/vexpress64/Kconfig"
 source "board/cortina/presidio-asic/Kconfig"
 source "board/broadcom/bcm963158/Kconfig"
arch/arm/dts/Makefile +5 -0
index 9fb38682e61..69736b3ddbe 100644
@@ -1104,6 +1104,11 @@ dtb-$(CONFIG_TARGET_GE_BX50V3) += \
 dtb-$(CONFIG_TARGET_GE_B1X5V2) += imx6dl-b1x5v2.dtb
 dtb-$(CONFIG_TARGET_MX53PPD) += imx53-ppd.dtb
 
+dtb-$(CONFIG_ARCH_VEXPRESS) += \
+	vexpress-v2p-ca5s.dtb \
+	vexpress-v2p-ca9.dtb \
+	vexpress-v2p-ca15_a7.dtb
+
 dtb-$(CONFIG_TARGET_TOTAL_COMPUTE) += total_compute.dtb
 
 dtb-$(CONFIG_TARGET_DURIAN) += phytium-durian.dtb
arch/arm/dts/vexpress-v2m-rs1.dtsi new file +441 -0

441 lines not on this page · raw message

arch/arm/dts/vexpress-v2m.dtsi new file +454 -0

454 lines not on this page · raw message

arch/arm/dts/vexpress-v2p-ca15_a7.dts new file +691 -0

691 lines not on this page · raw message

arch/arm/dts/vexpress-v2p-ca5s.dts new file +280 -0

280 lines not on this page · raw message

arch/arm/dts/vexpress-v2p-ca9.dts new file +368 -0

368 lines not on this page · raw message

board/armltd/vexpress/Kconfig new file +39 -0
new file mode 100644
index 00000000000..009296e69c4
@@ -0,0 +1,39 @@
+if ARCH_VEXPRESS
+
+config SYS_BOARD
+	default "vexpress"
+
+config SYS_VENDOR
+	default "armltd"
+
+config SYS_CONFIG_NAME
+	default "vexpress"
+
+config VEXPRESS_EXTENDED_MEMORY_MAP
+	bool
+	default n
+
+choice
+        prompt "Arm VExpress coretile"
+
+config TARGET_VEXPRESS_CA15_TC2
+	bool "Arm Versatile Express TC2 (Cortex-A15/A7)"
+	select CPU_V7_HAS_NONSEC
+	select CPU_V7_HAS_VIRT
+	select VEXPRESS_EXTENDED_MEMORY_MAP
+	select OF_BOARD_SETUP
+
+config TARGET_VEXPRESS_CA5X2
+	bool "Arm Versatile Express Cortex-A5x2"
+	select VEXPRESS_EXTENDED_MEMORY_MAP
+
+config TARGET_VEXPRESS_CA9X4
+	bool "Arm Versatile Express Cortex-A9x4"
+
+endchoice
+
+config SYS_TEXT_BASE
+	default 0x80800000 if VEXPRESS_EXTENDED_MEMORY_MAP
+	default 0x60800000
+
+endif
board/armltd/vexpress/MAINTAINERS new file +8 -0
new file mode 100644
index 00000000000..7ccbea61f40
@@ -0,0 +1,8 @@
+VERSATILE EXPRESS BOARDS
+M:	Linus Walleij <[email protected]>
+S:	Maintained
+F:	board/armltd/vexpress/
+F:	include/configs/vexpress.h
+F:	configs/vexpress_ca15_tc2_defconfig
+F:	configs/vexpress_ca5x2_defconfig
+F:	configs/vexpress_ca9x4_defconfig
board/armltd/vexpress/Makefile new file +7 -0
new file mode 100644
index 00000000000..db14c43ad14
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# (C) Copyright 2000-2004
+# Wolfgang Denk, DENX Software Engineering, [email protected].
+
+obj-y	:= vexpress_common.o
+obj-$(CONFIG_CPU_V7_HAS_VIRT)	+= vexpress_tc2.o
board/armltd/vexpress/vexpress_common.c new file +196 -0

196 lines not on this page · raw message

board/armltd/vexpress/vexpress_tc2.c new file +82 -0

82 lines not on this page · raw message

configs/vexpress_ca15_tc2_defconfig new file +16 -0
new file mode 100644
index 00000000000..68dfc4573e7
@@ -0,0 +1,16 @@
+CONFIG_ARM=y
+CONFIG_ARCH_VEXPRESS=y
+CONFIG_DEFAULT_DEVICE_TREE="vexpress-v2p-ca15_a7"
+CONFIG_TARGET_VEXPRESS_CA15_TC2=y
+CONFIG_BOOTCOMMAND="run distro_bootcmd; run bootflash"
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_CMD_UBI=y
+CONFIG_ENV_OVERWRITE=y
+CONFIG_ENV_ADDR=0xFF80000
+# CONFIG_MMC is not set
+CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
+CONFIG_SYS_FLASH_PROTECTION=y
+CONFIG_SYS_FLASH_CFI=y
+CONFIG_SMC911X=y
+CONFIG_BAUDRATE=38400
+# CONFIG_EFI_LOADER is not set
configs/vexpress_ca5x2_defconfig new file +15 -0
new file mode 100644
index 00000000000..f5174b3dec3
@@ -0,0 +1,15 @@
+CONFIG_ARM=y
+CONFIG_ARCH_VEXPRESS=y
+CONFIG_DEFAULT_DEVICE_TREE="vexpress-v2p-ca5s"
+CONFIG_TARGET_VEXPRESS_CA5X2=y
+CONFIG_BOOTCOMMAND="run distro_bootcmd; run bootflash"
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_CMD_UBI=y
+CONFIG_ENV_OVERWRITE=y
+CONFIG_ENV_ADDR=0xFF80000
+# CONFIG_MMC is not set
+CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
+CONFIG_SYS_FLASH_PROTECTION=y
+CONFIG_SYS_FLASH_CFI=y
+CONFIG_SMC911X=y
+CONFIG_BAUDRATE=38400
configs/vexpress_ca9x4_defconfig new file +15 -0
new file mode 100644
index 00000000000..017bf4a2f0c
@@ -0,0 +1,15 @@
+CONFIG_ARM=y
+CONFIG_ARCH_VEXPRESS=y
+CONFIG_DEFAULT_DEVICE_TREE="vexpress-v2p-ca9"
+CONFIG_TARGET_VEXPRESS_CA9X4=y
+CONFIG_BOOTCOMMAND="run distro_bootcmd; run bootflash"
+# CONFIG_DISPLAY_CPUINFO is not set
+CONFIG_CMD_UBI=y
+CONFIG_ENV_OVERWRITE=y
+CONFIG_ENV_ADDR=0x47F80000
+# CONFIG_MMC is not set
+CONFIG_SYS_FLASH_USE_BUFFER_WRITE=y
+CONFIG_SYS_FLASH_PROTECTION=y
+CONFIG_SYS_FLASH_CFI=y
+CONFIG_SMC911X=y
+CONFIG_BAUDRATE=38400
drivers/i2c/Kconfig +1 -1
index 57a4efb88ed..1844941eb21 100644
@@ -479,7 +479,7 @@ config SYS_I2C_UNIPHIER_F
 
 config SYS_I2C_VERSATILE
 	bool "Arm Ltd Versatile I2C bus driver"
-	depends on DM_I2C && TARGET_VEXPRESS64_JUNO
+	depends on DM_I2C && (TARGET_VEXPRESS_CA15_TC2 || TARGET_VEXPRESS64_JUNO)
 	help
 	  Add support for the Arm Ltd Versatile Express I2C driver. The I2C host
 	  controller is present in the development boards manufactured by Arm Ltd.
env/Kconfig +3 -2
index 1411f9e815e..0203983b1d6 100644
@@ -80,7 +80,7 @@ config ENV_IS_IN_EXT4
 config ENV_IS_IN_FLASH
 	bool "Environment in flash memory"
 	depends on !CHAIN_OF_TRUST
-	default y if ARCH_CINTEGRATOR
+	default y if ARCH_CINTEGRATOR || ARCH_VEXPRESS
 	default y if ARCH_INTEGRATOR_CP
 	default y if M548x || M547x || M5282 || MCF547x_8x
 	default y if MCF532x || MCF52x2
@@ -564,6 +564,7 @@ config ENV_OFFSET_REDUND
 config ENV_SIZE
 	hex "Environment Size"
 	default 0x40000 if ENV_IS_IN_SPI_FLASH && ARCH_ZYNQMP
+	default 0x40000 if ARCH_VEXPRESS
 	default 0x20000 if ARCH_SUNXI || ARCH_ZYNQ || ARCH_OMAP2PLUS || ARCH_AT91
 	default 0x8000 if ARCH_ROCKCHIP && ENV_IS_IN_MMC
 	default 0x2000 if ARCH_ROCKCHIP && ENV_IS_IN_SPI_FLASH
@@ -577,7 +578,7 @@ config ENV_SECT_SIZE
 	hex "Environment Sector-Size"
 	depends on ENV_IS_IN_FLASH || ENV_IS_IN_SPI_FLASH
 	default 0x2000 if ARCH_ROCKCHIP
-	default 0x40000 if ARCH_ZYNQMP || ARCH_VERSAL
+	default 0x40000 if ARCH_ZYNQMP || ARCH_VERSAL || ARCH_VEXPRESS
 	default 0x20000 if ARCH_ZYNQ || ARCH_OMAP2PLUS || ARCH_AT91
 	default 0x20000 if MICROBLAZE && ENV_IS_IN_SPI_FLASH
 	help
include/configs/vexpress.h renamed from include/configs/vexpress_common.h +15 -84

170 lines not on this page · raw message

scripts/config_whitelist.txt +0 -1
index 3dbcc042a8a..befc4e5b2b2 100644
@@ -3827,7 +3827,6 @@ CONFIG_U_BOOT_HDR_SIZE
 CONFIG_VAL
 CONFIG_VAR_SIZE_SPL
 CONFIG_VERY_BIG_RAM
-CONFIG_VEXPRESS_ORIGINAL_MEMORY_MAP
 CONFIG_VIDEO_BCM2835
 CONFIG_VIDEO_BMP_LOGO
 CONFIG_VIDEO_DA8XX
Signature · 1 line
2.17.5
#1 lore raw
Quoted 41 lines · Andre Przywara

The v2021.07 merge window saw the removal of the Arm Ltd. Versatile Express platform, along with their CA5, CA9 and TC2 boards. The trigger was the missing conversion of the MMC driver.

Some folks complained about that internally, so bring those boards back, but better than ever:
- Use DM and OF_CONTROL for all the boards. Use the .dts files from the latest Linux kernel (5.13) for that.
- Move the board selection choice into the platform's Kconfig.
- Clean up some shared config and common definitions.
- Drop obsolete features like ATAGs support.
- Switch to the DM_ETH version of the SMC911X Ethernet driver.
- Drop MMC support.

The PL180 MMC driver actually supports DM_MMC, but that requires a DM_GPIO driver for the card detect GPIO, which we don't have. This specific GPIO is actually handled via the "sysregs" device, so we would need a driver for that. QEMU does not emulate this part, also the DT description is somewhat "special", so this is left for later.

This version compiles without any warning for all three boards now. Tested on QEMU.

---
Hi,

this relies on the SMC911x driver DT changes, as posted here:
https://lists.denx.de/pipermail/u-boot/2021-June/452989.html
I put a version with the changes broken down here:
https://github.com/Andre-ARM/u-boot/commits/tc2-history

This was tested on QEMU, for vexpress_ca15_tc2_defconfig with:

$ qemu-system-arm -M vexpress-a15,secure=on -cpu cortex-a15 -m 1G -smp 1 \
  -drive file=tramp-tc2.bin,if=pflash,format=raw,read-only \
  -device loader,file=u-boot.bin,addr=0x80800000 -nographic

Where tramp-tc2.bin is a trampoline replacing the board's firmware:
00000000 00 00 a0 e3 80 00 48 e3 10 ff 2f e1
(mov r0, #0; movt r0, #0x8080; bx r0)

Quoted 8 lines

The vexpress_ca9x4_defconfig uses a different memory map, so the runes are:

$ qemu-system-arm -M vexpress-a9 -cpu cortex-a9 -m 1G -smp 1 \
  -drive file=tramp-ca9.bin,if=pflash,format=raw,read-only \
  -device loader,file=u-boot.bin,addr=0x60800000 -nographic

tramp-ca9.bin:
00000000 00 00 a0 e3 80 00 46 e3 10 ff 2f e1
(mov r0, #0; movt r0, #0x6080; bx r0)

My big question is how do we run this in CI? Or does it not _need_ that firmware file to really exist? Or is there a pending change to
https://gitlab.denx.de/u-boot/u-boot-test-hooks.git to generate / just have exist those magic empty bins? Thanks!

Signature · 1 line
Tom
#2 lore raw
Quoted 48 lines · On Tue, 29 Jun 2021 08:11:22 -0400 Tom Rini <[email protected]> wrote:
Quoted 46 lines · Andre Przywara

The v2021.07 merge window saw the removal of the Arm Ltd. Versatile Express platform, along with their CA5, CA9 and TC2 boards. The trigger was the missing conversion of the MMC driver.

Some folks complained about that internally, so bring those boards back, but better than ever:
- Use DM and OF_CONTROL for all the boards. Use the .dts files from the latest Linux kernel (5.13) for that.
- Move the board selection choice into the platform's Kconfig.
- Clean up some shared config and common definitions.
- Drop obsolete features like ATAGs support.
- Switch to the DM_ETH version of the SMC911X Ethernet driver.
- Drop MMC support.

The PL180 MMC driver actually supports DM_MMC, but that requires a DM_GPIO driver for the card detect GPIO, which we don't have. This specific GPIO is actually handled via the "sysregs" device, so we would need a driver for that. QEMU does not emulate this part, also the DT description is somewhat "special", so this is left for later.

This version compiles without any warning for all three boards now. Tested on QEMU.

---
Hi,

this relies on the SMC911x driver DT changes, as posted here:
https://lists.denx.de/pipermail/u-boot/2021-June/452989.html
I put a version with the changes broken down here:
https://github.com/Andre-ARM/u-boot/commits/tc2-history

This was tested on QEMU, for vexpress_ca15_tc2_defconfig with:

$ qemu-system-arm -M vexpress-a15,secure=on -cpu cortex-a15 -m 1G -smp 1 \
  -drive file=tramp-tc2.bin,if=pflash,format=raw,read-only \
  -device loader,file=u-boot.bin,addr=0x80800000 -nographic

Where tramp-tc2.bin is a trampoline replacing the board's firmware:
00000000 00 00 a0 e3 80 00 48 e3 10 ff 2f e1
(mov r0, #0; movt r0, #0x8080; bx r0)

The vexpress_ca9x4_defconfig uses a different memory map, so the runes are:

$ qemu-system-arm -M vexpress-a9 -cpu cortex-a9 -m 1G -smp 1 \
  -drive file=tramp-ca9.bin,if=pflash,format=raw,read-only \
  -device loader,file=u-boot.bin,addr=0x60800000 -nographic
Quoted 8 lines
Quoted 3 lines

tramp-ca9.bin:
00000000 00 00 a0 e3 80 00 46 e3 10 ff 2f e1
(mov r0, #0; movt r0, #0x6080; bx r0)

My big question is how do we run this in CI? Or does it not _need_ that firmware file to really exist? Or is there a pending change to
https://gitlab.denx.de/u-boot/u-boot-test-hooks.git to generate / just have exist those magic empty bins? Thanks!

So from digging into this I see that this loads U-Boot's ELF build, via QEMU's -kernel parameter. Which is fine, but not really what is happening on real hardware.
I checked and the v2021.04 version worked with this approach, but my build does not.
I will have a look into this now.

Thanks!
Andre

#3 lore raw

On Tue, 29 Jun 2021 15:15:52 +0100
Andre Przywara <[email protected]> wrote:

Hi,

Quoted 60 lines
Quoted 48 lines · On Tue, 29 Jun 2021 08:11:22 -0400 Tom Rini <[email protected]> wrote:
Quoted 46 lines · Andre Przywara

The v2021.07 merge window saw the removal of the Arm Ltd. Versatile Express platform, along with their CA5, CA9 and TC2 boards. The trigger was the missing conversion of the MMC driver.

Some folks complained about that internally, so bring those boards back, but better than ever:
- Use DM and OF_CONTROL for all the boards. Use the .dts files from the latest Linux kernel (5.13) for that.
- Move the board selection choice into the platform's Kconfig.
- Clean up some shared config and common definitions.
- Drop obsolete features like ATAGs support.
- Switch to the DM_ETH version of the SMC911X Ethernet driver.
- Drop MMC support.

The PL180 MMC driver actually supports DM_MMC, but that requires a DM_GPIO driver for the card detect GPIO, which we don't have. This specific GPIO is actually handled via the "sysregs" device, so we would need a driver for that. QEMU does not emulate this part, also the DT description is somewhat "special", so this is left for later.

This version compiles without any warning for all three boards now. Tested on QEMU.

---
Hi,

this relies on the SMC911x driver DT changes, as posted here:
https://lists.denx.de/pipermail/u-boot/2021-June/452989.html
I put a version with the changes broken down here:
https://github.com/Andre-ARM/u-boot/commits/tc2-history

This was tested on QEMU, for vexpress_ca15_tc2_defconfig with:

$ qemu-system-arm -M vexpress-a15,secure=on -cpu cortex-a15 -m 1G -smp 1 \
  -drive file=tramp-tc2.bin,if=pflash,format=raw,read-only \
  -device loader,file=u-boot.bin,addr=0x80800000 -nographic

Where tramp-tc2.bin is a trampoline replacing the board's firmware:
00000000 00 00 a0 e3 80 00 48 e3 10 ff 2f e1
(mov r0, #0; movt r0, #0x8080; bx r0)

The vexpress_ca9x4_defconfig uses a different memory map, so the runes are:

$ qemu-system-arm -M vexpress-a9 -cpu cortex-a9 -m 1G -smp 1 \
  -drive file=tramp-ca9.bin,if=pflash,format=raw,read-only \
  -device loader,file=u-boot.bin,addr=0x60800000 -nographic
Quoted 8 lines
Quoted 3 lines

tramp-ca9.bin:
00000000 00 00 a0 e3 80 00 46 e3 10 ff 2f e1
(mov r0, #0; movt r0, #0x6080; bx r0)

My big question is how do we run this in CI? Or does it not _need_ that firmware file to really exist? Or is there a pending change to
https://gitlab.denx.de/u-boot/u-boot-test-hooks.git to generate / just have exist those magic empty bins? Thanks!

Quoted 6 lines

So from digging into this I see that this loads U-Boot's ELF build, via QEMU's -kernel parameter. Which is fine, but not really what is happening on real hardware.
I checked and the v2021.04 version worked with this approach, but my build does not.
I will have a look into this now.

The new build uses OF_CONTROL and OF_SEPARATE, so the DTB gets appended to the U-Boot *image*. The ELF file is not treated this way, so the code reads only 0s after the end of the U-Boot code - which makes it die silently. Manually loading the DTB into DRAM would be fragile at best, but is also rejected by QEMU, because the LOAD program header extend for a few dozen bytes beyond U-Boot's "end" symbol, so it overlaps.

IIRC we don't have position independent code for ARM, so we can't load U-Boot into flash directly (which also would require some code changes first).

Anyway I don't think we should change any code to cope with that (by using another method to find the DTB), so adjusting the QEMU recipe sounds like a better idea.

Is there a way to add those 12 byte trampoline files to the CI repo? Or shall they be created on the fly somehow?

Or can you think of another way to get those builds tested?

Cheers,
Andre

#4 lore raw
Quoted 72 lines · Andre Przywara

On Tue, 29 Jun 2021 15:15:52 +0100
Andre Przywara <[email protected]> wrote:

Hi,

Quoted 60 lines
Quoted 48 lines · On Tue, 29 Jun 2021 08:11:22 -0400 Tom Rini <[email protected]> wrote:
Quoted 46 lines · Andre Przywara

The v2021.07 merge window saw the removal of the Arm Ltd. Versatile Express platform, along with their CA5, CA9 and TC2 boards. The trigger was the missing conversion of the MMC driver.

Some folks complained about that internally, so bring those boards back, but better than ever:
- Use DM and OF_CONTROL for all the boards. Use the .dts files from the latest Linux kernel (5.13) for that.
- Move the board selection choice into the platform's Kconfig.
- Clean up some shared config and common definitions.
- Drop obsolete features like ATAGs support.
- Switch to the DM_ETH version of the SMC911X Ethernet driver.
- Drop MMC support.

The PL180 MMC driver actually supports DM_MMC, but that requires a DM_GPIO driver for the card detect GPIO, which we don't have. This specific GPIO is actually handled via the "sysregs" device, so we would need a driver for that. QEMU does not emulate this part, also the DT description is somewhat "special", so this is left for later.

This version compiles without any warning for all three boards now. Tested on QEMU.

---
Hi,

this relies on the SMC911x driver DT changes, as posted here:
https://lists.denx.de/pipermail/u-boot/2021-June/452989.html
I put a version with the changes broken down here:
https://github.com/Andre-ARM/u-boot/commits/tc2-history

This was tested on QEMU, for vexpress_ca15_tc2_defconfig with:

$ qemu-system-arm -M vexpress-a15,secure=on -cpu cortex-a15 -m 1G -smp 1 \
  -drive file=tramp-tc2.bin,if=pflash,format=raw,read-only \
  -device loader,file=u-boot.bin,addr=0x80800000 -nographic

Where tramp-tc2.bin is a trampoline replacing the board's firmware:
00000000 00 00 a0 e3 80 00 48 e3 10 ff 2f e1
(mov r0, #0; movt r0, #0x8080; bx r0)

The vexpress_ca9x4_defconfig uses a different memory map, so the runes are:

$ qemu-system-arm -M vexpress-a9 -cpu cortex-a9 -m 1G -smp 1 \
  -drive file=tramp-ca9.bin,if=pflash,format=raw,read-only \
  -device loader,file=u-boot.bin,addr=0x60800000 -nographic
Quoted 8 lines
Quoted 3 lines

tramp-ca9.bin:
00000000 00 00 a0 e3 80 00 46 e3 10 ff 2f e1
(mov r0, #0; movt r0, #0x6080; bx r0)

My big question is how do we run this in CI? Or does it not _need_ that firmware file to really exist? Or is there a pending change to
https://gitlab.denx.de/u-boot/u-boot-test-hooks.git to generate / just have exist those magic empty bins? Thanks!

Quoted 6 lines

So from digging into this I see that this loads U-Boot's ELF build, via QEMU's -kernel parameter. Which is fine, but not really what is happening on real hardware.
I checked and the v2021.04 version worked with this approach, but my build does not.
I will have a look into this now.

Quoted 7 lines

The new build uses OF_CONTROL and OF_SEPARATE, so the DTB gets appended to the U-Boot *image*. The ELF file is not treated this way, so the code reads only 0s after the end of the U-Boot code - which makes it die silently. Manually loading the DTB into DRAM would be fragile at best, but is also rejected by QEMU, because the LOAD program header extend for a few dozen bytes beyond U-Boot's "end" symbol, so it overlaps.

Can't we pass the device tree to qemu (and in turn through to U-Boot) in a clean and out of the box way? I thought there was a way to do that..

Quoted 3 lines

IIRC we don't have position independent code for ARM, so we can't load U-Boot into flash directly (which also would require some code changes first).

Do you mean generate a file to use as the system flash and have U-Boot be in the correct spot within that file? If so bin/travis-ci/conf.qemu_mips_na in the test hooks repo might give you some hints.

Quoted 6 lines

Anyway I don't think we should change any code to cope with that (by using another method to find the DTB), so adjusting the QEMU recipe sounds like a better idea.

Is there a way to add those 12 byte trampoline files to the CI repo? Or shall they be created on the fly somehow?

If we need to include the trampoline files, however it's easiest is fine.

Signature · 1 line
Tom
#5 lore raw

On Tue, 29 Jun 2021 14:03:23 -0400
Tom Rini <[email protected]> wrote:

Hi Tom,

Quoted 81 lines · Andre Przywara
Quoted 72 lines

On Tue, 29 Jun 2021 15:15:52 +0100
Andre Przywara <[email protected]> wrote:

Hi,

Quoted 60 lines
Quoted 48 lines · On Tue, 29 Jun 2021 08:11:22 -0400 Tom Rini <[email protected]> wrote:
Quoted 46 lines · Andre Przywara

The v2021.07 merge window saw the removal of the Arm Ltd. Versatile Express platform, along with their CA5, CA9 and TC2 boards. The trigger was the missing conversion of the MMC driver.

Some folks complained about that internally, so bring those boards back, but better than ever:
- Use DM and OF_CONTROL for all the boards. Use the .dts files from the latest Linux kernel (5.13) for that.
- Move the board selection choice into the platform's Kconfig.
- Clean up some shared config and common definitions.
- Drop obsolete features like ATAGs support.
- Switch to the DM_ETH version of the SMC911X Ethernet driver.
- Drop MMC support.

The PL180 MMC driver actually supports DM_MMC, but that requires a DM_GPIO driver for the card detect GPIO, which we don't have. This specific GPIO is actually handled via the "sysregs" device, so we would need a driver for that. QEMU does not emulate this part, also the DT description is somewhat "special", so this is left for later.

This version compiles without any warning for all three boards now. Tested on QEMU.

---
Hi,

this relies on the SMC911x driver DT changes, as posted here:
https://lists.denx.de/pipermail/u-boot/2021-June/452989.html
I put a version with the changes broken down here:
https://github.com/Andre-ARM/u-boot/commits/tc2-history

This was tested on QEMU, for vexpress_ca15_tc2_defconfig with:

$ qemu-system-arm -M vexpress-a15,secure=on -cpu cortex-a15 -m 1G -smp 1 \
  -drive file=tramp-tc2.bin,if=pflash,format=raw,read-only \
  -device loader,file=u-boot.bin,addr=0x80800000 -nographic

Where tramp-tc2.bin is a trampoline replacing the board's firmware:
00000000 00 00 a0 e3 80 00 48 e3 10 ff 2f e1
(mov r0, #0; movt r0, #0x8080; bx r0)

The vexpress_ca9x4_defconfig uses a different memory map, so the runes are:

$ qemu-system-arm -M vexpress-a9 -cpu cortex-a9 -m 1G -smp 1 \
  -drive file=tramp-ca9.bin,if=pflash,format=raw,read-only \
  -device loader,file=u-boot.bin,addr=0x60800000 -nographic
Quoted 8 lines
Quoted 3 lines

tramp-ca9.bin:
00000000 00 00 a0 e3 80 00 46 e3 10 ff 2f e1
(mov r0, #0; movt r0, #0x6080; bx r0)

My big question is how do we run this in CI? Or does it not _need_ that firmware file to really exist? Or is there a pending change to
https://gitlab.denx.de/u-boot/u-boot-test-hooks.git to generate / just have exist those magic empty bins? Thanks!

Quoted 6 lines

So from digging into this I see that this loads U-Boot's ELF build, via QEMU's -kernel parameter. Which is fine, but not really what is happening on real hardware.
I checked and the v2021.04 version worked with this approach, but my build does not.
I will have a look into this now.

Quoted 7 lines

The new build uses OF_CONTROL and OF_SEPARATE, so the DTB gets appended to the U-Boot *image*. The ELF file is not treated this way, so the code reads only 0s after the end of the U-Boot code - which makes it die silently. Manually loading the DTB into DRAM would be fragile at best, but is also rejected by QEMU, because the LOAD program header extend for a few dozen bytes beyond U-Boot's "end" symbol, so it overlaps.

Quoted 2 lines

Can't we pass the device tree to qemu (and in turn through to U-Boot) in a clean and out of the box way? I thought there was a way to do that..

QEMU has a -dtb command, to take a DTB file, and puts that at the beginning of DRAM (if possible). Also we could load the DTB from the (emulated) NOR flash, like we do for the Juno board.
But I think this is not the point: we don't really want this U-Boot port for the *QEMU* vexpress machine, but for the real hardware: and there is no DTB by default, not on the NOR flash, and certainly not in DRAM. The previous U-Boot port didn't need any DTBs at all, so we can't and shouldn't rely on any extra firmware provision. I think appending the DTBs to the U-Boot image is the right solution, so we get a self-contained U-Boot binary, acting as a drop-in replacement for the older port.
Running under QEMU should just be a some easy way of CI testing, not a goal in itself. Hence I'd rather adapt the CI than the code.

Quoted 8 lines
Quoted 3 lines

IIRC we don't have position independent code for ARM, so we can't load U-Boot into flash directly (which also would require some code changes first).

Do you mean generate a file to use as the system flash and have U-Boot be in the correct spot within that file? If so bin/travis-ci/conf.qemu_mips_na in the test hooks repo might give you some hints.

Well yes, this was what I was thinking about, but just for the trampoline. The actual firmware loads U-Boot into DRAM, so we have to provide that load address in DRAM when building the image. If we were position independent (like arm64 is), we could cover both cases with one build, but this is not the case for ARM, IIUC.

Quoted 9 lines
Quoted 6 lines

Anyway I don't think we should change any code to cope with that (by using another method to find the DTB), so adjusting the QEMU recipe sounds like a better idea.

Is there a way to add those 12 byte trampoline files to the CI repo? Or shall they be created on the fly somehow?

If we need to include the trampoline files, however it's easiest is fine.

So I can try to provide some recipe for travis-ci, based on what I see in the repo, but don't really know how to test this. I think I have a Travis-CI account, but would be glad about some hints or instructions how to test those u-boot-test-hooks bits easily.

Cheers,
Andre

#6 lore raw
Quoted 89 lines · Andre Przywara

On Tue, 29 Jun 2021 14:03:23 -0400
Tom Rini <[email protected]> wrote:

Hi Tom,

Quoted 81 lines · Andre Przywara
Quoted 72 lines

On Tue, 29 Jun 2021 15:15:52 +0100
Andre Przywara <[email protected]> wrote:

Hi,

Quoted 60 lines
Quoted 48 lines · On Tue, 29 Jun 2021 08:11:22 -0400 Tom Rini <[email protected]> wrote:
Quoted 46 lines · Andre Przywara

The v2021.07 merge window saw the removal of the Arm Ltd. Versatile Express platform, along with their CA5, CA9 and TC2 boards. The trigger was the missing conversion of the MMC driver.

Some folks complained about that internally, so bring those boards back, but better than ever:
- Use DM and OF_CONTROL for all the boards. Use the .dts files from the latest Linux kernel (5.13) for that.
- Move the board selection choice into the platform's Kconfig.
- Clean up some shared config and common definitions.
- Drop obsolete features like ATAGs support.
- Switch to the DM_ETH version of the SMC911X Ethernet driver.
- Drop MMC support.

The PL180 MMC driver actually supports DM_MMC, but that requires a DM_GPIO driver for the card detect GPIO, which we don't have. This specific GPIO is actually handled via the "sysregs" device, so we would need a driver for that. QEMU does not emulate this part, also the DT description is somewhat "special", so this is left for later.

This version compiles without any warning for all three boards now. Tested on QEMU.

---
Hi,

this relies on the SMC911x driver DT changes, as posted here:
https://lists.denx.de/pipermail/u-boot/2021-June/452989.html
I put a version with the changes broken down here:
https://github.com/Andre-ARM/u-boot/commits/tc2-history

This was tested on QEMU, for vexpress_ca15_tc2_defconfig with:

$ qemu-system-arm -M vexpress-a15,secure=on -cpu cortex-a15 -m 1G -smp 1 \
  -drive file=tramp-tc2.bin,if=pflash,format=raw,read-only \
  -device loader,file=u-boot.bin,addr=0x80800000 -nographic

Where tramp-tc2.bin is a trampoline replacing the board's firmware:
00000000 00 00 a0 e3 80 00 48 e3 10 ff 2f e1
(mov r0, #0; movt r0, #0x8080; bx r0)

The vexpress_ca9x4_defconfig uses a different memory map, so the runes are:

$ qemu-system-arm -M vexpress-a9 -cpu cortex-a9 -m 1G -smp 1 \
  -drive file=tramp-ca9.bin,if=pflash,format=raw,read-only \
  -device loader,file=u-boot.bin,addr=0x60800000 -nographic
Quoted 8 lines
Quoted 3 lines

tramp-ca9.bin:
00000000 00 00 a0 e3 80 00 46 e3 10 ff 2f e1
(mov r0, #0; movt r0, #0x6080; bx r0)

My big question is how do we run this in CI? Or does it not _need_ that firmware file to really exist? Or is there a pending change to
https://gitlab.denx.de/u-boot/u-boot-test-hooks.git to generate / just have exist those magic empty bins? Thanks!

Quoted 6 lines

So from digging into this I see that this loads U-Boot's ELF build, via QEMU's -kernel parameter. Which is fine, but not really what is happening on real hardware.
I checked and the v2021.04 version worked with this approach, but my build does not.
I will have a look into this now.

Quoted 7 lines

The new build uses OF_CONTROL and OF_SEPARATE, so the DTB gets appended to the U-Boot *image*. The ELF file is not treated this way, so the code reads only 0s after the end of the U-Boot code - which makes it die silently. Manually loading the DTB into DRAM would be fragile at best, but is also rejected by QEMU, because the LOAD program header extend for a few dozen bytes beyond U-Boot's "end" symbol, so it overlaps.

Quoted 2 lines

Can't we pass the device tree to qemu (and in turn through to U-Boot) in a clean and out of the box way? I thought there was a way to do that..

Quoted 13 lines

QEMU has a -dtb command, to take a DTB file, and puts that at the beginning of DRAM (if possible). Also we could load the DTB from the (emulated) NOR flash, like we do for the Juno board.
But I think this is not the point: we don't really want this U-Boot port for the *QEMU* vexpress machine, but for the real hardware: and there is no DTB by default, not on the NOR flash, and certainly not in DRAM. The previous U-Boot port didn't need any DTBs at all, so we can't and shouldn't rely on any extra firmware provision. I think appending the DTBs to the U-Boot image is the right solution, so we get a self-contained U-Boot binary, acting as a drop-in replacement for the older port.
Running under QEMU should just be a some easy way of CI testing, not a goal in itself. Hence I'd rather adapt the CI than the code.

Ah right, yes, we do want this to look / act as real HW like as possible.

Quoted 22 lines
Quoted 8 lines
Quoted 3 lines

IIRC we don't have position independent code for ARM, so we can't load U-Boot into flash directly (which also would require some code changes first).

Do you mean generate a file to use as the system flash and have U-Boot be in the correct spot within that file? If so bin/travis-ci/conf.qemu_mips_na in the test hooks repo might give you some hints.

Well yes, this was what I was thinking about, but just for the trampoline. The actual firmware loads U-Boot into DRAM, so we have to provide that load address in DRAM when building the image. If we were position independent (like arm64 is), we could cover both cases with one build, but this is not the case for ARM, IIUC.

Quoted 7 lines
Quoted 6 lines

Anyway I don't think we should change any code to cope with that (by using another method to find the DTB), so adjusting the QEMU recipe sounds like a better idea.

Is there a way to add those 12 byte trampoline files to the CI repo? Or shall they be created on the fly somehow?

Quoted 7 lines
Quoted 2 lines

If we need to include the trampoline files, however it's easiest is fine.

So I can try to provide some recipe for travis-ci, based on what I see in the repo, but don't really know how to test this. I think I have a Travis-CI account, but would be glad about some hints or instructions how to test those u-boot-test-hooks bits easily.

So, the travis-ci in the paths names is a relic of when we only had Travis-CI as the CI, rather than Azure/GitLab. In terms of testing, you can either push to the sunxi tree which I assume has CI jobs enabled, or a PR on GitHub against the u-boot tree there triggers an Azure run.

Signature · 1 line
Tom