diff options
author | David A. Marlin <dmarlin@redhat.com> | 2005-01-23 22:07:46 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@mtd.linutronix.de> | 2005-05-23 06:08:59 -0400 |
commit | 068e3c0a002c79a5e3cc7c42cb749c4bb126288c (patch) | |
tree | fdf2db2edf03c4520a204476b0edc652ae2c9c47 /include/linux/mtd/nand.h | |
parent | 99f2a8aea18c9779c141050c6f95a8f1da63bbe4 (diff) |
[MTD] NAND Add optional ECC status check callback
Add optional hardware specific callback routine to perform extra error
status checks on erase and write failures for devices with hardware ECC.
Signed-off-by: David A. Marlin <dmarlin@redhat.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'include/linux/mtd/nand.h')
-rw-r--r-- | include/linux/mtd/nand.h | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 0118128ae384..cf52f20c6de2 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
@@ -5,7 +5,7 @@ | |||
5 | * Steven J. Hill <sjhill@realitydiluted.com> | 5 | * Steven J. Hill <sjhill@realitydiluted.com> |
6 | * Thomas Gleixner <tglx@linutronix.de> | 6 | * Thomas Gleixner <tglx@linutronix.de> |
7 | * | 7 | * |
8 | * $Id: nand.h,v 1.69 2005/01/17 18:29:18 dmarlin Exp $ | 8 | * $Id: nand.h,v 1.70 2005/01/24 03:07:42 dmarlin Exp $ |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License version 2 as | 11 | * it under the terms of the GNU General Public License version 2 as |
@@ -50,6 +50,8 @@ | |||
50 | * update of nand_chip structure description | 50 | * update of nand_chip structure description |
51 | * 01-17-2005 dmarlin added extended commands for AG-AND device and added option | 51 | * 01-17-2005 dmarlin added extended commands for AG-AND device and added option |
52 | * for BBT_AUTO_REFRESH. | 52 | * for BBT_AUTO_REFRESH. |
53 | * 01-20-2005 dmarlin added optional pointer to hardware specific callback for | ||
54 | * extra error status checks. | ||
53 | */ | 55 | */ |
54 | #ifndef __LINUX_MTD_NAND_H | 56 | #ifndef __LINUX_MTD_NAND_H |
55 | #define __LINUX_MTD_NAND_H | 57 | #define __LINUX_MTD_NAND_H |
@@ -164,7 +166,7 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_ | |||
164 | 166 | ||
165 | /* | 167 | /* |
166 | * Constants for Hardware ECC | 168 | * Constants for Hardware ECC |
167 | */ | 169 | */ |
168 | /* Reset Hardware ECC for read */ | 170 | /* Reset Hardware ECC for read */ |
169 | #define NAND_ECC_READ 0 | 171 | #define NAND_ECC_READ 0 |
170 | /* Reset Hardware ECC for write */ | 172 | /* Reset Hardware ECC for write */ |
@@ -172,6 +174,10 @@ extern int nand_read_raw (struct mtd_info *mtd, uint8_t *buf, loff_t from, size_ | |||
172 | /* Enable Hardware ECC before syndrom is read back from flash */ | 174 | /* Enable Hardware ECC before syndrom is read back from flash */ |
173 | #define NAND_ECC_READSYN 2 | 175 | #define NAND_ECC_READSYN 2 |
174 | 176 | ||
177 | /* Bit mask for flags passed to do_nand_read_ecc */ | ||
178 | #define NAND_GET_DEVICE 0x80 | ||
179 | |||
180 | |||
175 | /* Option constants for bizarre disfunctionality and real | 181 | /* Option constants for bizarre disfunctionality and real |
176 | * features | 182 | * features |
177 | */ | 183 | */ |
@@ -308,6 +314,8 @@ struct nand_hw_control { | |||
308 | * @badblock_pattern: [REPLACEABLE] bad block scan pattern used for initial bad block scan | 314 | * @badblock_pattern: [REPLACEABLE] bad block scan pattern used for initial bad block scan |
309 | * @controller: [OPTIONAL] a pointer to a hardware controller structure which is shared among multiple independend devices | 315 | * @controller: [OPTIONAL] a pointer to a hardware controller structure which is shared among multiple independend devices |
310 | * @priv: [OPTIONAL] pointer to private chip date | 316 | * @priv: [OPTIONAL] pointer to private chip date |
317 | * @errstat: [OPTIONAL] hardware specific function to perform additional error status checks | ||
318 | * (determine if errors are correctable) | ||
311 | */ | 319 | */ |
312 | 320 | ||
313 | struct nand_chip { | 321 | struct nand_chip { |
@@ -363,6 +371,7 @@ struct nand_chip { | |||
363 | struct nand_bbt_descr *badblock_pattern; | 371 | struct nand_bbt_descr *badblock_pattern; |
364 | struct nand_hw_control *controller; | 372 | struct nand_hw_control *controller; |
365 | void *priv; | 373 | void *priv; |
374 | int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state, int status, int page); | ||
366 | }; | 375 | }; |
367 | 376 | ||
368 | /* | 377 | /* |
@@ -484,6 +493,9 @@ extern int nand_update_bbt (struct mtd_info *mtd, loff_t offs); | |||
484 | extern int nand_default_bbt (struct mtd_info *mtd); | 493 | extern int nand_default_bbt (struct mtd_info *mtd); |
485 | extern int nand_isbad_bbt (struct mtd_info *mtd, loff_t offs, int allowbbt); | 494 | extern int nand_isbad_bbt (struct mtd_info *mtd, loff_t offs, int allowbbt); |
486 | extern int nand_erase_nand (struct mtd_info *mtd, struct erase_info *instr, int allowbbt); | 495 | extern int nand_erase_nand (struct mtd_info *mtd, struct erase_info *instr, int allowbbt); |
496 | extern int nand_do_read_ecc (struct mtd_info *mtd, loff_t from, size_t len, | ||
497 | size_t * retlen, u_char * buf, u_char * oob_buf, | ||
498 | struct nand_oobinfo *oobsel, int flags); | ||
487 | 499 | ||
488 | /* | 500 | /* |
489 | * Constants for oob configuration | 501 | * Constants for oob configuration |