]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - include/linux/mtd/onenand.h
NAND: sync with 2.6.27
[people/ms/u-boot.git] / include / linux / mtd / onenand.h
index 4b0c2dfaaaa412305ae301ef93e7c9d0dd58277b..4467c2bb2d991ed7e9bcb5810330db277972c024 100644 (file)
@@ -17,6 +17,7 @@
 /* Note: The header order is impoertant */
 #include <onenand_uboot.h>
 
+#include <linux/mtd/compat.h>
 #include <linux/mtd/bbm.h>
 
 #define MAX_BUFFERRAM          2
@@ -27,20 +28,6 @@ extern int onenand_scan (struct mtd_info *mtd, int max_chips);
 /* Free resources held by the OneNAND device */
 extern void onenand_release (struct mtd_info *mtd);
 
-/**
- * onenand_state_t - chip states
- * Enumeration for OneNAND flash chip state
- */
-typedef enum {
-       FL_READY,
-       FL_READING,
-       FL_WRITING,
-       FL_ERASING,
-       FL_SYNCING,
-       FL_UNLOCKING,
-       FL_LOCKING,
-} onenand_state_t;
-
 /**
  * struct onenand_bufferram - OneNAND BufferRAM Data
  * @param block                block address in BufferRAM
@@ -64,6 +51,7 @@ struct onenand_bufferram {
  * @param page_shift   [INTERN] number of address bits in a page
  * @param ppb_shift    [INTERN] number of address bits in a pages per block
  * @param page_mask    [INTERN] a page per block mask
+ * @param writesize    [INTERN] a real page size
  * @param bufferam_index       [INTERN] BufferRAM index
  * @param bufferam     [INTERN] BufferRAM info
  * @param readw                [REPLACEABLE] hardware specific function for read short
@@ -88,6 +76,7 @@ struct onenand_chip {
        unsigned int page_shift;
        unsigned int ppb_shift; /* Pages per block shift */
        unsigned int page_mask;
+       unsigned int writesize;
 
        unsigned int bufferram_index;
        struct onenand_bufferram bufferram[MAX_BUFFERRAM];
@@ -103,26 +92,42 @@ struct onenand_chip {
        unsigned short (*read_word) (void __iomem * addr);
        void (*write_word) (unsigned short value, void __iomem * addr);
        void (*mmcontrol) (struct mtd_info * mtd, int sync_read);
+       int (*block_markbad)(struct mtd_info *mtd, loff_t ofs);
+       int (*scan_bbt)(struct mtd_info *mtd);
 
-       spinlock_t chip_lock;
-       wait_queue_head_t wq;
-       onenand_state_t state;
+       int state;
+       unsigned char *page_buf;
+       unsigned char *oob_buf;
 
        struct nand_oobinfo *autooob;
+       struct nand_ecclayout *ecclayout;
 
        void *bbm;
 
        void *priv;
 };
 
+/*
+ * Helper macros
+ */
 #define ONENAND_CURRENT_BUFFERRAM(this)                (this->bufferram_index)
 #define ONENAND_NEXT_BUFFERRAM(this)           (this->bufferram_index ^ 1)
 #define ONENAND_SET_NEXT_BUFFERRAM(this)       (this->bufferram_index ^= 1)
+#define ONENAND_SET_PREV_BUFFERRAM(this)       (this->bufferram_index ^= 1)
+#define ONENAND_SET_BUFFERRAM0(this)           (this->bufferram_index = 0)
+#define ONENAND_SET_BUFFERRAM1(this)           (this->bufferram_index = 1)
+
+#define ONENAND_IS_DDP(this)                                           \
+       (this->device_id & ONENAND_DEVICE_IS_DDP)
+
+#define ONENAND_IS_2PLANE(this)                        (0)
 
 /*
  * Options bits
  */
 #define ONENAND_CONT_LOCK              (0x0001)
+#define ONENAND_PAGEBUF_ALLOC          (0x1000)
+#define ONENAND_OOBBUF_ALLOC           (0x2000)
 
 /*
  * OneNAND Flash Manufacturer ID Codes
@@ -140,4 +145,7 @@ struct onenand_manufacturers {
        char *name;
 };
 
+int onenand_bbt_read_oob(struct mtd_info *mtd, loff_t from,
+                       struct mtd_oob_ops *ops);
+
 #endif                         /* __LINUX_MTD_ONENAND_H */