diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-02 11:22:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-10-02 11:22:17 -0400 |
commit | 3e04767a4647ea6c61ed05abe803c052ce123960 (patch) | |
tree | 431d98caf56d9a14585e4358f184745dafbd6405 /include | |
parent | a12f66fccf2e266ad197df142b5ebafc6a169a8c (diff) | |
parent | 76a5027c374a638e55de5d8c4485ea0201254870 (diff) |
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6:
[MTD] Cleanup of 'ioremap balanced with iounmap for drivers/mtd subsystem'
[MTD] fix nftl_write warning
[MTD] fix printk warning
[MTD ONENAND] Check OneNAND lock scheme & all block unlock command support
[MTD ONENAND] Remove unused MTD_ONENAND_SYNC_READ configuration
[MTD ONENAND] Fix OneNAND probe
[MTD NAND] Provide prototype for newly-exported nand_wait_ready()
[MTD] Remove #ifndef __KERNEL__ hack in <mtd/mtd-abi.h>
[MTD NAND] Allow override of page read and write functions.
[MTD NAND] Allocate chip->buffers separately to allow it to be overridden
[MTD NAND] Split nand_scan() into two parts; allow board driver to intervene
[MTD NAND] Export nand_wait_ready() for use by board drivers
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mtd/nand.h | 25 | ||||
-rw-r--r-- | include/linux/mtd/onenand.h | 6 | ||||
-rw-r--r-- | include/linux/mtd/onenand_regs.h | 4 | ||||
-rw-r--r-- | include/mtd/Kbuild | 3 | ||||
-rw-r--r-- | include/mtd/mtd-abi.h | 6 |
5 files changed, 31 insertions, 13 deletions
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 0b4cd2fa64aa..70420bbae82b 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
@@ -27,9 +27,17 @@ | |||
27 | struct mtd_info; | 27 | struct mtd_info; |
28 | /* Scan and identify a NAND device */ | 28 | /* Scan and identify a NAND device */ |
29 | extern int nand_scan (struct mtd_info *mtd, int max_chips); | 29 | extern int nand_scan (struct mtd_info *mtd, int max_chips); |
30 | /* Separate phases of nand_scan(), allowing board driver to intervene | ||
31 | * and override command or ECC setup according to flash type */ | ||
32 | extern int nand_scan_ident(struct mtd_info *mtd, int max_chips); | ||
33 | extern int nand_scan_tail(struct mtd_info *mtd); | ||
34 | |||
30 | /* Free resources held by the NAND device */ | 35 | /* Free resources held by the NAND device */ |
31 | extern void nand_release (struct mtd_info *mtd); | 36 | extern void nand_release (struct mtd_info *mtd); |
32 | 37 | ||
38 | /* Internal helper for board drivers which need to override command function */ | ||
39 | extern void nand_wait_ready(struct mtd_info *mtd); | ||
40 | |||
33 | /* The maximum number of NAND chips in an array */ | 41 | /* The maximum number of NAND chips in an array */ |
34 | #define NAND_MAX_CHIPS 8 | 42 | #define NAND_MAX_CHIPS 8 |
35 | 43 | ||
@@ -178,7 +186,9 @@ typedef enum { | |||
178 | #define NAND_USE_FLASH_BBT 0x00010000 | 186 | #define NAND_USE_FLASH_BBT 0x00010000 |
179 | /* This option skips the bbt scan during initialization. */ | 187 | /* This option skips the bbt scan during initialization. */ |
180 | #define NAND_SKIP_BBTSCAN 0x00020000 | 188 | #define NAND_SKIP_BBTSCAN 0x00020000 |
181 | 189 | /* This option is defined if the board driver allocates its own buffers | |
190 | (e.g. because it needs them DMA-coherent */ | ||
191 | #define NAND_OWN_BUFFERS 0x00040000 | ||
182 | /* Options set by nand scan */ | 192 | /* Options set by nand scan */ |
183 | /* Nand scan has allocated controller struct */ | 193 | /* Nand scan has allocated controller struct */ |
184 | #define NAND_CONTROLLER_ALLOC 0x80000000 | 194 | #define NAND_CONTROLLER_ALLOC 0x80000000 |
@@ -228,6 +238,8 @@ struct nand_hw_control { | |||
228 | * be provided if an hardware ECC is available | 238 | * be provided if an hardware ECC is available |
229 | * @calculate: function for ecc calculation or readback from ecc hardware | 239 | * @calculate: function for ecc calculation or readback from ecc hardware |
230 | * @correct: function for ecc correction, matching to ecc generator (sw/hw) | 240 | * @correct: function for ecc correction, matching to ecc generator (sw/hw) |
241 | * @read_page_raw: function to read a raw page without ECC | ||
242 | * @write_page_raw: function to write a raw page without ECC | ||
231 | * @read_page: function to read a page according to the ecc generator requirements | 243 | * @read_page: function to read a page according to the ecc generator requirements |
232 | * @write_page: function to write a page according to the ecc generator requirements | 244 | * @write_page: function to write a page according to the ecc generator requirements |
233 | * @read_oob: function to read chip OOB data | 245 | * @read_oob: function to read chip OOB data |
@@ -249,6 +261,12 @@ struct nand_ecc_ctrl { | |||
249 | int (*correct)(struct mtd_info *mtd, uint8_t *dat, | 261 | int (*correct)(struct mtd_info *mtd, uint8_t *dat, |
250 | uint8_t *read_ecc, | 262 | uint8_t *read_ecc, |
251 | uint8_t *calc_ecc); | 263 | uint8_t *calc_ecc); |
264 | int (*read_page_raw)(struct mtd_info *mtd, | ||
265 | struct nand_chip *chip, | ||
266 | uint8_t *buf); | ||
267 | void (*write_page_raw)(struct mtd_info *mtd, | ||
268 | struct nand_chip *chip, | ||
269 | const uint8_t *buf); | ||
252 | int (*read_page)(struct mtd_info *mtd, | 270 | int (*read_page)(struct mtd_info *mtd, |
253 | struct nand_chip *chip, | 271 | struct nand_chip *chip, |
254 | uint8_t *buf); | 272 | uint8_t *buf); |
@@ -337,6 +355,7 @@ struct nand_buffers { | |||
337 | * @priv: [OPTIONAL] pointer to private chip date | 355 | * @priv: [OPTIONAL] pointer to private chip date |
338 | * @errstat: [OPTIONAL] hardware specific function to perform additional error status checks | 356 | * @errstat: [OPTIONAL] hardware specific function to perform additional error status checks |
339 | * (determine if errors are correctable) | 357 | * (determine if errors are correctable) |
358 | * @write_page [REPLACEABLE] High-level page write function | ||
340 | */ | 359 | */ |
341 | 360 | ||
342 | struct nand_chip { | 361 | struct nand_chip { |
@@ -359,6 +378,8 @@ struct nand_chip { | |||
359 | void (*erase_cmd)(struct mtd_info *mtd, int page); | 378 | void (*erase_cmd)(struct mtd_info *mtd, int page); |
360 | int (*scan_bbt)(struct mtd_info *mtd); | 379 | int (*scan_bbt)(struct mtd_info *mtd); |
361 | int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state, int status, int page); | 380 | int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state, int status, int page); |
381 | int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, | ||
382 | const uint8_t *buf, int page, int cached, int raw); | ||
362 | 383 | ||
363 | int chip_delay; | 384 | int chip_delay; |
364 | unsigned int options; | 385 | unsigned int options; |
@@ -380,7 +401,7 @@ struct nand_chip { | |||
380 | struct nand_ecclayout *ecclayout; | 401 | struct nand_ecclayout *ecclayout; |
381 | 402 | ||
382 | struct nand_ecc_ctrl ecc; | 403 | struct nand_ecc_ctrl ecc; |
383 | struct nand_buffers buffers; | 404 | struct nand_buffers *buffers; |
384 | struct nand_hw_control hwcontrol; | 405 | struct nand_hw_control hwcontrol; |
385 | 406 | ||
386 | struct mtd_oob_ops ops; | 407 | struct mtd_oob_ops ops; |
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h index 1f4972155249..6f045b586e76 100644 --- a/include/linux/mtd/onenand.h +++ b/include/linux/mtd/onenand.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * linux/include/linux/mtd/onenand.h | 2 | * linux/include/linux/mtd/onenand.h |
3 | * | 3 | * |
4 | * Copyright (C) 2005 Samsung Electronics | 4 | * Copyright (C) 2005-2006 Samsung Electronics |
5 | * Kyungmin Park <kyungmin.park@samsung.com> | 5 | * Kyungmin Park <kyungmin.park@samsung.com> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
@@ -96,6 +96,7 @@ struct onenand_chip { | |||
96 | void __iomem *base; | 96 | void __iomem *base; |
97 | unsigned int chipsize; | 97 | unsigned int chipsize; |
98 | unsigned int device_id; | 98 | unsigned int device_id; |
99 | unsigned int version_id; | ||
99 | unsigned int density_mask; | 100 | unsigned int density_mask; |
100 | unsigned int options; | 101 | unsigned int options; |
101 | 102 | ||
@@ -149,7 +150,8 @@ struct onenand_chip { | |||
149 | /* | 150 | /* |
150 | * Options bits | 151 | * Options bits |
151 | */ | 152 | */ |
152 | #define ONENAND_CONT_LOCK (0x0001) | 153 | #define ONENAND_HAS_CONT_LOCK (0x0001) |
154 | #define ONENAND_HAS_UNLOCK_ALL (0x0002) | ||
153 | #define ONENAND_PAGEBUF_ALLOC (0x1000) | 155 | #define ONENAND_PAGEBUF_ALLOC (0x1000) |
154 | 156 | ||
155 | /* | 157 | /* |
diff --git a/include/linux/mtd/onenand_regs.h b/include/linux/mtd/onenand_regs.h index 4a72818d2545..9e409fe6ded6 100644 --- a/include/linux/mtd/onenand_regs.h +++ b/include/linux/mtd/onenand_regs.h | |||
@@ -3,7 +3,7 @@ | |||
3 | * | 3 | * |
4 | * OneNAND Register header file | 4 | * OneNAND Register header file |
5 | * | 5 | * |
6 | * Copyright (C) 2005 Samsung Electronics | 6 | * Copyright (C) 2005-2006 Samsung Electronics |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify | 8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License version 2 as | 9 | * it under the terms of the GNU General Public License version 2 as |
@@ -72,6 +72,7 @@ | |||
72 | #define ONENAND_DEVICE_VCC_MASK (0x3) | 72 | #define ONENAND_DEVICE_VCC_MASK (0x3) |
73 | 73 | ||
74 | #define ONENAND_DEVICE_DENSITY_512Mb (0x002) | 74 | #define ONENAND_DEVICE_DENSITY_512Mb (0x002) |
75 | #define ONENAND_DEVICE_DENSITY_1Gb (0x003) | ||
75 | 76 | ||
76 | /* | 77 | /* |
77 | * Version ID Register F002h (R) | 78 | * Version ID Register F002h (R) |
@@ -110,6 +111,7 @@ | |||
110 | #define ONENAND_CMD_UNLOCK (0x23) | 111 | #define ONENAND_CMD_UNLOCK (0x23) |
111 | #define ONENAND_CMD_LOCK (0x2A) | 112 | #define ONENAND_CMD_LOCK (0x2A) |
112 | #define ONENAND_CMD_LOCK_TIGHT (0x2C) | 113 | #define ONENAND_CMD_LOCK_TIGHT (0x2C) |
114 | #define ONENAND_CMD_UNLOCK_ALL (0x27) | ||
113 | #define ONENAND_CMD_ERASE (0x94) | 115 | #define ONENAND_CMD_ERASE (0x94) |
114 | #define ONENAND_CMD_RESET (0xF0) | 116 | #define ONENAND_CMD_RESET (0xF0) |
115 | #define ONENAND_CMD_OTP_ACCESS (0x65) | 117 | #define ONENAND_CMD_OTP_ACCESS (0x65) |
diff --git a/include/mtd/Kbuild b/include/mtd/Kbuild index 13e7a3c6d794..e0fe92b03a4e 100644 --- a/include/mtd/Kbuild +++ b/include/mtd/Kbuild | |||
@@ -1,6 +1,5 @@ | |||
1 | header-y += inftl-user.h | 1 | header-y += inftl-user.h |
2 | header-y += jffs2-user.h | 2 | header-y += jffs2-user.h |
3 | header-y += mtd-abi.h | ||
3 | header-y += mtd-user.h | 4 | header-y += mtd-user.h |
4 | header-y += nftl-user.h | 5 | header-y += nftl-user.h |
5 | |||
6 | unifdef-y += mtd-abi.h | ||
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h index b0a67b7ffdcd..f913c30d7b89 100644 --- a/include/mtd/mtd-abi.h +++ b/include/mtd/mtd-abi.h | |||
@@ -7,12 +7,6 @@ | |||
7 | #ifndef __MTD_ABI_H__ | 7 | #ifndef __MTD_ABI_H__ |
8 | #define __MTD_ABI_H__ | 8 | #define __MTD_ABI_H__ |
9 | 9 | ||
10 | #ifndef __KERNEL__ | ||
11 | /* Urgh. The whole point of splitting this out into | ||
12 | separate files was to avoid #ifdef __KERNEL__ */ | ||
13 | #define __user | ||
14 | #endif | ||
15 | |||
16 | struct erase_info_user { | 10 | struct erase_info_user { |
17 | uint32_t start; | 11 | uint32_t start; |
18 | uint32_t length; | 12 | uint32_t length; |