]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/mtd/mtd.h
Pull bugzilla-8066 into release branch
[linux-2.6-omap-h63xx.git] / include / linux / mtd / mtd.h
index 94a443d45258485cf79e71f76c7d01bc2c39b2eb..3d956c3abb310d06867abd729f8aacd0433be00b 100644 (file)
@@ -23,7 +23,7 @@
 
 #define MTD_CHAR_MAJOR 90
 #define MTD_BLOCK_MAJOR 31
-#define MAX_MTD_DEVICES 16
+#define MAX_MTD_DEVICES 32
 
 #define MTD_ERASE_PENDING              0x01
 #define MTD_ERASING            0x02
@@ -75,25 +75,27 @@ typedef enum {
  * struct mtd_oob_ops - oob operation operands
  * @mode:      operation mode
  *
- * @len:       number of bytes to write/read. When a data buffer is given
- *             (datbuf != NULL) this is the number of data bytes. When
- *             no data buffer is available this is the number of oob bytes.
+ * @len:       number of data bytes to write/read
  *
- * @retlen:    number of bytes written/read. When a data buffer is given
- *             (datbuf != NULL) this is the number of data bytes. When
- *             no data buffer is available this is the number of oob bytes.
+ * @retlen:    number of data bytes written/read
  *
- * @ooblen:    number of oob bytes per page
+ * @ooblen:    number of oob bytes to write/read
+ * @oobretlen: number of oob bytes written/read
  * @ooboffs:   offset of oob data in the oob area (only relevant when
  *             mode = MTD_OOB_PLACE)
  * @datbuf:    data buffer - if NULL only oob data are read/written
  * @oobbuf:    oob data buffer
+ *
+ * Note, it is allowed to read more then one OOB area at one go, but not write.
+ * The interface assumes that the OOB write requests program only one page's
+ * OOB area.
  */
 struct mtd_oob_ops {
        mtd_oob_mode_t  mode;
        size_t          len;
        size_t          retlen;
        size_t          ooblen;
+       size_t          oobretlen;
        uint32_t        ooboffs;
        uint8_t         *datbuf;
        uint8_t         *oobbuf;
@@ -119,18 +121,7 @@ struct mtd_info {
        u_int32_t writesize;
 
        u_int32_t oobsize;   // Amount of OOB data per block (e.g. 16)
-       u_int32_t ecctype;
-       u_int32_t eccsize;
-
-       /*
-        * Reuse some of the above unused fields in the case of NOR flash
-        * with configurable programming regions to avoid modifying the
-        * user visible structure layout/size.  Only valid when the
-        * MTD_PROGRAM_REGIONS flag is set.
-        * (Maybe we should have an union for those?)
-        */
-#define MTD_PROGREGION_CTRLMODE_VALID(mtd)  (mtd)->oobsize
-#define MTD_PROGREGION_CTRLMODE_INVALID(mtd)  (mtd)->ecctype
+       u_int32_t oobavail;  // Available OOB bytes per block
 
        // Kernel-only stuff starts here.
        char *name;
@@ -202,11 +193,20 @@ struct mtd_info {
 
        /* ECC status information */
        struct mtd_ecc_stats ecc_stats;
+       /* Subpage shift (NAND) */
+       int subpage_sft;
 
        void *priv;
 
        struct module *owner;
        int usecount;
+
+       /* If the driver is something smart, like UBI, it may need to maintain
+        * its own reference counting. The below functions are only for driver.
+        * The driver may register its callbacks. These callbacks are not
+        * supposed to be called by MTD users */
+       int (*get_device) (struct mtd_info *mtd);
+       void (*put_device) (struct mtd_info *mtd);
 };
 
 
@@ -216,6 +216,7 @@ extern int add_mtd_device(struct mtd_info *mtd);
 extern int del_mtd_device (struct mtd_info *mtd);
 
 extern struct mtd_info *get_mtd_device(struct mtd_info *mtd, int num);
+extern struct mtd_info *get_mtd_device_nm(const char *name);
 
 extern void put_mtd_device(struct mtd_info *mtd);