summaryrefslogtreecommitdiffstats
path: root/board/xilinx/zynq
diff options
context:
space:
mode:
authorSiva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com>2019-01-25 17:06:06 +0530
committerMichal Simek <michal.simek@xilinx.com>2019-02-14 14:31:09 +0100
commit3c7b4c359d11e65ea262dac283114b72f08d4625 (patch)
tree9caa1ef93a9dae6da73177a6ee49304071fb71d6 /board/xilinx/zynq
parent90e97ab31e0208a3f8483872df212a1af8070897 (diff)
downloadu-boot-3c7b4c359d11e65ea262dac283114b72f08d4625.tar.gz
u-boot-3c7b4c359d11e65ea262dac283114b72f08d4625.tar.xz
u-boot-3c7b4c359d11e65ea262dac283114b72f08d4625.zip
arm: zynq: Update boot_targets based on bootmode
Update boot_targets based on bootmode to run corresponding distroboot command first. Signed-off-by: Siva Durga Prasad Paladugu <siva.durga.paladugu@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com>
Diffstat (limited to 'board/xilinx/zynq')
-rw-r--r--board/xilinx/zynq/board.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/board/xilinx/zynq/board.c b/board/xilinx/zynq/board.c
index f9973840bf..b4b84df576 100644
--- a/board/xilinx/zynq/board.c
+++ b/board/xilinx/zynq/board.c
@@ -8,6 +8,7 @@
#include <dm/uclass.h>
#include <fdtdec.h>
#include <fpga.h>
+#include <malloc.h>
#include <mmc.h>
#include <watchdog.h>
#include <wdt.h>
@@ -53,27 +54,55 @@ int board_init(void)
int board_late_init(void)
{
+ int env_targets_len = 0;
+ const char *mode;
+ char *new_targets;
+ char *env_targets;
+
switch ((zynq_slcr_get_boot_mode()) & ZYNQ_BM_MASK) {
case ZYNQ_BM_QSPI:
+ mode = "qspi";
env_set("modeboot", "qspiboot");
break;
case ZYNQ_BM_NAND:
+ mode = "nand";
env_set("modeboot", "nandboot");
break;
case ZYNQ_BM_NOR:
+ mode = "nor";
env_set("modeboot", "norboot");
break;
case ZYNQ_BM_SD:
+ mode = "mmc";
env_set("modeboot", "sdboot");
break;
case ZYNQ_BM_JTAG:
+ mode = "pxe dhcp";
env_set("modeboot", "jtagboot");
break;
default:
+ mode = "";
env_set("modeboot", "");
break;
}
+ /*
+ * One terminating char + one byte for space between mode
+ * and default boot_targets
+ */
+ env_targets = env_get("boot_targets");
+ if (env_targets)
+ env_targets_len = strlen(env_targets);
+
+ new_targets = calloc(1, strlen(mode) + env_targets_len + 2);
+ if (!new_targets)
+ return -ENOMEM;
+
+ sprintf(new_targets, "%s %s", mode,
+ env_targets ? env_targets : "");
+
+ env_set("boot_targets", new_targets);
+
return 0;
}