[U-Boot] [PATCH 3/3] ubi: Add proof-of-concept CFI flash support

Piotr Ziecik kosmo at semihalf.com
Mon Nov 17 15:58:00 CET 2008


With this patch UBI can be used on CFI flash chips.

Signed-off-by: Piotr Ziecik <kosmo at semihalf.com>
---
For example to create UBI volume on empty flash partition
(partition 0 on NOR device 0) use following commands:

=> setenv mtdids nor0=nor
=> mtdparts add nor0 8m at 32m nor-part
=> saveenv
=> ubi part nor nor0,0
=> ubi create ubi-vol
=> ubi info layout

 common/cmd_ubi.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/common/cmd_ubi.c b/common/cmd_ubi.c
index a656786..4217fa0 100644
--- a/common/cmd_ubi.c
+++ b/common/cmd_ubi.c
@@ -24,6 +24,7 @@
 #define DEV_TYPE_NONE		0
 #define DEV_TYPE_NAND		1
 #define DEV_TYPE_ONENAND	2
+#define DEV_TYPE_NOR		3
 
 /* Private own data */
 static struct ubi_device *ubi;
@@ -485,6 +486,11 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 			ubi_dev.mtd_info = &nand_info[ubi_dev.nr];
 		}
 #endif
+		if (strcmp(argv[2], "nor") == 0) {
+			strcpy(ubi_dev.dev_name, "NOR");
+			ubi_dev.type = DEV_TYPE_NOR;
+			ubi_dev.mtd_info = get_mtd_device_nm(CFI_MTD_DEV_NAME);
+		}
 #if defined(CONFIG_CMD_ONENAND)
 		if (strcmp(argv[2], "onenand") == 0) {
 			strcpy(ubi_dev.dev_name, "OneNAND");
@@ -606,7 +612,7 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
 
 U_BOOT_CMD(ubi, 6, 1, do_ubi,
 	"ubi      - ubi commands\n",
-        "part [nand|onenand] [part]"
+        "part [nand|nor|onenand] [part]"
 		" - Show or set current partition\n"
 	"info [l[ayout]]"
 		" - Display volume and ubi layout information\n"
-- 
1.5.6.1



More information about the U-Boot mailing list