aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mtd/onenand.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/mtd/onenand.h')
-rw-r--r--include/linux/mtd/onenand.h24
1 files changed, 24 insertions, 0 deletions
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index 9aa2a9149b58..8ed873374381 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -17,6 +17,7 @@
17#include <linux/mtd/onenand_regs.h> 17#include <linux/mtd/onenand_regs.h>
18#include <linux/mtd/bbm.h> 18#include <linux/mtd/bbm.h>
19 19
20#define MAX_DIES 2
20#define MAX_BUFFERRAM 2 21#define MAX_BUFFERRAM 2
21 22
22/* Scan and identify a OneNAND device */ 23/* Scan and identify a OneNAND device */
@@ -51,7 +52,12 @@ struct onenand_bufferram {
51/** 52/**
52 * struct onenand_chip - OneNAND Private Flash Chip Data 53 * struct onenand_chip - OneNAND Private Flash Chip Data
53 * @base: [BOARDSPECIFIC] address to access OneNAND 54 * @base: [BOARDSPECIFIC] address to access OneNAND
55 * @dies: [INTERN][FLEX-ONENAND] number of dies on chip
56 * @boundary: [INTERN][FLEX-ONENAND] Boundary of the dies
57 * @diesize: [INTERN][FLEX-ONENAND] Size of the dies
54 * @chipsize: [INTERN] the size of one chip for multichip arrays 58 * @chipsize: [INTERN] the size of one chip for multichip arrays
59 * FIXME For Flex-OneNAND, chipsize holds maximum possible
60 * device size ie when all blocks are considered MLC
55 * @device_id: [INTERN] device ID 61 * @device_id: [INTERN] device ID
56 * @density_mask: chip density, used for DDP devices 62 * @density_mask: chip density, used for DDP devices
57 * @verstion_id: [INTERN] version ID 63 * @verstion_id: [INTERN] version ID
@@ -68,6 +74,8 @@ struct onenand_bufferram {
68 * @command: [REPLACEABLE] hardware specific function for writing 74 * @command: [REPLACEABLE] hardware specific function for writing
69 * commands to the chip 75 * commands to the chip
70 * @wait: [REPLACEABLE] hardware specific function for wait on ready 76 * @wait: [REPLACEABLE] hardware specific function for wait on ready
77 * @bbt_wait: [REPLACEABLE] hardware specific function for bbt wait on ready
78 * @unlock_all: [REPLACEABLE] hardware specific function for unlock all
71 * @read_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area 79 * @read_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area
72 * @write_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area 80 * @write_bufferram: [REPLACEABLE] hardware specific function for BufferRAM Area
73 * @read_word: [REPLACEABLE] hardware specific function for read 81 * @read_word: [REPLACEABLE] hardware specific function for read
@@ -92,9 +100,13 @@ struct onenand_bufferram {
92 */ 100 */
93struct onenand_chip { 101struct onenand_chip {
94 void __iomem *base; 102 void __iomem *base;
103 unsigned dies;
104 unsigned boundary[MAX_DIES];
105 loff_t diesize[MAX_DIES];
95 unsigned int chipsize; 106 unsigned int chipsize;
96 unsigned int device_id; 107 unsigned int device_id;
97 unsigned int version_id; 108 unsigned int version_id;
109 unsigned int technology;
98 unsigned int density_mask; 110 unsigned int density_mask;
99 unsigned int options; 111 unsigned int options;
100 112
@@ -108,6 +120,8 @@ struct onenand_chip {
108 120
109 int (*command)(struct mtd_info *mtd, int cmd, loff_t address, size_t len); 121 int (*command)(struct mtd_info *mtd, int cmd, loff_t address, size_t len);
110 int (*wait)(struct mtd_info *mtd, int state); 122 int (*wait)(struct mtd_info *mtd, int state);
123 int (*bbt_wait)(struct mtd_info *mtd, int state);
124 void (*unlock_all)(struct mtd_info *mtd);
111 int (*read_bufferram)(struct mtd_info *mtd, int area, 125 int (*read_bufferram)(struct mtd_info *mtd, int area,
112 unsigned char *buffer, int offset, size_t count); 126 unsigned char *buffer, int offset, size_t count);
113 int (*write_bufferram)(struct mtd_info *mtd, int area, 127 int (*write_bufferram)(struct mtd_info *mtd, int area,
@@ -145,6 +159,8 @@ struct onenand_chip {
145#define ONENAND_SET_BUFFERRAM0(this) (this->bufferram_index = 0) 159#define ONENAND_SET_BUFFERRAM0(this) (this->bufferram_index = 0)
146#define ONENAND_SET_BUFFERRAM1(this) (this->bufferram_index = 1) 160#define ONENAND_SET_BUFFERRAM1(this) (this->bufferram_index = 1)
147 161
162#define FLEXONENAND(this) \
163 (this->device_id & DEVICE_IS_FLEXONENAND)
148#define ONENAND_GET_SYS_CFG1(this) \ 164#define ONENAND_GET_SYS_CFG1(this) \
149 (this->read_word(this->base + ONENAND_REG_SYS_CFG1)) 165 (this->read_word(this->base + ONENAND_REG_SYS_CFG1))
150#define ONENAND_SET_SYS_CFG1(v, this) \ 166#define ONENAND_SET_SYS_CFG1(v, this) \
@@ -153,6 +169,9 @@ struct onenand_chip {
153#define ONENAND_IS_DDP(this) \ 169#define ONENAND_IS_DDP(this) \
154 (this->device_id & ONENAND_DEVICE_IS_DDP) 170 (this->device_id & ONENAND_DEVICE_IS_DDP)
155 171
172#define ONENAND_IS_MLC(this) \
173 (this->technology & ONENAND_TECHNOLOGY_IS_MLC)
174
156#ifdef CONFIG_MTD_ONENAND_2X_PROGRAM 175#ifdef CONFIG_MTD_ONENAND_2X_PROGRAM
157#define ONENAND_IS_2PLANE(this) \ 176#define ONENAND_IS_2PLANE(this) \
158 (this->options & ONENAND_HAS_2PLANE) 177 (this->options & ONENAND_HAS_2PLANE)
@@ -169,6 +188,7 @@ struct onenand_chip {
169#define ONENAND_HAS_CONT_LOCK (0x0001) 188#define ONENAND_HAS_CONT_LOCK (0x0001)
170#define ONENAND_HAS_UNLOCK_ALL (0x0002) 189#define ONENAND_HAS_UNLOCK_ALL (0x0002)
171#define ONENAND_HAS_2PLANE (0x0004) 190#define ONENAND_HAS_2PLANE (0x0004)
191#define ONENAND_SKIP_UNLOCK_CHECK (0x0100)
172#define ONENAND_PAGEBUF_ALLOC (0x1000) 192#define ONENAND_PAGEBUF_ALLOC (0x1000)
173#define ONENAND_OOBBUF_ALLOC (0x2000) 193#define ONENAND_OOBBUF_ALLOC (0x2000)
174 194
@@ -176,6 +196,7 @@ struct onenand_chip {
176 * OneNAND Flash Manufacturer ID Codes 196 * OneNAND Flash Manufacturer ID Codes
177 */ 197 */
178#define ONENAND_MFR_SAMSUNG 0xec 198#define ONENAND_MFR_SAMSUNG 0xec
199#define ONENAND_MFR_NUMONYX 0x20
179 200
180/** 201/**
181 * struct onenand_manufacturers - NAND Flash Manufacturer ID Structure 202 * struct onenand_manufacturers - NAND Flash Manufacturer ID Structure
@@ -189,5 +210,8 @@ struct onenand_manufacturers {
189 210
190int onenand_bbt_read_oob(struct mtd_info *mtd, loff_t from, 211int onenand_bbt_read_oob(struct mtd_info *mtd, loff_t from,
191 struct mtd_oob_ops *ops); 212 struct mtd_oob_ops *ops);
213unsigned onenand_block(struct onenand_chip *this, loff_t addr);
214loff_t onenand_addr(struct onenand_chip *this, int block);
215int flexonenand_region(struct mtd_info *mtd, loff_t addr);
192 216
193#endif /* __LINUX_MTD_ONENAND_H */ 217#endif /* __LINUX_MTD_ONENAND_H */