topic: Use distro_boot for topic-miami boards

Adjust configuration and devicetree so the topic-miami board actually
boots.

Replace the custom scripting and just use distro_boot. Override the
standard zynq routines.

The board attempts to boot from SD card first, and falls back to booting
UBIFS from the QSPI NOR flash.

Signed-off-by: Mike Looijmans <mike.looijmans@topic.nl>
Link: https://lore.kernel.org/r/20250312153741.24007-2-mike.looijmans@topic.nl
Signed-off-by: Michal Simek <michal.simek@amd.com>
This commit is contained in:
Mike Looijmans
2025-03-12 16:36:32 +01:00
committed by Michal Simek
parent 43dfb55e22
commit 65f39ea20c
3 changed files with 94 additions and 86 deletions

View File

@@ -11,6 +11,10 @@
model = "Topic Miami Zynq Board"; model = "Topic Miami Zynq Board";
compatible = "topic,miami", "xlnx,zynq-7000"; compatible = "topic,miami", "xlnx,zynq-7000";
config {
u-boot,spl-payload-offset = <0x20000>;
};
aliases { aliases {
serial0 = &uart0; serial0 = &uart0;
spi0 = &qspi; spi0 = &qspi;
@@ -35,6 +39,7 @@
status = "okay"; status = "okay";
num-cs = <1>; num-cs = <1>;
flash@0 { flash@0 {
bootph-all;
compatible = "st,m25p80", "n25q256a", "jedec,spi-nor"; compatible = "st,m25p80", "n25q256a", "jedec,spi-nor";
m25p,fast-read; m25p,fast-read;
reg = <0x0>; reg = <0x0>;
@@ -44,24 +49,12 @@
#address-cells = <1>; #address-cells = <1>;
#size-cells = <1>; #size-cells = <1>;
partition@0 { partition@0 {
label = "qspi-u-boot-spl"; label = "qspi-boot-bin";
reg = <0x00000 0x10000>; reg = <0x00000 0x100000>;
}; };
partition@10000 { partition@100000 {
label = "qspi-u-boot-img";
reg = <0x10000 0x60000>;
};
partition@70000 {
label = "qspi-device-tree";
reg = <0x70000 0x10000>;
};
partition@80000 {
label = "qspi-linux";
reg = <0x80000 0x400000>;
};
partition@480000 {
label = "qspi-rootfs"; label = "qspi-rootfs";
reg = <0x480000 0x1b80000>; reg = <0x100000 0>;
}; };
}; };
}; };
@@ -74,6 +67,14 @@
&i2c1 { &i2c1 {
status = "okay"; status = "okay";
clock-frequency = <400000>; clock-frequency = <400000>;
/* GPIO expander */
gpioex: gpio@41 {
compatible = "nxp,pca9536";
reg = <0x41>;
gpio-line-names = "USB_RESET", "VTT_SHDWN_N", "V_PRESENT", "DEBUG_PRESENT";
gpio-controller;
#gpio-cells = <2>;
};
}; };
&clkc { &clkc {

View File

@@ -28,9 +28,9 @@ CONFIG_SYS_CUSTOM_LDSCRIPT=y
CONFIG_SYS_LDSCRIPT="arch/arm/mach-zynq/u-boot.lds" CONFIG_SYS_LDSCRIPT="arch/arm/mach-zynq/u-boot.lds"
CONFIG_DISTRO_DEFAULTS=y CONFIG_DISTRO_DEFAULTS=y
CONFIG_BOOTDELAY=0 CONFIG_BOOTDELAY=0
CONFIG_BOOTCOMMAND="if mmcinfo; then if fatload mmc 0 0x1900000 ${bootscript}; then source 0x1900000; fi; fi; run $modeboot"
CONFIG_USE_PREBOOT=y CONFIG_USE_PREBOOT=y
CONFIG_SYS_PBSIZE=2077 CONFIG_SYS_PBSIZE=2077
# CONFIG_BOARD_LATE_INIT is not set
CONFIG_CLOCKS=y CONFIG_CLOCKS=y
CONFIG_SPL_MAX_SIZE=0x30000 CONFIG_SPL_MAX_SIZE=0x30000
# CONFIG_SPL_SHARES_INIT_SP_ADDR is not set # CONFIG_SPL_SHARES_INIT_SP_ADDR is not set
@@ -41,15 +41,25 @@ CONFIG_SPL_SPI_LOAD=y
CONFIG_SYS_SPI_U_BOOT_OFFS=0x20000 CONFIG_SYS_SPI_U_BOOT_OFFS=0x20000
CONFIG_SYS_PROMPT="zynq-uboot> " CONFIG_SYS_PROMPT="zynq-uboot> "
CONFIG_SYS_MAXARGS=32 CONFIG_SYS_MAXARGS=32
# CONFIG_CMD_BOOTEFI is not set
# CONFIG_CMD_ELF is not set
# CONFIG_CMD_SPL is not set
CONFIG_CMD_THOR_DOWNLOAD=y CONFIG_CMD_THOR_DOWNLOAD=y
CONFIG_THOR_RESET_OFF=y CONFIG_THOR_RESET_OFF=y
# CONFIG_CMD_SAVEENV is not set
CONFIG_CMD_MEMTEST=y CONFIG_CMD_MEMTEST=y
CONFIG_CMD_DFU=y CONFIG_CMD_DFU=y
CONFIG_CMD_I2C=y CONFIG_CMD_I2C=y
CONFIG_CMD_MMC=y CONFIG_CMD_MMC=y
CONFIG_CMD_MTD=y
CONFIG_CMD_USB=y CONFIG_CMD_USB=y
# CONFIG_CMD_SETEXPR is not set # CONFIG_CMD_SETEXPR is not set
CONFIG_CMD_CACHE=y CONFIG_CMD_CACHE=y
# CONFIG_CMD_EFICONFIG is not set
CONFIG_CMD_SQUASHFS=y
CONFIG_MTDIDS_DEFAULT="nor0=spi0.0"
CONFIG_MTDPARTS_DEFAULT="mtdparts=spi0.0:0x100000(qspi-boot-bin),-(qspi-rootfs)"
CONFIG_CMD_UBI=y
CONFIG_OF_EMBED=y CONFIG_OF_EMBED=y
CONFIG_ENV_OVERWRITE=y CONFIG_ENV_OVERWRITE=y
CONFIG_SYS_RELOC_GD_ENV_ADDR=y CONFIG_SYS_RELOC_GD_ENV_ADDR=y
@@ -57,14 +67,18 @@ CONFIG_NO_NET=y
CONFIG_SPL_DM_SEQ_ALIAS=y CONFIG_SPL_DM_SEQ_ALIAS=y
CONFIG_DFU_RAM=y CONFIG_DFU_RAM=y
CONFIG_SYS_DFU_DATA_BUF_SIZE=0x600000 CONFIG_SYS_DFU_DATA_BUF_SIZE=0x600000
CONFIG_FPGA_XILINX=y CONFIG_DM_PCA953X=y
CONFIG_FPGA_ZYNQPL=y
CONFIG_DM_I2C=y CONFIG_DM_I2C=y
CONFIG_SYS_I2C_CADENCE=y CONFIG_SYS_I2C_CADENCE=y
CONFIG_MMC_SDHCI=y CONFIG_MMC_SDHCI=y
CONFIG_MMC_SDHCI_ZYNQ=y CONFIG_MMC_SDHCI_ZYNQ=y
CONFIG_DM_MTD=y
CONFIG_MTD_BLOCK=y
CONFIG_SPI_FLASH_STMICRO=y CONFIG_SPI_FLASH_STMICRO=y
# CONFIG_SPI_FLASH_USE_4K_SECTORS is not set # CONFIG_SPI_FLASH_USE_4K_SECTORS is not set
CONFIG_SPI_FLASH_MTD=y
CONFIG_MTD_UBI_BEB_LIMIT=0
CONFIG_UBI_BLOCK=y
CONFIG_DEBUG_UART_ZYNQ=y CONFIG_DEBUG_UART_ZYNQ=y
CONFIG_ARM_DCC=y CONFIG_ARM_DCC=y
CONFIG_ZYNQ_SERIAL=y CONFIG_ZYNQ_SERIAL=y
@@ -80,3 +94,4 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x0300
CONFIG_CI_UDC=y CONFIG_CI_UDC=y
CONFIG_USB_GADGET_DOWNLOAD=y CONFIG_USB_GADGET_DOWNLOAD=y
CONFIG_SYS_TIMER_COUNTS_DOWN=y CONFIG_SYS_TIMER_COUNTS_DOWN=y
CONFIG_LZ4=y

View File

@@ -9,75 +9,67 @@
#ifndef __CONFIG_TOPIC_MIAMI_H #ifndef __CONFIG_TOPIC_MIAMI_H
#define __CONFIG_TOPIC_MIAMI_H #define __CONFIG_TOPIC_MIAMI_H
/* Speed up boot time by ignoring the environment which we never used */ #ifndef CONFIG_XPL_BUILD
#ifdef CONFIG_CMD_MMC
#define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0)
#else
#define BOOT_TARGET_DEVICES_MMC(func)
#endif
#ifdef CONFIG_CMD_USB
#define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0)
#else
#define BOOT_TARGET_DEVICES_USB(func)
#endif
#if defined(CONFIG_ZYNQ_QSPI)
# define BOOT_TARGET_DEVICES_QSPI(func) func(QSPI, qspi, na)
#else
# define BOOT_TARGET_DEVICES_QSPI(func)
#endif
#ifdef CONFIG_CMD_UBIFS
# define BOOT_TARGET_DEVICES_UBIFS(func) func(UBIFS, ubifs, 0, qspi-rootfs, qspi-rootfs)
#else
# define BOOT_TARGET_DEVICES_UBIFS(func)
#endif
#define BOOTENV_DEV_QSPI(devtypeu, devtypel, instance) \
"bootcmd_qspi=sf probe && " \
"sf read ${scriptaddr} ${script_offset_f} ${script_size_f} && " \
"echo QSPI: Trying to boot script at ${scriptaddr} && " \
"source ${scriptaddr}; echo QSPI: SCRIPT FAILED: continuing...;\0"
#define BOOTENV_DEV_NAME_QSPI(devtypeu, devtypel, instance) \
"qspi "
#define BOOT_TARGET_DEVICES(func) \
BOOT_TARGET_DEVICES_MMC(func) \
BOOT_TARGET_DEVICES_UBIFS(func) \
BOOT_TARGET_DEVICES_QSPI(func)
#include <config_distro_bootcmd.h>
#endif /* CONFIG_XPL_BUILD */
/* Default environment */
#ifndef CFG_EXTRA_ENV_SETTINGS
#define CFG_EXTRA_ENV_SETTINGS \
"scriptaddr=0x3000000\0" \
"script_offset_f=0xf0000\0" \
"script_size_f=0x10000\0" \
"fdt_addr_r=0x1f00000\0" \
"pxefile_addr_r=0x2000000\0" \
"kernel_addr_r=0x2000000\0" \
"ramdisk_addr_r=0x3100000\0" \
BOOTENV
#endif
#include "zynq-common.h" #include "zynq-common.h"
/* Fixup settings */ /* Detect RAM size */
#define CFG_SYS_SDRAM_BASE 0
/* Setup proper boot sequences for Miami boards */ #define CFG_SYS_SDRAM_SIZE 0x40000000
#if defined(CONFIG_USB_HOST)
# define EXTRA_ENV_USB \
"usbreset=i2c dev 1 && i2c mw 41 1 ff && i2c mw 41 3 fe && "\
"i2c mw 41 1 fe && i2c mw 41 1 ff\0" \
"usbboot=run usbreset && if usb start; then " \
"echo Booting from USB... && " \
"if load usb 0 0x1900000 ${bootscript}; then "\
"source 0x1900000; fi; " \
"load usb 0 ${kernel_addr} ${kernel_image} && " \
"load usb 0 ${devicetree_addr} ${devicetree_image} && " \
"load usb 0 ${ramdisk_load_address} ${ramdisk_image} && " \
"bootm ${kernel_addr} ${ramdisk_load_address} "\
"${devicetree_addr}; " \
"fi\0"
/* Note that addresses here should match the addresses in the env */
# define DFU_ALT_INFO \
"dfu_alt_info=" \
"uImage ram 0x2080000 0x500000;" \
"devicetree.dtb ram 0x2000000 0x20000;" \
"uramdisk.image.gz ram 0x4000000 0x10000000\0" \
"dfu_ram=run usbreset && dfu 0 ram 0\0" \
"thor_ram=run usbreset && thordown 0 ram 0\0"
#else
# define EXTRA_ENV_USB
#endif
#undef CFG_EXTRA_ENV_SETTINGS
#define CFG_EXTRA_ENV_SETTINGS \
"kernel_image=uImage\0" \
"kernel_addr=0x2080000\0" \
"ramdisk_image=uramdisk.image.gz\0" \
"ramdisk_load_address=0x4000000\0" \
"devicetree_image=devicetree.dtb\0" \
"devicetree_addr=0x2000000\0" \
"bitstream_image=fpga.bin\0" \
"bootscript=autorun.scr\0" \
"loadbit_addr=0x100000\0" \
"loadbootenv_addr=0x2000000\0" \
"kernel_size=0x440000\0" \
"devicetree_size=0x10000\0" \
"boot_size=0xF00000\0" \
"fdt_high=0x20000000\0" \
"initrd_high=0x20000000\0" \
"mmc_loadbit=echo Loading bitstream from SD/MMC/eMMC to RAM.. && " \
"mmcinfo && " \
"load mmc 0 ${loadbit_addr} ${bitstream_image} && " \
"fpga load 0 ${loadbit_addr} ${filesize}\0" \
"qspiboot=echo Booting from QSPI flash... && " \
"sf probe && " \
"sf read ${devicetree_addr} 0xA0000 ${devicetree_size} && " \
"sf read ${kernel_addr} 0xC0000 ${kernel_size} && " \
"bootm ${kernel_addr} - ${devicetree_addr}\0" \
"sdboot=if mmcinfo; then " \
"setenv bootargs console=ttyPS0,115200 " \
"root=/dev/mmcblk0p2 rw rootfstype=ext4 " \
"rootwait quiet ; " \
"load mmc 0 ${kernel_addr} ${kernel_image}&& " \
"load mmc 0 ${devicetree_addr} ${devicetree_image}&& " \
"bootm ${kernel_addr} - ${devicetree_addr}; " \
"fi\0" \
EXTRA_ENV_USB \
DFU_ALT_INFO
#endif /* __CONFIG_TOPIC_MIAMI_H */ #endif /* __CONFIG_TOPIC_MIAMI_H */