]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - include/linux/mtd/onenand.h
ipg: fix Tx completion irq request
[linux-2.6-omap-h63xx.git] / include / linux / mtd / onenand.h
index f775a7af3890087215ce16504a8da68f513310dd..fd0a260e070b483b7be93288d088367949366b47 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  linux/include/linux/mtd/onenand.h
  *
- *  Copyright (C) 2005-2006 Samsung Electronics
+ *  Copyright (C) 2005-2007 Samsung Electronics
  *  Kyungmin Park <kyungmin.park@samsung.com>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -42,14 +42,10 @@ typedef enum {
 
 /**
  * struct onenand_bufferram - OneNAND BufferRAM Data
- * @block:             block address in BufferRAM
- * @page:              page address in BufferRAM
- * @valid:             valid flag
+ * @blockpage:         block & page address in BufferRAM
  */
 struct onenand_bufferram {
-       int block;
-       int page;
-       int valid;
+       int     blockpage;
 };
 
 /**
@@ -63,8 +59,8 @@ struct onenand_bufferram {
  *                     partly be set to inform onenand_scan about
  * @erase_shift:       [INTERN] number of address bits in a block
  * @page_shift:                [INTERN] number of address bits in a page
- * @ppb_shift:         [INTERN] number of address bits in a pages per block
  * @page_mask:         [INTERN] a page per block mask
+ * @writesize:         [INTERN] a real page size
  * @bufferram_index:   [INTERN] BufferRAM index
  * @bufferram:         [INTERN] BufferRAM info
  * @readw:             [REPLACEABLE] hardware specific function for read short
@@ -87,7 +83,8 @@ struct onenand_bufferram {
  * @wq:                        [INTERN] wait queue to sleep on if a OneNAND
  *                     operation is in progress
  * @state:             [INTERN] the current state of the OneNAND device
- * @page_buf:          data buffer
+ * @page_buf:          [INTERN] page main data buffer
+ * @oob_buf:           [INTERN] page oob data buffer
  * @subpagesize:       [INTERN] holds the subpagesize
  * @ecclayout:         [REPLACEABLE] the default ecc placement scheme
  * @bbm:               [REPLACEABLE] pointer to Bad Block Management
@@ -103,8 +100,8 @@ struct onenand_chip {
 
        unsigned int            erase_shift;
        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];
@@ -128,6 +125,7 @@ struct onenand_chip {
        wait_queue_head_t       wq;
        onenand_state_t         state;
        unsigned char           *page_buf;
+       unsigned char           *oob_buf;
 
        int                     subpagesize;
        struct nand_ecclayout   *ecclayout;
@@ -144,12 +142,24 @@ struct onenand_chip {
 #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_GET_SYS_CFG1(this)                                     \
        (this->read_word(this->base + ONENAND_REG_SYS_CFG1))
 #define ONENAND_SET_SYS_CFG1(v, this)                                  \
        (this->write_word(v, this->base + ONENAND_REG_SYS_CFG1))
 
+#define ONENAND_IS_DDP(this)                                           \
+       (this->device_id & ONENAND_DEVICE_IS_DDP)
+
+#ifdef CONFIG_MTD_ONENAND_2X_PROGRAM
+#define ONENAND_IS_2PLANE(this)                                                \
+       (this->options & ONENAND_HAS_2PLANE)
+#else
+#define ONENAND_IS_2PLANE(this)                        (0)
+#endif
+
 /* Check byte access in OneNAND */
 #define ONENAND_CHECK_BYTE_ACCESS(addr)                (addr & 0x1)
 
@@ -158,7 +168,9 @@ struct onenand_chip {
  */
 #define ONENAND_HAS_CONT_LOCK          (0x0001)
 #define ONENAND_HAS_UNLOCK_ALL         (0x0002)
+#define ONENAND_HAS_2PLANE             (0x0004)
 #define ONENAND_PAGEBUF_ALLOC          (0x1000)
+#define ONENAND_OOBBUF_ALLOC           (0x2000)
 
 /*
  * OneNAND Flash Manufacturer ID Codes