[PATCH 05/12] ARM: versatile: Use flash from device tree

Sascha Hauer s.hauer at pengutronix.de
Tue May 2 02:14:12 PDT 2023


Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 .../boards/versatile/env/init/mtdparts-nor    |  6 -----
 arch/arm/boards/versatile/versatilepb.c       |  4 ---
 arch/arm/dts/versatile-pb.dts                 | 26 +++++++++++++++++++
 3 files changed, 26 insertions(+), 10 deletions(-)
 delete mode 100644 arch/arm/boards/versatile/env/init/mtdparts-nor

diff --git a/arch/arm/boards/versatile/env/init/mtdparts-nor b/arch/arm/boards/versatile/env/init/mtdparts-nor
deleted file mode 100644
index 20c2b994cc..0000000000
--- a/arch/arm/boards/versatile/env/init/mtdparts-nor
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-mtdparts="512k(nor0.barebox)ro,512k(nor0.bareboxenv),4864k(nor0.kernel),256k(nor0.dtb),3M(nor0.update),-(nor0.root)"
-kernelname="physmap-flash.0"
-
-mtdparts-add -d nor0 -k ${kernelname} -p ${mtdparts}
diff --git a/arch/arm/boards/versatile/versatilepb.c b/arch/arm/boards/versatile/versatilepb.c
index c5ce46e525..0ea397d3cb 100644
--- a/arch/arm/boards/versatile/versatilepb.c
+++ b/arch/arm/boards/versatile/versatilepb.c
@@ -45,10 +45,6 @@ static struct smc91c111_pdata net_pdata = {
 
 static int vpb_devices_init(void)
 {
-	add_cfi_flash_device(DEVICE_ID_DYNAMIC, VERSATILE_FLASH_BASE, VERSATILE_FLASH_SIZE, 0);
-	devfs_add_partition("nor0", 0x00000, SZ_512K, DEVFS_PARTITION_FIXED, "self");
-	devfs_add_partition("nor0", SZ_512K, SZ_512K, DEVFS_PARTITION_FIXED, "env0");
-
 	add_generic_device("smc91c111", DEVICE_ID_DYNAMIC, NULL, VERSATILE_ETH_BASE,
 			64 * 1024, IORESOURCE_MEM, &net_pdata);
 
diff --git a/arch/arm/dts/versatile-pb.dts b/arch/arm/dts/versatile-pb.dts
index d374f54291..31af9d5e73 100644
--- a/arch/arm/dts/versatile-pb.dts
+++ b/arch/arm/dts/versatile-pb.dts
@@ -3,8 +3,34 @@
 / {
 	model = "ARM Versatile PB";
 	compatible = "arm,versatile-pb";
+
+	chosen {
+		environment-nor {
+			compatible = "barebox,environment";
+			device-path = &env_nor;
+		};
+	};
 };
 
 &{/memory} {
 	reg = <0x0 0x04000000>;
 };
+
+&{/flash at 34000000} {
+	partitions {
+		compatible = "fixed-partitions";
+
+		#address-cells = <1>;
+                #size-cells = <1>;
+
+                partition at 0 {
+			label = "barebox";
+			reg = <0x0 0x400000>;
+		};
+
+                env_nor: partition at 400000 {
+			label = "bareboxenv";
+			reg = <0x400000 0x400000>;
+		};
+	};
+};
-- 
2.39.2




More information about the barebox mailing list