aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mtd/nand.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/mtd/nand.h')
-rw-r--r--include/linux/mtd/nand.h43
1 files changed, 21 insertions, 22 deletions
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 460525841a27..2c0fb6380461 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -36,6 +36,9 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from,
36 size_t len, size_t ooblen); 36 size_t len, size_t ooblen);
37 37
38 38
39extern int nand_write_raw(struct mtd_info *mtd, loff_t to, size_t len,
40 size_t *retlen, uint8_t *buf, uint8_t *oob);
41
39/* The maximum number of NAND chips in an array */ 42/* The maximum number of NAND chips in an array */
40#define NAND_MAX_CHIPS 8 43#define NAND_MAX_CHIPS 8
41 44
@@ -47,23 +50,20 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from,
47 50
48/* 51/*
49 * Constants for hardware specific CLE/ALE/NCE function 52 * Constants for hardware specific CLE/ALE/NCE function
50*/ 53 *
54 * These are bits which can be or'ed to set/clear multiple
55 * bits in one go.
56 */
51/* Select the chip by setting nCE to low */ 57/* Select the chip by setting nCE to low */
52#define NAND_CTL_SETNCE 1 58#define NAND_NCE 0x01
53/* Deselect the chip by setting nCE to high */
54#define NAND_CTL_CLRNCE 2
55/* Select the command latch by setting CLE to high */ 59/* Select the command latch by setting CLE to high */
56#define NAND_CTL_SETCLE 3 60#define NAND_CLE 0x02
57/* Deselect the command latch by setting CLE to low */
58#define NAND_CTL_CLRCLE 4
59/* Select the address latch by setting ALE to high */ 61/* Select the address latch by setting ALE to high */
60#define NAND_CTL_SETALE 5 62#define NAND_ALE 0x04
61/* Deselect the address latch by setting ALE to low */ 63
62#define NAND_CTL_CLRALE 6 64#define NAND_CTRL_CLE (NAND_NCE | NAND_CLE)
63/* Set write protection by setting WP to high. Not used! */ 65#define NAND_CTRL_ALE (NAND_NCE | NAND_ALE)
64#define NAND_CTL_SETWP 7 66#define NAND_CTRL_CHANGE 0x80
65/* Clear write protection by setting WP to low. Not used! */
66#define NAND_CTL_CLRWP 8
67 67
68/* 68/*
69 * Standard NAND flash commands 69 * Standard NAND flash commands
@@ -103,6 +103,8 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from,
103#define NAND_CMD_STATUS_RESET 0x7f 103#define NAND_CMD_STATUS_RESET 0x7f
104#define NAND_CMD_STATUS_CLEAR 0xff 104#define NAND_CMD_STATUS_CLEAR 0xff
105 105
106#define NAND_CMD_NONE -1
107
106/* Status bits */ 108/* Status bits */
107#define NAND_STATUS_FAIL 0x01 109#define NAND_STATUS_FAIL 0x01
108#define NAND_STATUS_FAIL_N1 0x02 110#define NAND_STATUS_FAIL_N1 0x02
@@ -237,7 +239,7 @@ struct nand_ecc_ctrl {
237 int steps; 239 int steps;
238 int size; 240 int size;
239 int bytes; 241 int bytes;
240 int (*hwctl)(struct mtd_info *mtd, int mode); 242 void (*hwctl)(struct mtd_info *mtd, int mode);
241 int (*calculate)(struct mtd_info *mtd, 243 int (*calculate)(struct mtd_info *mtd,
242 const uint8_t *dat, 244 const uint8_t *dat,
243 uint8_t *ecc_code); 245 uint8_t *ecc_code);
@@ -251,16 +253,15 @@ struct nand_ecc_ctrl {
251 * @IO_ADDR_R: [BOARDSPECIFIC] address to read the 8 I/O lines of the flash device 253 * @IO_ADDR_R: [BOARDSPECIFIC] address to read the 8 I/O lines of the flash device
252 * @IO_ADDR_W: [BOARDSPECIFIC] address to write the 8 I/O lines of the flash device 254 * @IO_ADDR_W: [BOARDSPECIFIC] address to write the 8 I/O lines of the flash device
253 * @read_byte: [REPLACEABLE] read one byte from the chip 255 * @read_byte: [REPLACEABLE] read one byte from the chip
254 * @write_byte: [REPLACEABLE] write one byte to the chip
255 * @read_word: [REPLACEABLE] read one word from the chip 256 * @read_word: [REPLACEABLE] read one word from the chip
256 * @write_word: [REPLACEABLE] write one word to the chip
257 * @write_buf: [REPLACEABLE] write data from the buffer to the chip 257 * @write_buf: [REPLACEABLE] write data from the buffer to the chip
258 * @read_buf: [REPLACEABLE] read data from the chip into the buffer 258 * @read_buf: [REPLACEABLE] read data from the chip into the buffer
259 * @verify_buf: [REPLACEABLE] verify buffer contents against the chip data 259 * @verify_buf: [REPLACEABLE] verify buffer contents against the chip data
260 * @select_chip: [REPLACEABLE] select chip nr 260 * @select_chip: [REPLACEABLE] select chip nr
261 * @block_bad: [REPLACEABLE] check, if the block is bad 261 * @block_bad: [REPLACEABLE] check, if the block is bad
262 * @block_markbad: [REPLACEABLE] mark the block bad 262 * @block_markbad: [REPLACEABLE] mark the block bad
263 * @hwcontrol: [BOARDSPECIFIC] hardwarespecific function for accesing control-lines 263 * @cmd_ctrl: [BOARDSPECIFIC] hardwarespecific funtion for controlling
264 * ALE/CLE/nCE. Also used to write command and address
264 * @dev_ready: [BOARDSPECIFIC] hardwarespecific function for accesing device ready/busy line 265 * @dev_ready: [BOARDSPECIFIC] hardwarespecific function for accesing device ready/busy line
265 * If set to NULL no access to ready/busy is available and the ready/busy information 266 * If set to NULL no access to ready/busy is available and the ready/busy information
266 * is read from the chip status register 267 * is read from the chip status register
@@ -304,17 +305,15 @@ struct nand_chip {
304 void __iomem *IO_ADDR_W; 305 void __iomem *IO_ADDR_W;
305 306
306 uint8_t (*read_byte)(struct mtd_info *mtd); 307 uint8_t (*read_byte)(struct mtd_info *mtd);
307 void (*write_byte)(struct mtd_info *mtd, uint8_t byte);
308 u16 (*read_word)(struct mtd_info *mtd); 308 u16 (*read_word)(struct mtd_info *mtd);
309 void (*write_word)(struct mtd_info *mtd, u16 word);
310
311 void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len); 309 void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len);
312 void (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len); 310 void (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len);
313 int (*verify_buf)(struct mtd_info *mtd, const uint8_t *buf, int len); 311 int (*verify_buf)(struct mtd_info *mtd, const uint8_t *buf, int len);
314 void (*select_chip)(struct mtd_info *mtd, int chip); 312 void (*select_chip)(struct mtd_info *mtd, int chip);
315 int (*block_bad)(struct mtd_info *mtd, loff_t ofs, int getchip); 313 int (*block_bad)(struct mtd_info *mtd, loff_t ofs, int getchip);
316 int (*block_markbad)(struct mtd_info *mtd, loff_t ofs); 314 int (*block_markbad)(struct mtd_info *mtd, loff_t ofs);
317 void (*hwcontrol)(struct mtd_info *mtd, int cmd); 315 void (*cmd_ctrl)(struct mtd_info *mtd, int dat,
316 unsigned int ctrl);
318 int (*dev_ready)(struct mtd_info *mtd); 317 int (*dev_ready)(struct mtd_info *mtd);
319 void (*cmdfunc)(struct mtd_info *mtd, unsigned command, int column, int page_addr); 318 void (*cmdfunc)(struct mtd_info *mtd, unsigned command, int column, int page_addr);
320 int (*waitfunc)(struct mtd_info *mtd, struct nand_chip *this, int state); 319 int (*waitfunc)(struct mtd_info *mtd, struct nand_chip *this, int state);