Skip to contentSkip to conversation

mtd: Add MTD concat support to concatenate multiple MTD NOR devices

PATCH New Stefan Roese 2 participants 2 messages May 12, 2009 – Jun 3, 2009 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 mtd: Add MTD concat support to concatenate multiple MTD NOR devices

This patch adds concatenation support to the U-Boot MTD infrastructure. By enabling CONFIG_MTD_CONCAT this MTD CFI wrapper will concatenate all found NOR devices into one single MTD device. This can be used by e.g by UBI to access a partition that spans over multiple NOR chips.

---
v2:
- Using #ifdef's instead of __attribute__((unused)) for variable declaration.

 drivers/mtd/Makefile       |    1 +
 drivers/mtd/cfi_mtd.c      |   79 +++++-
 drivers/mtd/mtdconcat.c    |  807 ++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mtd/compat.h |   12 +-
 include/linux/mtd/concat.h |   21 ++
 5 files changed, 915 insertions(+), 5 deletions(-)
 create mode 100644 drivers/mtd/mtdconcat.c
 create mode 100644 include/linux/mtd/concat.h
drivers/mtd/Makefile +1 -0
index ed3f91e..19dc02b 100644
@@ -26,6 +26,7 @@ include $(TOPDIR)/config.mk
 LIB	:= $(obj)libmtd.a
 
 COBJS-$(CONFIG_MTD_PARTITIONS) += mtdcore.o mtdpart.o
+COBJS-$(CONFIG_MTD_CONCAT) += mtdconcat.o
 COBJS-$(CONFIG_HAS_DATAFLASH) += at45.o
 COBJS-$(CONFIG_FLASH_CFI_DRIVER) += cfi_flash.o
 COBJS-$(CONFIG_FLASH_CFI_MTD) += cfi_mtd.o
drivers/mtd/cfi_mtd.c +78 -1

121 lines not on this page · raw message

drivers/mtd/mtdconcat.c new file +807 -0

807 lines not on this page · raw message

include/linux/mtd/compat.h +8 -4
index 9036b74..f0c8464 100644
@@ -19,11 +19,15 @@
 
 #define kmalloc(size, flags)	malloc(size)
 #define kzalloc(size, flags)	calloc(size, 1)
-#define vmalloc(size)			malloc(size)
-#define kfree(ptr)				free(ptr)
-#define vfree(ptr)				free(ptr)
+#define vmalloc(size)		malloc(size)
+#define kfree(ptr)		free(ptr)
+#define vfree(ptr)		free(ptr)
 
-#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
+#define DECLARE_WAITQUEUE(...)	do { } while (0)
+#define add_wait_queue(...)	do { } while (0)
+#define remove_wait_queue(...)	do { } while (0)
+
+#define KERNEL_VERSION(a,b,c)	(((a) << 16) + ((b) << 8) + (c))
 
 /*
  * ..and if you can't take the strict
include/linux/mtd/concat.h new file +21 -0
new file mode 100644
index 0000000..e80c674
@@ -0,0 +1,21 @@
+/*
+ * MTD device concatenation layer definitions
+ *
+ * (C) 2002 Robert Kaiser <[email protected]>
+ *
+ * This code is GPL
+ */
+
+#ifndef MTD_CONCAT_H
+#define MTD_CONCAT_H
+
+
+struct mtd_info *mtd_concat_create(
+    struct mtd_info *subdev[],  /* subdevices to concatenate */
+    int num_devs,               /* number of subdevices      */
+    const char *name);          /* name for the new device   */
+
+void mtd_concat_destroy(struct mtd_info *mtd);
+
+#endif
+
Signature · 1 line
1.6.2.5
#1 lore raw

PATCH v2 1/1 mtd: Add MTD concat support to concatenate multiple MTD NOR devices

Dear Stefan Roese,

Quoted 11 lines · In message <[email protected]> you wrote:

This patch adds concatenation support to the U-Boot MTD infrastructure. By enabling CONFIG_MTD_CONCAT this MTD CFI wrapper will concatenate all found NOR devices into one single MTD device. This can be used by e.g by UBI to access a partition that spans over multiple NOR chips.

---
v2:
- Using #ifdef's instead of __attribute__((unused)) for variable declaration.

Quoted 8 lines
 drivers/mtd/Makefile       |    1 +
 drivers/mtd/cfi_mtd.c      |   79 +++++-
 drivers/mtd/mtdconcat.c    |  807 ++++++++++++++++++++++++++++++++++++++++++++
 include/linux/mtd/compat.h |   12 +-
 include/linux/mtd/concat.h |   21 ++
 5 files changed, 915 insertions(+), 5 deletions(-)
 create mode 100644 drivers/mtd/mtdconcat.c
 create mode 100644 include/linux/mtd/concat.h

OK - applied this one (instead of v1) to next. Thanks.

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
You can only live once, but if you do it right, once is enough.