aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@cruncher.tec.linutronix.de>2006-05-25 04:04:31 -0400
committerDavid Woodhouse <dwmw2@infradead.org>2006-05-25 07:45:27 -0400
commit9577f44a899cf4acb9e381c8946307b72153cd15 (patch)
tree0e3ef3fd6a094da30584c8fc06483f0fff3cda4f
parent7fac464868ec5d80019fa549b8b4516dd1dc9d5c (diff)
[MTD] NAND Add read/write function pointers to struct nand_ecc_ctrl
Add read/write function pointers to struct nand_ecc_ctrl to prepare the modulaization of nand_read/write functions. The current implementation handles every type of ecc mode software/hardware and all kinds of strange ecc placement schemes in one switch/if construct. Thats too complex to maintain and too inflexible to expand. Modularization will also shorten the code pathes of the read/write functions. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--include/linux/mtd/nand.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h
index 2fd85d55803d..daacde5132fe 100644
--- a/include/linux/mtd/nand.h
+++ b/include/linux/mtd/nand.h
@@ -233,16 +233,23 @@ struct nand_hw_control {
233 * @steps: number of ecc steps per page 233 * @steps: number of ecc steps per page
234 * @size: data bytes per ecc step 234 * @size: data bytes per ecc step
235 * @bytes: ecc bytes per step 235 * @bytes: ecc bytes per step
236 * @total: total number of ecc bytes per page
237 * @prepad: padding information for syndrome based ecc generators
238 * @postpad: padding information for syndrome based ecc generators
236 * @hwctl: function to control hardware ecc generator. Must only 239 * @hwctl: function to control hardware ecc generator. Must only
237 * be provided if an hardware ECC is available 240 * be provided if an hardware ECC is available
238 * @calculate: function for ecc calculation or readback from ecc hardware 241 * @calculate: function for ecc calculation or readback from ecc hardware
239 * @correct: function for ecc correction, matching to ecc generator (sw/hw) 242 * @correct: function for ecc correction, matching to ecc generator (sw/hw)
243 * @write_page: function to write a page according to the ecc generator requirements
240 */ 244 */
241struct nand_ecc_ctrl { 245struct nand_ecc_ctrl {
242 nand_ecc_modes_t mode; 246 nand_ecc_modes_t mode;
243 int steps; 247 int steps;
244 int size; 248 int size;
245 int bytes; 249 int bytes;
250 int total;
251 int prepad;
252 int postpad;
246 void (*hwctl)(struct mtd_info *mtd, int mode); 253 void (*hwctl)(struct mtd_info *mtd, int mode);
247 int (*calculate)(struct mtd_info *mtd, 254 int (*calculate)(struct mtd_info *mtd,
248 const uint8_t *dat, 255 const uint8_t *dat,
@@ -250,6 +257,12 @@ struct nand_ecc_ctrl {
250 int (*correct)(struct mtd_info *mtd, uint8_t *dat, 257 int (*correct)(struct mtd_info *mtd, uint8_t *dat,
251 uint8_t *read_ecc, 258 uint8_t *read_ecc,
252 uint8_t *calc_ecc); 259 uint8_t *calc_ecc);
260 int (*read_page)(struct mtd_info *mtd,
261 struct nand_chip *chip,
262 uint8_t *buf);
263 int (*write_page)(struct mtd_info *mtd,
264 struct nand_chip *chip,
265 uint8_t *buf, int cached);
253}; 266};
254 267
255/** 268/**