From 926a72ba0438806a341cfe3a90683bc02d904e55 Mon Sep 17 00:00:00 2001 From: Prasad Kummari Date: Wed, 19 Feb 2025 17:23:01 +0530 Subject: xilinx: versal: add firmware access to CRP Boot mode register Added extended support for retrieving the boot mode register via the firmware interface, which is preferred when U-Boot runs in EL2 and cannot directly access CRP registers via raw reads. Ideally, all secure registers should be accessed via xilinx_pm_request(). Introduced the secure zynqmp_pm_get_bootmode_reg() call, which uses xilinx_pm_request() to read the boot mode register. When CONFIG_ZYNQMP_FIRMWARE is enabled, the secure zynqmp_pm_get_bootmode_reg() call is used; otherwise, direct raw reads are performed in the case of mini U-Boot. Signed-off-by: Prasad Kummari Link: https://lore.kernel.org/r/20250219115301.3661036-1-prasad.kummari@amd.com Signed-off-by: Michal Simek --- include/zynqmp_firmware.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/zynqmp_firmware.h b/include/zynqmp_firmware.h index 73198a6a6ea..e7275f72fac 100644 --- a/include/zynqmp_firmware.h +++ b/include/zynqmp_firmware.h @@ -457,6 +457,7 @@ int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id); int zynqmp_mmio_read(const u32 address, u32 *value); int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 value); int zynqmp_pm_feature(const u32 api_id); +u32 zynqmp_pm_get_bootmode_reg(void); /* Type of Config Object */ #define PM_CONFIG_OBJECT_TYPE_BASE 0x1U @@ -500,4 +501,7 @@ struct zynqmp_ipi_msg { u32 *buf; }; +#define CRP_BOOT_MODE_REG_NODE 0x30000001 +#define CRP_BOOT_MODE_REG_OFFSET 0x200 + #endif /* _ZYNQMP_FIRMWARE_H_ */ -- cgit v1.2.3 From 5ffab6ee1279fe86ab21b529a04b1638a6664eaf Mon Sep 17 00:00:00 2001 From: Prasad Kummari Date: Wed, 5 Mar 2025 19:18:46 +0530 Subject: xilinx: versal: add firmware access to PMC multi Boot mode register Added extended support for retrieving the PMC muti boot mode register via the firmware interface, which is preferred when U-Boot runs in EL2 and cannot directly access PMC registers via raw reads. Ideally, all secure registers should be accessed via xilinx_pm_request(). Introduced the secure zynqmp_pm_get_pmc_multi_boot_reg() call, which uses xilinx_pm_request() to read the PMC multi boot mode register. BootROM increments the MultiBoot register (PMC_MULTI_BOOT) read address offset by 32 KB and retries. For SD and eMMC boot modes, it can search up to 8191 FAT files for the identification string. A 13-bit mask (0x1FFF) is applied to PMC_MULTI_BOOT_MASK to obtain the correct values in BootROM. Signed-off-by: Prasad Kummari Link: https://lore.kernel.org/r/20250305134845.3182193-1-prasad.kummari@amd.com Signed-off-by: Michal Simek --- include/zynqmp_firmware.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/zynqmp_firmware.h b/include/zynqmp_firmware.h index e7275f72fac..82781dfd16b 100644 --- a/include/zynqmp_firmware.h +++ b/include/zynqmp_firmware.h @@ -458,6 +458,7 @@ int zynqmp_mmio_read(const u32 address, u32 *value); int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 value); int zynqmp_pm_feature(const u32 api_id); u32 zynqmp_pm_get_bootmode_reg(void); +u32 zynqmp_pm_get_pmc_multi_boot_reg(void); /* Type of Config Object */ #define PM_CONFIG_OBJECT_TYPE_BASE 0x1U @@ -504,4 +505,7 @@ struct zynqmp_ipi_msg { #define CRP_BOOT_MODE_REG_NODE 0x30000001 #define CRP_BOOT_MODE_REG_OFFSET 0x200 +#define PM_REG_PMC_GLOBAL_NODE 0x30000004 +#define PMC_MULTI_BOOT_MODE_REG_OFFSET 0x4 + #endif /* _ZYNQMP_FIRMWARE_H_ */ -- cgit v1.2.3 From 43dfb55e2228aafe55db121fd24b4b1e46e56d03 Mon Sep 17 00:00:00 2001 From: Mike Looijmans Date: Wed, 12 Mar 2025 16:36:31 +0100 Subject: xilinx: Allow alternative boot strategies in zynq-common.h Allow config headers that include zynq-common.h to provide their own (distro) boot strategies. This is implemented by skipping the section when BOOT_ENV has already been defined. Signed-off-by: Mike Looijmans Link: https://lore.kernel.org/r/20250312153741.24007-1-mike.looijmans@topic.nl Signed-off-by: Michal Simek --- include/configs/zynq-common.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/configs/zynq-common.h b/include/configs/zynq-common.h index 93ae5891a07..94273d0deb9 100644 --- a/include/configs/zynq-common.h +++ b/include/configs/zynq-common.h @@ -46,7 +46,10 @@ #ifdef CONFIG_XPL_BUILD #define BOOTENV -#else +#endif + +/* Only use this section if no BOOTENV has been configured yet */ +#ifndef BOOTENV #ifdef CONFIG_CMD_MMC #define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) func(MMC, mmc, 1) @@ -167,7 +170,8 @@ BOOT_TARGET_DEVICES_DHCP(func) #include -#endif /* CONFIG_XPL_BUILD */ + +#endif /* BOOTENV */ /* Default environment */ #ifndef CFG_EXTRA_ENV_SETTINGS -- cgit v1.2.3 From 65f39ea20cde0b7e3d3018245c34f10896ed6085 Mon Sep 17 00:00:00 2001 From: Mike Looijmans Date: Wed, 12 Mar 2025 16:36:32 +0100 Subject: 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 Link: https://lore.kernel.org/r/20250312153741.24007-2-mike.looijmans@topic.nl Signed-off-by: Michal Simek --- include/configs/topic_miami.h | 116 ++++++++++++++++++++---------------------- 1 file changed, 54 insertions(+), 62 deletions(-) (limited to 'include') diff --git a/include/configs/topic_miami.h b/include/configs/topic_miami.h index 06276175455..5530d36339c 100644 --- a/include/configs/topic_miami.h +++ b/include/configs/topic_miami.h @@ -9,75 +9,67 @@ #ifndef __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 -#include "zynq-common.h" +#ifdef CONFIG_CMD_MMC +#define BOOT_TARGET_DEVICES_MMC(func) func(MMC, mmc, 0) +#else +#define BOOT_TARGET_DEVICES_MMC(func) +#endif -/* Fixup settings */ +#ifdef CONFIG_CMD_USB +#define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0) +#else +#define BOOT_TARGET_DEVICES_USB(func) +#endif -/* Setup proper boot sequences for Miami boards */ +#if defined(CONFIG_ZYNQ_QSPI) +# define BOOT_TARGET_DEVICES_QSPI(func) func(QSPI, qspi, na) +#else +# define BOOT_TARGET_DEVICES_QSPI(func) +#endif -#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" +#ifdef CONFIG_CMD_UBIFS +# define BOOT_TARGET_DEVICES_UBIFS(func) func(UBIFS, ubifs, 0, qspi-rootfs, qspi-rootfs) #else -# define EXTRA_ENV_USB +# define BOOT_TARGET_DEVICES_UBIFS(func) #endif -#undef CFG_EXTRA_ENV_SETTINGS +#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 + +#endif /* CONFIG_XPL_BUILD */ + +/* Default environment */ +#ifndef 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 + "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" + +/* Detect RAM size */ +#define CFG_SYS_SDRAM_BASE 0 +#define CFG_SYS_SDRAM_SIZE 0x40000000 #endif /* __CONFIG_TOPIC_MIAMI_H */ -- cgit v1.2.3 From 5b8d6dcf7ce1b9629cec02e8d17db530776de5b4 Mon Sep 17 00:00:00 2001 From: Venkatesh Yadav Abbarapu Date: Thu, 20 Mar 2025 10:13:24 +0100 Subject: ufs: amd-versal2: Use raw read/write for SLCR/CACHE registers Update the firmware driver UFS APIs zynqmp_pm_ufs_* to directly read/write to the pmc_iou_slcr and efuse_cache registers. Replace these raw reads/writes with the xilinx_pm_request() API with the correct arguments once the PM related changes are done. Signed-off-by: Venkatesh Yadav Abbarapu Signed-off-by: Michal Simek Link: https://lore.kernel.org/r/ee2d1ad2e07e96f1948ab6ffe8f3c50a3b8f9be9.1742462001.git.michal.simek@amd.com --- include/zynqmp_firmware.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/zynqmp_firmware.h b/include/zynqmp_firmware.h index 82781dfd16b..dc06abc52fc 100644 --- a/include/zynqmp_firmware.h +++ b/include/zynqmp_firmware.h @@ -458,6 +458,10 @@ int zynqmp_mmio_read(const u32 address, u32 *value); int zynqmp_mmio_write(const u32 address, const u32 mask, const u32 value); int zynqmp_pm_feature(const u32 api_id); u32 zynqmp_pm_get_bootmode_reg(void); +int zynqmp_pm_ufs_get_txrx_cfgrdy(u32 *value); +int zynqmp_pm_ufs_sram_csr_read(u32 *value); +int zynqmp_pm_ufs_sram_csr_write(u32 *value); +int zynqmp_pm_ufs_cal_reg(u32 *value); u32 zynqmp_pm_get_pmc_multi_boot_reg(void); /* Type of Config Object */ -- cgit v1.2.3 From c2db55499a5d460f33d649728853ca3b69d0c754 Mon Sep 17 00:00:00 2001 From: Prasad Kummari Date: Thu, 27 Mar 2025 16:21:58 +0530 Subject: arm64: versal-net: Add PL bit stream load support Add support for loading the secure & non-secure pdi images and PL bitstream on the Versal NET platform. The FPGA driver is enabled to load the bitstream in PDI format on the AMD Versal NET device. PDI is the new programmable device image format for Versal NET, and the bitstream for the Versal NET platform is generated exclusively in this format. The source code for the versalnet loadpdi command and the CONFIG_CMD_VERSAL_NET configuration has been removed. It now utilizes the fpga load
command to load secure & non-secure pdi images. Signed-off-by: Prasad Kummari Link: https://lore.kernel.org/r/20250327105200.1262615-2-prasad.kummari@amd.com Signed-off-by: Michal Simek --- include/xilinx.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/xilinx.h b/include/xilinx.h index e4e29797988..2b4d6c9bb06 100644 --- a/include/xilinx.h +++ b/include/xilinx.h @@ -34,6 +34,7 @@ typedef enum { /* typedef xilinx_family */ xilinx_zynq, /* Zynq Family */ xilinx_zynqmp, /* ZynqMP Family */ xilinx_versal, /* Versal Family */ + xilinx_versal_net, /* Versal NET Family */ max_xilinx_type /* insert all new types before this */ } xilinx_family; /* end, typedef xilinx_family */ -- cgit v1.2.3 From 44a26da8d91b72746b364d414adf5092143f826f Mon Sep 17 00:00:00 2001 From: Prasad Kummari Date: Thu, 27 Mar 2025 16:21:59 +0530 Subject: arm64: versal2: Add PL bit stream load support Add support for loading the secure & non-secure pdi images and PL bitstream on the Versal Gen2 platform. The FPGA driver is enabled to load the bitstream in PDI format on the AMD Versal Gen2 device. PDI is the new programmable device image format for Versal Gen2, and the bitstream for the Versal Gen2 platform is generated exclusively in this format. With the enhanced SMC format in TF-A ensuring transparent payload forwarding for Versal Gen2, the u-boot driver must now handle the word swapping of PDI address that was previously done in TF-A for this API. The source code for the Versal2 loadpdi command and the CONFIG_CMD_VERSAL2 configuration has been removed. It now utilizes the fpga load
command to load secure & non-secure pdi images. Signed-off-by: Prasad Kummari Link: https://lore.kernel.org/r/20250327105200.1262615-3-prasad.kummari@amd.com Signed-off-by: Michal Simek --- include/xilinx.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include') diff --git a/include/xilinx.h b/include/xilinx.h index 2b4d6c9bb06..c54d6dc1453 100644 --- a/include/xilinx.h +++ b/include/xilinx.h @@ -35,6 +35,7 @@ typedef enum { /* typedef xilinx_family */ xilinx_zynqmp, /* ZynqMP Family */ xilinx_versal, /* Versal Family */ xilinx_versal_net, /* Versal NET Family */ + xilinx_versal2, /* Versal Gen 2 Family */ max_xilinx_type /* insert all new types before this */ } xilinx_family; /* end, typedef xilinx_family */ -- cgit v1.2.3 From caf5775fdb08d8c8b749eb25a164c1fa89a2f108 Mon Sep 17 00:00:00 2001 From: Venkatesh Yadav Abbarapu Date: Thu, 10 Apr 2025 10:30:54 +0200 Subject: arm64: versal2: Add ufs distro boot command Adding support for the ufs distro boot command. Signed-off-by: Venkatesh Yadav Abbarapu Signed-off-by: Michal Simek Link: https://lore.kernel.org/r/c0e6737ae4119963afc8ea19b49b998a013d06c4.1744273853.git.michal.simek@amd.com --- include/configs/amd_versal2.h | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include') diff --git a/include/configs/amd_versal2.h b/include/configs/amd_versal2.h index 6a40bbdf3a7..e937375ca6e 100644 --- a/include/configs/amd_versal2.h +++ b/include/configs/amd_versal2.h @@ -105,6 +105,14 @@ #define BOOTENV_DEV_NAME_JTAG(devtypeu, devtypel, instance) \ "jtag " +#define BOOT_TARGET_DEVICES_UFS(func) func(UFS, ufs, 0) + +#define BOOTENV_DEV_UFS(devtypeu, devtypel, instance) \ + "bootcmd_" #devtypel "=" #devtypel " init " #instance "; scsi scan;\0" + +#define BOOTENV_DEV_NAME_UFS(devtypeu, devtypel, instance) \ + "ufs " + #define BOOT_TARGET_DEVICES_DFU_USB(func) func(DFU_USB, dfu_usb, 0) #define BOOTENV_DEV_DFU_USB(devtypeu, devtypel, instance) \ @@ -120,6 +128,7 @@ #define BOOT_TARGET_DEVICES(func) \ BOOT_TARGET_DEVICES_JTAG(func) \ BOOT_TARGET_DEVICES_MMC(func) \ + BOOT_TARGET_DEVICES_UFS(func) \ BOOT_TARGET_DEVICES_XSPI(func) \ BOOT_TARGET_DEVICES_DFU_USB(func) \ BOOT_TARGET_DEVICES_PXE(func) \ -- cgit v1.2.3 From b735c6c5f66acbaf67a4ff2903c660cced410ec3 Mon Sep 17 00:00:00 2001 From: Venkatesh Yadav Abbarapu Date: Thu, 10 Apr 2025 10:30:55 +0200 Subject: arm64: versal2: Add usb distro boot command Adding support for the usb distro boot command. Signed-off-by: Venkatesh Yadav Abbarapu Signed-off-by: Michal Simek Link: https://lore.kernel.org/r/121b6879efde0b83d3933852442895631c4cb24f.1744273853.git.michal.simek@amd.com --- include/configs/amd_versal2.h | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'include') diff --git a/include/configs/amd_versal2.h b/include/configs/amd_versal2.h index e937375ca6e..1ade6adfa0b 100644 --- a/include/configs/amd_versal2.h +++ b/include/configs/amd_versal2.h @@ -125,12 +125,19 @@ #define BOOTENV_DEV_NAME_DFU_USB(devtypeu, devtypel, instance) \ "" +#if defined(CONFIG_USB_STORAGE) +#define BOOT_TARGET_DEVICES_USB(func) func(USB, usb, 0) func(USB, usb, 1) +#else +#define BOOT_TARGET_DEVICES_USB(func) +#endif + #define BOOT_TARGET_DEVICES(func) \ BOOT_TARGET_DEVICES_JTAG(func) \ BOOT_TARGET_DEVICES_MMC(func) \ BOOT_TARGET_DEVICES_UFS(func) \ BOOT_TARGET_DEVICES_XSPI(func) \ BOOT_TARGET_DEVICES_DFU_USB(func) \ + BOOT_TARGET_DEVICES_USB(func) \ BOOT_TARGET_DEVICES_PXE(func) \ BOOT_TARGET_DEVICES_DHCP(func) -- cgit v1.2.3 From 8e25e76fff0698c8268b279af3d7859ed2e14ea5 Mon Sep 17 00:00:00 2001 From: Bernhard Messerklinger Date: Fri, 4 Apr 2025 09:28:00 +0200 Subject: board/BuR/zynq: initial commit This commit adds support for the brcp1, brsmarc2, brcp150 and brcp170 boards. This boards are based on the Xilinx Zynq SoC. Signed-off-by: Bernhard Messerklinger Acked-by: Michal Simek Link: https://lore.kernel.org/r/20250404072819.69642-5-bernhard.messerklinger@br-automation.com Signed-off-by: Michal Simek --- include/configs/brzynq.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 include/configs/brzynq.h (limited to 'include') diff --git a/include/configs/brzynq.h b/include/configs/brzynq.h new file mode 100644 index 00000000000..e2ebb2f1004 --- /dev/null +++ b/include/configs/brzynq.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Config file for BR Zynq board + * + * Copyright (C) 2024 + * B&R Industrial Automation GmbH - http://www.br-automation.com/ + */ + +#ifndef __CONFIG_BRZYNQ_H__ +#define __CONFIG_BRZYNQ_H__ + +/* Increase PHY_ANEG_TIMEOUT since the FPGA needs some setup time */ +#if IS_ENABLED(CONFIG_SPL_FPGA) +#define PHY_ANEG_TIMEOUT 8000 +#endif + +/* Use top mapped SRAM */ +#define CFG_SYS_INIT_RAM_ADDR 0xFFFF0000 +#define CFG_SYS_INIT_RAM_SIZE 0x2000 + +#endif /* __CONFIG_BRZYNQ_H__ */ -- cgit v1.2.3