Bladeren bron

ARM64: zynqmp: Fix secondary bootmode enabling

Do not setup use_alt bit which copy alternative boot mode to
boot mode. The reason is that this bit is cleared after POR
but not after any software reset which will cause
that after SW reset bootrom will look for different boot image.

This patch setups alternative boot mode selection (purely SW
handling) and extends code to read this alternative boot mode first and
use it if it is setup.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Michal Simek 8 jaren geleden
bovenliggende
commit
47359a0394
2 gewijzigde bestanden met toevoegingen van 7 en 2 verwijderingen
  1. 4 2
      arch/arm/cpu/armv8/zynqmp/spl.c
  2. 3 0
      board/xilinx/zynqmp/zynqmp.c

+ 4 - 2
arch/arm/cpu/armv8/zynqmp/spl.c

@@ -69,12 +69,14 @@ u32 spl_boot_device(void)
 
 
 #if defined(CONFIG_SPL_ZYNQMP_ALT_BOOTMODE_ENABLED)
 #if defined(CONFIG_SPL_ZYNQMP_ALT_BOOTMODE_ENABLED)
 	/* Change default boot mode at run-time */
 	/* Change default boot mode at run-time */
-	writel(BOOT_MODE_USE_ALT |
-	       CONFIG_SPL_ZYNQMP_ALT_BOOTMODE << BOOT_MODE_ALT_SHIFT,
+	writel(CONFIG_SPL_ZYNQMP_ALT_BOOTMODE << BOOT_MODE_ALT_SHIFT,
 	       &crlapb_base->boot_mode);
 	       &crlapb_base->boot_mode);
 #endif
 #endif
 
 
 	reg = readl(&crlapb_base->boot_mode);
 	reg = readl(&crlapb_base->boot_mode);
+	if (reg >> BOOT_MODE_ALT_SHIFT)
+		reg >>= BOOT_MODE_ALT_SHIFT;
+
 	bootmode = reg & BOOT_MODES_MASK;
 	bootmode = reg & BOOT_MODES_MASK;
 
 
 	switch (bootmode) {
 	switch (bootmode) {

+ 3 - 0
board/xilinx/zynqmp/zynqmp.c

@@ -335,6 +335,9 @@ int board_late_init(void)
 	}
 	}
 
 
 	reg = readl(&crlapb_base->boot_mode);
 	reg = readl(&crlapb_base->boot_mode);
+	if (reg >> BOOT_MODE_ALT_SHIFT)
+		reg >>= BOOT_MODE_ALT_SHIFT;
+
 	bootmode = reg & BOOT_MODES_MASK;
 	bootmode = reg & BOOT_MODES_MASK;
 
 
 	puts("Bootmode: ");
 	puts("Bootmode: ");