[PATCH v2 07/10] ARM: freescale-mx35-3-stack: convert to devfs_create_partitions

Uwe Kleine-König u.kleine-koenig at pengutronix.de
Thu Feb 27 15:39:07 EST 2014


Signed-off-by: Uwe Kleine-König <u.kleine-koenig at pengutronix.de>
---
 arch/arm/boards/freescale-mx35-3-stack/3stack.c | 42 +++++++++++++++++++++----
 1 file changed, 36 insertions(+), 6 deletions(-)

diff --git a/arch/arm/boards/freescale-mx35-3-stack/3stack.c b/arch/arm/boards/freescale-mx35-3-stack/3stack.c
index dbd1c7adcb10..2be1554b688e 100644
--- a/arch/arm/boards/freescale-mx35-3-stack/3stack.c
+++ b/arch/arm/boards/freescale-mx35-3-stack/3stack.c
@@ -129,6 +129,40 @@ static void set_board_rev(int rev)
 	imx35_3ds_system_rev =  (imx35_3ds_system_rev & ~(0xF << 8)) | (rev & 0xF) << 8;
 }
 
+static const struct devfs_partition f3s_nand0_partitions[] = {
+	{
+		.offset = 0,
+		.size = 0x40000,
+		.flags = DEVFS_PARTITION_FIXED,
+		.name = "self_raw",
+		.bbname = "self0",
+	}, {
+		.offset = DEVFS_PARTITION_APPEND, /* 0x40000 */
+		.size = 0x80000,
+		.flags = DEVFS_PARTITION_FIXED,
+		.name = "env_raw",
+		.bbname = "env0",
+	}, {
+		/* sentinel */
+	}
+};
+
+static const struct devfs_partition f3s_nor0_partitions[] = {
+	{
+		.offset = 0,
+		.size = 0x40000,
+		.flags = DEVFS_PARTITION_FIXED,
+		.name = "self0",
+	}, {
+		.offset = DEVFS_PARTITION_APPEND, /* 0x40000 */
+		.size = 0x80000,
+		.flags = DEVFS_PARTITION_FIXED,
+		.name = "env0",
+	}, {
+		/* sentinel */
+	}
+};
+
 static int f3s_devices_init(void)
 {
 	uint32_t reg;
@@ -151,15 +185,11 @@ static int f3s_devices_init(void)
 
 	switch ((reg >> 25) & 0x3) {
 	case 0x01:		/* NAND is the source */
-		devfs_add_partition("nand0", 0x00000, 0x40000, DEVFS_PARTITION_FIXED, "self_raw");
-		dev_add_bb_dev("self_raw", "self0");
-		devfs_add_partition("nand0", 0x40000, 0x80000, DEVFS_PARTITION_FIXED, "env_raw");
-		dev_add_bb_dev("env_raw", "env0");
+		devfs_create_partitions("nand0", f3s_nand0_partitions);
 		break;
 
 	case 0x00:		/* NOR is the source */
-		devfs_add_partition("nor0", 0x00000, 0x40000, DEVFS_PARTITION_FIXED, "self0");
-		devfs_add_partition("nor0", 0x40000, 0x80000, DEVFS_PARTITION_FIXED, "env0");
+		devfs_create_partitions("nor0", f3s_nor0_partitions);
 		protect_file("/dev/env0", 1);
 		break;
 	}
-- 
1.8.5.3




More information about the barebox mailing list