[PATCH 10/10] ARM:phyFLEX-iMX6: Add bootsource detection

Christian Hemp c.hemp at phytec.de
Fri Sep 12 06:33:47 PDT 2014


Signed-off-by: Christian Hemp <c.hemp at phytec.de>
---
 arch/arm/boards/phytec-phyflex-imx6/board.c |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/arch/arm/boards/phytec-phyflex-imx6/board.c b/arch/arm/boards/phytec-phyflex-imx6/board.c
index 843edac..fe3d1b2 100644
--- a/arch/arm/boards/phytec-phyflex-imx6/board.c
+++ b/arch/arm/boards/phytec-phyflex-imx6/board.c
@@ -18,6 +18,8 @@
  */
 
 #include <envfs.h>
+#include <environment.h>
+#include <bootsource.h>
 #include <common.h>
 #include <gpio.h>
 #include <init.h>
@@ -103,6 +105,19 @@ static int phytec_pfla02_init(void)
 
 	imx6_bbu_nand_register_handler("nand", BBU_HANDLER_FLAG_DEFAULT);
 
+	switch (bootsource_get()) {
+	case BOOTSOURCE_MMC:
+		of_device_enable_path("/chosen/environment-sd");
+		break;
+	case BOOTSOURCE_NAND:
+		of_device_enable_path("/chosen/environment-nand");
+		break;
+	default:
+	case BOOTSOURCE_SPI:
+		of_device_enable_path("/chosen/environment-spinor");
+		break;
+	}
+
 	defaultenv_append_directory(defaultenv_phyflex_imx6);
 
 	return 0;
-- 
1.7.0.4




More information about the barebox mailing list