[PATCH 09/10] ARM: i.MX51 efikasb: configure environment from devicetree

Sascha Hauer s.hauer at pengutronix.de
Tue Jul 16 10:06:05 EDT 2013


Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 arch/arm/boards/efika-mx-smartbook/board.c | 29 ++++++++++-------------------
 arch/arm/dts/imx51-genesi-efika-sb.dts     | 26 ++++++++++++++++++++++++++
 2 files changed, 36 insertions(+), 19 deletions(-)

diff --git a/arch/arm/boards/efika-mx-smartbook/board.c b/arch/arm/boards/efika-mx-smartbook/board.c
index 1735c3e..85ff466 100644
--- a/arch/arm/boards/efika-mx-smartbook/board.c
+++ b/arch/arm/boards/efika-mx-smartbook/board.c
@@ -210,6 +210,16 @@ static int efikamx_usb_init(void)
 		mxc_iomux_v3_setup_pad(MX51_PAD_EIM_A26__USBH2_STP);
 	}
 
+	switch (bootsource_get()) {
+	case BOOTSOURCE_MMC:
+		of_device_enable_path("/chosen/environment-sd");
+		break;
+	case BOOTSOURCE_SPI:
+	default:
+		of_device_enable_path("/chosen/environment-spi");
+		break;
+	}
+
 	return 0;
 }
 console_initcall(efikamx_usb_init);
@@ -230,7 +240,6 @@ extern char flash_header_imx51_genesi_efikasb_end[];
 
 static int efikamx_late_init(void)
 {
-	enum bootsource bootsource;
 	int i;
 
 	if (!of_machine_is_compatible("genesi,imx51-sb"))
@@ -255,24 +264,6 @@ static int efikamx_late_init(void)
 	armlinux_set_architecture(2370);
 	armlinux_set_revision(0x5100 | imx_silicon_revision());
 
-	bootsource = bootsource_get();
-
-	switch (bootsource) {
-	case BOOTSOURCE_MMC:
-		device_detect_by_name("mmc1");
-
-		devfs_add_partition("mmc1", 0x00000, 0x80000,
-				DEVFS_PARTITION_FIXED, "self0");
-		devfs_add_partition("mmc1", 0x80000, 0x80000,
-				DEVFS_PARTITION_FIXED, "env0");
-		break;
-	case BOOTSOURCE_SPI:
-	default:
-		devfs_add_partition("m25p0", 0x80000, 0x20000,
-				DEVFS_PARTITION_FIXED, "env0");
-		break;
-	}
-
 	return 0;
 }
 late_initcall(efikamx_late_init);
diff --git a/arch/arm/dts/imx51-genesi-efika-sb.dts b/arch/arm/dts/imx51-genesi-efika-sb.dts
index dc92b2a..21b7c7e 100644
--- a/arch/arm/dts/imx51-genesi-efika-sb.dts
+++ b/arch/arm/dts/imx51-genesi-efika-sb.dts
@@ -18,6 +18,18 @@
 
 	chosen {
 		linux,stdout-path = "/soc/aips at 70000000/serial at 73fbc000";
+
+		environment-sd {
+			compatible = "barebox,environment";
+			device-path = &esdhc2, "partname:barebox-environment";
+			status = "disabled";
+		};
+
+		environment-spi {
+			compatible = "barebox,environment";
+			device-path = &flash, "partname:barebox-environment";
+			status = "disabled";
+		};
 	};
 
 	memory {
@@ -178,6 +190,13 @@
 	cd-gpios = <&gpio1 8 0>;
 	wp-gpios = <&gpio1 7 0>;
 	status = "okay";
+	#address-cells = <1>;
+	#size-cells = <1>;
+
+	partition at 0 {
+		label = "barebox-environment";
+		reg = <0x80000 0x80000>;
+	};
 };
 
 &ecspi1 {
@@ -290,6 +309,13 @@
 		compatible = "sst,sst25vf032b", "m25p80";
 		spi-max-frequency = <15000000>;
 		reg = <1>;
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		partition at 0 {
+			label = "barebox-environment";
+			reg = <0x80000 0x80000>;
+		};
 	};
 };
 
-- 
1.8.3.2




More information about the barebox mailing list