Merge patch series "phycore-am62/4: Add more boot sources"
Daniel Schultz <d.schultz@phytec.de> says:
This patch stack extends the phyCORE-AM62x/AM64x U-Boot by following boot
sources:
- Load U-Boot with USB DFU
- Load a Linux and initramfs from OSPI/QSPI NOR flash
- Load a Linux and rootfs from Network
Moreover, it adds required changes to the environment to boot an A/B
system with RAUC and includes some minor fixes.
diff --git a/board/phytec/phycore_am62x/MAINTAINERS b/board/phytec/phycore_am62x/MAINTAINERS
index 42463ad..670c747 100644
--- a/board/phytec/phycore_am62x/MAINTAINERS
+++ b/board/phytec/phycore_am62x/MAINTAINERS
@@ -9,6 +9,7 @@
F: board/phytec/phycore_am62x/
F: configs/phycore_am62x_a53_defconfig
F: configs/phycore_am62x_r5_defconfig
+F: configs/phycore_am62x_r5_usbdfu_defconfig
F: include/configs/phycore_am62x.h
F: doc/board/phytec/phycore-am62x.rst
F: board/phytec/common/k3
diff --git a/board/phytec/phycore_am62x/phycore_am62x.env b/board/phytec/phycore_am62x/phycore_am62x.env
index 046bbd2..711ca30 100644
--- a/board/phytec/phycore_am62x/phycore_am62x.env
+++ b/board/phytec/phycore_am62x/phycore_am62x.env
@@ -1,5 +1,7 @@
#include <env/ti/k3_dfu.env>
#include <env/phytec/k3_mmc.env>
+#include <env/phytec/k3_net.env>
+#include <env/phytec/k3_spi.env>
fdtaddr=0x88000000
loadaddr=0x82000000
@@ -15,3 +17,9 @@
mmcpart=1
console=ttyS2,115200n8
earlycon=ns16550a,mmio32,0x02800000
+
+get_cmd=tftp
+
+spi_fdt_addr=0x700000
+spi_image_addr=0x800000
+spi_ramdisk_addr=0x1e00000
diff --git a/board/phytec/phycore_am64x/phycore_am64x.env b/board/phytec/phycore_am64x/phycore_am64x.env
index 18f0fa5..3032b51 100644
--- a/board/phytec/phycore_am64x/phycore_am64x.env
+++ b/board/phytec/phycore_am64x/phycore_am64x.env
@@ -1,4 +1,6 @@
#include <env/phytec/k3_mmc.env>
+#include <env/phytec/k3_net.env>
+#include <env/phytec/k3_spi.env>
fdtaddr=0x88000000
loadaddr=0x82000000
@@ -14,3 +16,9 @@
mmcpart=1
console=ttyS2,115200n8
earlycon=ns16550a,mmio32,0x02800000
+
+get_cmd=tftp
+
+spi_fdt_addr=0x700000
+spi_image_addr=0x800000
+spi_ramdisk_addr=0x1e00000
diff --git a/configs/phycore_am62x_a53_defconfig b/configs/phycore_am62x_a53_defconfig
index d8b129f..67f89e0 100644
--- a/configs/phycore_am62x_a53_defconfig
+++ b/configs/phycore_am62x_a53_defconfig
@@ -12,7 +12,7 @@
CONFIG_HAS_CUSTOM_SYS_INIT_SP_ADDR=y
CONFIG_CUSTOM_SYS_INIT_SP_ADDR=0x80b80000
CONFIG_SF_DEFAULT_SPEED=25000000
-CONFIG_ENV_SIZE=0x2000
+CONFIG_ENV_SIZE=0x20000
CONFIG_ENV_OFFSET=0x680000
CONFIG_SPL_DM_SPI=y
CONFIG_DEFAULT_DEVICE_TREE="ti/k3-am625-phyboard-lyra-rdk"
@@ -40,7 +40,7 @@
CONFIG_BOOTSTD_FULL=y
CONFIG_SYS_BOOTM_LEN=0x800000
CONFIG_OF_BOARD_SETUP=y
-CONFIG_BOOTCOMMAND="run mmcboot; bootflow scan -lb"
+CONFIG_BOOTCOMMAND="run ${boot}boot; bootflow scan -lb"
CONFIG_DEFAULT_FDT_FILE="oftree"
CONFIG_BOARD_LATE_INIT=y
CONFIG_SPL_MAX_SIZE=0x58000
@@ -93,7 +93,7 @@
CONFIG_CLK_TI_SCI=y
CONFIG_DFU_MMC=y
CONFIG_DFU_RAM=y
-CONFIG_SYS_DFU_DATA_BUF_SIZE=0x5000
+CONFIG_SYS_DFU_DATA_BUF_SIZE=0x40000
CONFIG_SYS_DFU_MAX_FILE_SIZE=0x800000
CONFIG_DMA_CHANNELS=y
CONFIG_TI_K3_NAVSS_UDMA=y
@@ -152,7 +152,7 @@
CONFIG_USB_DWC3_AM62=y
CONFIG_USB_GADGET=y
CONFIG_SPL_USB_GADGET=y
-CONFIG_USB_GADGET_MANUFACTURER="Phytec"
+CONFIG_USB_GADGET_MANUFACTURER="PHYTEC"
CONFIG_USB_GADGET_VENDOR_NUM=0x0451
CONFIG_USB_GADGET_PRODUCT_NUM=0x6165
CONFIG_USB_GADGET_DOWNLOAD=y
diff --git a/configs/phycore_am62x_r5_usbdfu_defconfig b/configs/phycore_am62x_r5_usbdfu_defconfig
new file mode 100644
index 0000000..ff17a29
--- /dev/null
+++ b/configs/phycore_am62x_r5_usbdfu_defconfig
@@ -0,0 +1,9 @@
+#include <configs/phycore_am62x_r5_defconfig>
+#include <configs/am62x_r5_usbdfu.config>
+
+CONFIG_ARM=y
+CONFIG_ARCH_K3=y
+CONFIG_SOC_K3_AM625=y
+CONFIG_TARGET_PHYCORE_AM62X_R5=y
+
+CONFIG_USB_GADGET_MANUFACTURER="PHYTEC"
diff --git a/configs/phycore_am64x_a53_defconfig b/configs/phycore_am64x_a53_defconfig
index 5cf24b9..3bfe876 100644
--- a/configs/phycore_am64x_a53_defconfig
+++ b/configs/phycore_am64x_a53_defconfig
@@ -37,7 +37,8 @@
CONFIG_SPL_LOAD_FIT=y
CONFIG_SPL_LOAD_FIT_ADDRESS=0x81000000
CONFIG_BOOTSTD_FULL=y
-CONFIG_BOOTCOMMAND="run mmcboot; bootflow scan -lb"
+CONFIG_OF_BOARD_SETUP=y
+CONFIG_BOOTCOMMAND="run ${boot}boot; bootflow scan -lb"
CONFIG_DEFAULT_FDT_FILE="oftree"
CONFIG_BOARD_LATE_INIT=y
CONFIG_SPL_MAX_SIZE=0x180000
diff --git a/include/env/phytec/k3_mmc.env b/include/env/phytec/k3_mmc.env
index 3d3595c..ad8d3a8 100644
--- a/include/env/phytec/k3_mmc.env
+++ b/include/env/phytec/k3_mmc.env
@@ -7,15 +7,17 @@
/* Logic for TI K3 based SoCs to boot from a MMC device. */
#include <env/phytec/overlays.env>
+#include <env/phytec/rauc.env>
mmcargs=setenv bootargs console=${console} earlycon=${earlycon}
- root=/dev/mmcblk${mmcdev}p${mmcroot} rootwait rw
-loadimage=load mmc ${mmcdev}:${mmcpart} ${loadaddr} Image
-loadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr_r} ${fdtfile}
-mmcboot=run mmcargs;
+ root=/dev/mmcblk${mmcdev}p${mmcroot} ${raucargs} rootwait rw
+mmcloadimage=load mmc ${mmcdev}:${mmcpart} ${kernel_addr_r} Image
+mmcloadfdt=load mmc ${mmcdev}:${mmcpart} ${fdt_addr_r} ${fdtfile}
+mmcboot=if test ${doraucboot} = 1; then run raucinit; fi;
+ run mmcargs;
mmc dev ${mmcdev};
mmc rescan;
- run loadimage;
- run loadfdt;
+ run mmcloadimage;
+ run mmcloadfdt;
run mmc_apply_overlays;
- booti ${loadaddr} - ${fdt_addr_r}
+ booti ${kernel_addr_r} - ${fdt_addr_r}
diff --git a/include/env/phytec/k3_net.env b/include/env/phytec/k3_net.env
new file mode 100644
index 0000000..377e406
--- /dev/null
+++ b/include/env/phytec/k3_net.env
@@ -0,0 +1,22 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2024 PHYTEC Messtechnik GmbH
+ * Author: Daniel Schultz <d.schultz@phytec.de>
+ */
+
+/* Logic for TI K3 based SoCs to boot via network. */
+
+#include <env/phytec/overlays.env>
+
+netargs=setenv bootargs console=${console} root=/dev/nfs ip=dhcp rw
+ nfsroot=${serverip}:${nfsroot},vers=4,tcp
+netloadimage=${net_fetch_cmd} ${kernel_addr_r} ${serverip}:/Image
+netloadfdt=${net_fetch_cmd} ${fdt_addr_r} ${serverip}:/${fdtfile}
+netboot=run netargs;
+ setenv autoload no;
+ dhcp;
+ run netloadimage;
+ run netloadfdt;
+ run net_apply_overlays;
+ run net_apply_extensions;
+ booti ${kernel_addr_r} - ${fdt_addr_r}
diff --git a/include/env/phytec/k3_spi.env b/include/env/phytec/k3_spi.env
new file mode 100644
index 0000000..97d3a15
--- /dev/null
+++ b/include/env/phytec/k3_spi.env
@@ -0,0 +1,18 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * Copyright (C) 2024 PHYTEC Messtechnik GmbH
+ * Author: Daniel Schultz <d.schultz@phytec.de>
+ */
+
+/* Logic for TI K3 based SoCs to boot from an OSPI/QSPI NOR flash. */
+
+spiargs=setenv bootargs console=${console} earlycon=${earlycon}
+spiloadimage=sf read ${kernel_addr_r} ${spi_image_addr} ${size_kern}
+spiloadfdt=sf read ${fdt_addr_r} ${spi_fdt_addr} ${size_fdt}
+spiloadramdisk=sf read ${ramdisk_addr_r} ${spi_ramdisk_addr} ${size_fs}
+spiboot=run spiargs;
+ sf probe;
+ run spiloadimage;
+ run spiloadfdt;
+ run spiloadramdisk;
+ booti ${kernel_addr_r} ${ramdisk_addr_r}:0x${size_fs} ${fdt_addr_r}