summaryrefslogtreecommitdiff
path: root/board/xilinx/zynqmp/zynqmp.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-08-27 08:33:02 -0400
committerTom Rini <trini@konsulko.com>2021-08-27 08:33:02 -0400
commitb9cb74a5aa256fc34a1b2b9dd847a985b91f34f6 (patch)
treea618344b253ec3164848e797a2636bbd8f060223 /board/xilinx/zynqmp/zynqmp.c
parent7bfa565453ec5f63668a3464da21629055c3053f (diff)
parent229cb5c6ba3469cbc4a0bcc69389fe61c51fd3b4 (diff)
downloadu-boot-b9cb74a5aa256fc34a1b2b9dd847a985b91f34f6.tar.gz
Merge tag 'xilinx-for-v2021.10-rc3' of https://gitlab.denx.de/u-boot/custodians/u-boot-microblazeWIP/27Aug2021
Xilinx changes for v2021.10-rc3 xilinx: - Disable CONFIG_ARCH_FIXUP_FDT_MEMORY - Print information about cpu via soc drivers and enable DISPLAY_CPUINFO - Wire infrastructure for DTB_RESELECT and MULTI_DTB_FIT zynq: - Wire single QSPI - Use power-source instead of io-standard properties - Enable nor on zc770-xm012 zynqmp: - Change handling around multi_boot() - Setup offset for u-boot.itb in spi - Generate run time dfu_alt_info for capsule update - Use explicit values for enums (zynqmp_firmware.h) - Enable RTC/SHA1/BUTTON/BUTTON_GPIO command - Disable WDT driver by default - Bind usb/scsi via preboot because of EFI - DT updates/fixes - Add soc driver - Fix SPL SPI boot mode versal: - Add soc driver sdhci: - Update tap delay programming for zynq_sdhci driver cmd: - Fix RTC uclass handling in date command - Update pwm help message - Update reset help message watchdog: - Fix wwdt compilation rtc: - Deal with seq alias in rtc uclass - Add zynqmp RTC driver fdt: - Add kernel-doc for fdt_fixup_memory_banks()
Diffstat (limited to 'board/xilinx/zynqmp/zynqmp.c')
-rw-r--r--board/xilinx/zynqmp/zynqmp.c74
1 files changed, 68 insertions, 6 deletions
diff --git a/board/xilinx/zynqmp/zynqmp.c b/board/xilinx/zynqmp/zynqmp.c
index 38c910fa5b..ea15e62eb2 100644
--- a/board/xilinx/zynqmp/zynqmp.c
+++ b/board/xilinx/zynqmp/zynqmp.c
@@ -8,6 +8,7 @@
#include <command.h>
#include <cpu_func.h>
#include <debug_uart.h>
+#include <dfu.h>
#include <env.h>
#include <env_internal.h>
#include <init.h>
@@ -19,6 +20,7 @@
#include <ahci.h>
#include <scsi.h>
#include <malloc.h>
+#include <memalign.h>
#include <wdt.h>
#include <asm/arch/clk.h>
#include <asm/arch/hardware.h>
@@ -346,13 +348,14 @@ int board_early_init_f(void)
static int multi_boot(void)
{
- u32 multiboot;
-
- multiboot = readl(&csu_base->multi_boot);
+ u32 multiboot = 0;
+ int ret;
- printf("Multiboot:\t%d\n", multiboot);
+ ret = zynqmp_mmio_read((ulong)&csu_base->multi_boot, &multiboot);
+ if (ret)
+ return -EINVAL;
- return 0;
+ return multiboot;
}
#define PS_SYSMON_ANALOG_BUS_VAL 0x3210
@@ -392,7 +395,7 @@ int board_init(void)
#endif
if (current_el() == 3)
- multi_boot();
+ printf("Multiboot:\t%d\n", multi_boot());
return 0;
}
@@ -467,6 +470,9 @@ ulong board_get_usable_ram_top(ulong total_size)
phys_addr_t reg;
struct lmb lmb;
+ if (!IS_ALIGNED((ulong)gd->fdt_blob, 0x8))
+ panic("Not 64bit aligned DT location: %p\n", gd->fdt_blob);
+
/* found enough not-reserved memory to relocated U-Boot */
lmb_init(&lmb);
lmb_add(&lmb, gd->ram_base, gd->ram_size);
@@ -515,6 +521,9 @@ static u8 __maybe_unused zynqmp_get_bootmode(void)
if (ret)
return -EINVAL;
+ debug("HW boot mode: %x\n", reg & BOOT_MODES_MASK);
+ debug("ALT boot mode: %x\n", reg >> BOOT_MODE_ALT_SHIFT);
+
if (reg >> BOOT_MODE_ALT_SHIFT)
reg >>= BOOT_MODE_ALT_SHIFT;
@@ -735,6 +744,7 @@ int board_late_init(void)
env_targets ? env_targets : "");
env_set("boot_targets", new_targets);
+ free(new_targets);
reset_reason();
@@ -816,3 +826,55 @@ enum env_location env_get_location(enum env_operation op, int prio)
return ENVL_NOWHERE;
}
}
+
+#if defined(CONFIG_SET_DFU_ALT_INFO)
+
+#define DFU_ALT_BUF_LEN SZ_1K
+
+void set_dfu_alt_info(char *interface, char *devstr)
+{
+ u8 multiboot;
+ int bootseq = 0;
+
+ ALLOC_CACHE_ALIGN_BUFFER(char, buf, DFU_ALT_BUF_LEN);
+
+ if (env_get("dfu_alt_info"))
+ return;
+
+ memset(buf, 0, sizeof(buf));
+
+ multiboot = multi_boot();
+ debug("Multiboot: %d\n", multiboot);
+
+ switch (zynqmp_get_bootmode()) {
+ case EMMC_MODE:
+ case SD_MODE:
+ case SD1_LSHFT_MODE:
+ case SD_MODE1:
+ bootseq = mmc_get_env_dev();
+ if (!multiboot)
+ snprintf(buf, DFU_ALT_BUF_LEN,
+ "mmc %d:1=boot.bin fat %d 1;"
+ "u-boot.itb fat %d 1",
+ bootseq, bootseq, bootseq);
+ else
+ snprintf(buf, DFU_ALT_BUF_LEN,
+ "mmc %d:1=boot%04d.bin fat %d 1;"
+ "u-boot.itb fat %d 1",
+ bootseq, multiboot, bootseq, bootseq);
+ break;
+ case QSPI_MODE_24BIT:
+ case QSPI_MODE_32BIT:
+ snprintf(buf, DFU_ALT_BUF_LEN,
+ "sf 0:0=boot.bin raw %x 0x1500000;"
+ "u-boot.itb raw 0x%x 0x500000",
+ multiboot * SZ_32K, CONFIG_SYS_SPI_U_BOOT_OFFS);
+ break;
+ default:
+ return;
+ }
+
+ env_set("dfu_alt_info", buf);
+ puts("DFU alt info setting: done\n");
+}
+#endif