[U-Boot] [PATCH] arm: zynq: Add compile time boot mode override

Peter Crosthwaite crosthwaitepeter at gmail.com
Wed Aug 20 14:14:25 CEST 2014


To better enable debug of u-boot itself (in particular SPL). To debug
u-boot you want to put your board in JTAG boot mode for quick recompile
and elf downloads via the JTAG debugger. Yet you may still want to boot
from a persistent storage media (SD or QSPI). Allow override of the
boot mode pins to facilitate this.

Signed-off-by: Peter Crosthwaite <crosthwaite.peter at gmail.com>
---
 arch/arm/cpu/armv7/zynq/slcr.c | 4 ++++
 doc/README.zynq                | 6 ++++++
 2 files changed, 10 insertions(+)

diff --git a/arch/arm/cpu/armv7/zynq/slcr.c b/arch/arm/cpu/armv7/zynq/slcr.c
index 934ccc3..26e02b8 100644
--- a/arch/arm/cpu/armv7/zynq/slcr.c
+++ b/arch/arm/cpu/armv7/zynq/slcr.c
@@ -155,8 +155,12 @@ void zynq_slcr_devcfg_enable(void)
 
 u32 zynq_slcr_get_boot_mode(void)
 {
+#ifdef CONFIG_ZYNQ_BM_FORCE
+	return CONFIG_ZYNQ_BM_FORCE;
+#else
 	/* Get the bootmode register value */
 	return readl(&slcr_base->boot_mode);
+#endif
 }
 
 u32 zynq_slcr_get_idcode(void)
diff --git a/doc/README.zynq b/doc/README.zynq
index 043c970..70be7ae 100644
--- a/doc/README.zynq
+++ b/doc/README.zynq
@@ -52,6 +52,12 @@ board_late_init() will read the bootmode values using slcr bootmode register
 at runtime and assign the modeboot variable to specific bootmode string which
 is intern used in autoboot.
 
+This value can be overridden at compile time with the define
+CONFIG_ZYNQ_BM_FORCE. This is useful for debugging a u-boot elf downloaded
+over JTAG. E.g. The board will be jumpered for ZYNQ_BM_JTAG, but you can
+force u-boot to attempt an SD or QSPI boot should that be what you want to
+debug.
+
 SLCR bootmode register Bit[3:0] values
 #define ZYNQ_BM_NOR		0x02
 #define ZYNQ_BM_SD		0x05
-- 
1.9.1



More information about the U-Boot mailing list