mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Andrey Smirnov <andrew.smirnov@gmail.com>
To: barebox@lists.infradead.org
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Subject: [PATCH 3/3] i.MX6: phytec: Allow multiple MMC devices to contain boot environment
Date: Thu, 15 Jan 2015 18:32:36 -0800	[thread overview]
Message-ID: <1421375556-21715-4-git-send-email-andrew.smirnov@gmail.com> (raw)
In-Reply-To: <1421375556-21715-1-git-send-email-andrew.smirnov@gmail.com>

Add code so that when booting from different SDHCI controllers barebox
would correctly set up where to look for bootloader environment.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
---
 arch/arm/boards/phytec-phyflex-imx6/board.c | 10 +++++++---
 arch/arm/dts/imx6qdl-phytec-pfla02.dtsi     | 20 +++++++++++++++++++-
 2 files changed, 26 insertions(+), 4 deletions(-)

diff --git a/arch/arm/boards/phytec-phyflex-imx6/board.c b/arch/arm/boards/phytec-phyflex-imx6/board.c
index c731faf..5f65261 100644
--- a/arch/arm/boards/phytec-phyflex-imx6/board.c
+++ b/arch/arm/boards/phytec-phyflex-imx6/board.c
@@ -17,6 +17,7 @@
  *
  */
 
+#include <malloc.h>
 #include <envfs.h>
 #include <environment.h>
 #include <bootsource.h>
@@ -79,14 +80,15 @@ static int phytec_pfla02_init(void)
 
 	switch (bootsource_get()) {
 	case BOOTSOURCE_MMC:
-		environment_path = "/chosen/environment-sd";
+		environment_path = asprintf("/chosen/environment-sd%d",
+					bootsource_get_instance() + 1);
 		break;
 	case BOOTSOURCE_NAND:
-		environment_path = "/chosen/environment-nand";
+		environment_path = asprintf("/chosen/environment-nand");
 		break;
 	default:
 	case BOOTSOURCE_SPI:
-		environment_path = "/chosen/environment-spinor";
+		environment_path = asprintf("/chosen/environment-spinor");
 		break;
 	}
 
@@ -95,6 +97,8 @@ static int phytec_pfla02_init(void)
 		pr_warn("Failed to enable environment partition '%s' (%d)\n",
 			environment_path, ret);
 
+	free(environment_path);
+
 	return 0;
 }
 device_initcall(phytec_pfla02_init);
diff --git a/arch/arm/dts/imx6qdl-phytec-pfla02.dtsi b/arch/arm/dts/imx6qdl-phytec-pfla02.dtsi
index 32ce088..85cfec3 100644
--- a/arch/arm/dts/imx6qdl-phytec-pfla02.dtsi
+++ b/arch/arm/dts/imx6qdl-phytec-pfla02.dtsi
@@ -23,11 +23,29 @@
 			status = "disabled";
 		};
 
-		environment-sd {
+		environment-sd1 {
+			compatible = "barebox,environment";
+			device-path = &usdhc1, "partname:barebox-environment";
+			status = "disabled";
+		};
+
+		environment-sd2 {
+			compatible = "barebox,environment";
+			device-path = &usdhc2, "partname:barebox-environment";
+			status = "disabled";
+		};
+
+		environment-sd3 {
 			compatible = "barebox,environment";
 			device-path = &usdhc3, "partname:barebox-environment";
 			status = "disabled";
 		};
+
+		environment-sd4 {
+			compatible = "barebox,environment";
+			device-path = &usdhc4, "partname:barebox-environment";
+			status = "disabled";
+		};
 	};
 };
 
-- 
2.1.0


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  parent reply	other threads:[~2015-01-16  2:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-16  2:32 [PATCH 1/3] i.MX6: phytec: Separate SoM specific code Andrey Smirnov
2015-01-16  2:32 ` [PATCH v2] i.MX: SPI: Respect SPI_LSB_FIRST flag in mode settings Andrey Smirnov
2015-01-16  2:32 ` [PATCH 2/3] i.MX6: phytec: Check environment path selection for errors Andrey Smirnov
2015-01-16  2:32 ` Andrey Smirnov [this message]
2015-01-16  7:12 ` [PATCH 1/3] i.MX6: phytec: Separate SoM specific code Sascha Hauer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1421375556-21715-4-git-send-email-andrew.smirnov@gmail.com \
    --to=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox