diff options
author | Sebastian Andrzej Siewior <bigeasy@linutronix.de> | 2010-10-05 06:41:01 -0400 |
---|---|---|
committer | David Woodhouse <David.Woodhouse@intel.com> | 2010-10-24 19:56:32 -0400 |
commit | a0491fc4d4b584ddc23f412e9a57b05d66a21263 (patch) | |
tree | 5917ac015d84417df9363a93c54fd12f34d178c9 /include | |
parent | 766f271a63d1ee7caed8030736e6aed253d02073 (diff) |
mtd: cleanup nand.h
- *var instead of * var
- proper multiline comment
- func(args) instead of func (args)
- 80 lines
So from
|total: 2 errors, 37 warnings, 654 lines checked
we got to one warning.
Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/mtd/nand.h | 155 |
1 files changed, 99 insertions, 56 deletions
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 023866572fb1..acd0b500f55a 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
@@ -27,15 +27,17 @@ | |||
27 | struct mtd_info; | 27 | struct mtd_info; |
28 | struct nand_flash_dev; | 28 | struct nand_flash_dev; |
29 | /* Scan and identify a NAND device */ | 29 | /* Scan and identify a NAND device */ |
30 | extern int nand_scan (struct mtd_info *mtd, int max_chips); | 30 | extern int nand_scan(struct mtd_info *mtd, int max_chips); |
31 | /* Separate phases of nand_scan(), allowing board driver to intervene | 31 | /* |
32 | * and override command or ECC setup according to flash type */ | 32 | * Separate phases of nand_scan(), allowing board driver to intervene |
33 | * and override command or ECC setup according to flash type. | ||
34 | */ | ||
33 | extern int nand_scan_ident(struct mtd_info *mtd, int max_chips, | 35 | extern int nand_scan_ident(struct mtd_info *mtd, int max_chips, |
34 | struct nand_flash_dev *table); | 36 | struct nand_flash_dev *table); |
35 | extern int nand_scan_tail(struct mtd_info *mtd); | 37 | extern int nand_scan_tail(struct mtd_info *mtd); |
36 | 38 | ||
37 | /* Free resources held by the NAND device */ | 39 | /* Free resources held by the NAND device */ |
38 | extern void nand_release (struct mtd_info *mtd); | 40 | extern void nand_release(struct mtd_info *mtd); |
39 | 41 | ||
40 | /* Internal helper for board drivers which need to override command function */ | 42 | /* Internal helper for board drivers which need to override command function */ |
41 | extern void nand_wait_ready(struct mtd_info *mtd); | 43 | extern void nand_wait_ready(struct mtd_info *mtd); |
@@ -49,7 +51,8 @@ extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len); | |||
49 | /* The maximum number of NAND chips in an array */ | 51 | /* The maximum number of NAND chips in an array */ |
50 | #define NAND_MAX_CHIPS 8 | 52 | #define NAND_MAX_CHIPS 8 |
51 | 53 | ||
52 | /* This constant declares the max. oobsize / page, which | 54 | /* |
55 | * This constant declares the max. oobsize / page, which | ||
53 | * is supported now. If you add a chip with bigger oobsize/page | 56 | * is supported now. If you add a chip with bigger oobsize/page |
54 | * adjust this accordingly. | 57 | * adjust this accordingly. |
55 | */ | 58 | */ |
@@ -153,9 +156,10 @@ typedef enum { | |||
153 | #define NAND_GET_DEVICE 0x80 | 156 | #define NAND_GET_DEVICE 0x80 |
154 | 157 | ||
155 | 158 | ||
156 | /* Option constants for bizarre disfunctionality and real | 159 | /* |
157 | * features | 160 | * Option constants for bizarre disfunctionality and real |
158 | */ | 161 | * features. |
162 | */ | ||
159 | /* Chip can not auto increment pages */ | 163 | /* Chip can not auto increment pages */ |
160 | #define NAND_NO_AUTOINCR 0x00000001 | 164 | #define NAND_NO_AUTOINCR 0x00000001 |
161 | /* Buswitdh is 16 bit */ | 165 | /* Buswitdh is 16 bit */ |
@@ -166,19 +170,27 @@ typedef enum { | |||
166 | #define NAND_CACHEPRG 0x00000008 | 170 | #define NAND_CACHEPRG 0x00000008 |
167 | /* Chip has copy back function */ | 171 | /* Chip has copy back function */ |
168 | #define NAND_COPYBACK 0x00000010 | 172 | #define NAND_COPYBACK 0x00000010 |
169 | /* AND Chip which has 4 banks and a confusing page / block | 173 | /* |
170 | * assignment. See Renesas datasheet for further information */ | 174 | * AND Chip which has 4 banks and a confusing page / block |
175 | * assignment. See Renesas datasheet for further information. | ||
176 | */ | ||
171 | #define NAND_IS_AND 0x00000020 | 177 | #define NAND_IS_AND 0x00000020 |
172 | /* Chip has a array of 4 pages which can be read without | 178 | /* |
173 | * additional ready /busy waits */ | 179 | * Chip has a array of 4 pages which can be read without |
180 | * additional ready /busy waits. | ||
181 | */ | ||
174 | #define NAND_4PAGE_ARRAY 0x00000040 | 182 | #define NAND_4PAGE_ARRAY 0x00000040 |
175 | /* Chip requires that BBT is periodically rewritten to prevent | 183 | /* |
184 | * Chip requires that BBT is periodically rewritten to prevent | ||
176 | * bits from adjacent blocks from 'leaking' in altering data. | 185 | * bits from adjacent blocks from 'leaking' in altering data. |
177 | * This happens with the Renesas AG-AND chips, possibly others. */ | 186 | * This happens with the Renesas AG-AND chips, possibly others. |
187 | */ | ||
178 | #define BBT_AUTO_REFRESH 0x00000080 | 188 | #define BBT_AUTO_REFRESH 0x00000080 |
179 | /* Chip does not require ready check on read. True | 189 | /* |
190 | * Chip does not require ready check on read. True | ||
180 | * for all large page devices, as they do not support | 191 | * for all large page devices, as they do not support |
181 | * autoincrement.*/ | 192 | * autoincrement. |
193 | */ | ||
182 | #define NAND_NO_READRDY 0x00000100 | 194 | #define NAND_NO_READRDY 0x00000100 |
183 | /* Chip does not allow subpage writes */ | 195 | /* Chip does not allow subpage writes */ |
184 | #define NAND_NO_SUBPAGE_WRITE 0x00000200 | 196 | #define NAND_NO_SUBPAGE_WRITE 0x00000200 |
@@ -213,8 +225,10 @@ typedef enum { | |||
213 | #define NAND_USE_FLASH_BBT 0x00010000 | 225 | #define NAND_USE_FLASH_BBT 0x00010000 |
214 | /* This option skips the bbt scan during initialization. */ | 226 | /* This option skips the bbt scan during initialization. */ |
215 | #define NAND_SKIP_BBTSCAN 0x00020000 | 227 | #define NAND_SKIP_BBTSCAN 0x00020000 |
216 | /* This option is defined if the board driver allocates its own buffers | 228 | /* |
217 | (e.g. because it needs them DMA-coherent */ | 229 | * This option is defined if the board driver allocates its own buffers |
230 | * (e.g. because it needs them DMA-coherent). | ||
231 | */ | ||
218 | #define NAND_OWN_BUFFERS 0x00040000 | 232 | #define NAND_OWN_BUFFERS 0x00040000 |
219 | /* Chip may not exist, so silence any errors in scan */ | 233 | /* Chip may not exist, so silence any errors in scan */ |
220 | #define NAND_SCAN_SILENT_NODEV 0x00080000 | 234 | #define NAND_SCAN_SILENT_NODEV 0x00080000 |
@@ -304,8 +318,9 @@ struct nand_onfi_params { | |||
304 | * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices | 318 | * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices |
305 | * @lock: protection lock | 319 | * @lock: protection lock |
306 | * @active: the mtd device which holds the controller currently | 320 | * @active: the mtd device which holds the controller currently |
307 | * @wq: wait queue to sleep on if a NAND operation is in progress | 321 | * @wq: wait queue to sleep on if a NAND operation is in |
308 | * used instead of the per chip wait queue when a hw controller is available | 322 | * progress used instead of the per chip wait queue |
323 | * when a hw controller is available. | ||
309 | */ | 324 | */ |
310 | struct nand_hw_control { | 325 | struct nand_hw_control { |
311 | spinlock_t lock; | 326 | spinlock_t lock; |
@@ -329,9 +344,11 @@ struct nand_hw_control { | |||
329 | * @correct: function for ecc correction, matching to ecc generator (sw/hw) | 344 | * @correct: function for ecc correction, matching to ecc generator (sw/hw) |
330 | * @read_page_raw: function to read a raw page without ECC | 345 | * @read_page_raw: function to read a raw page without ECC |
331 | * @write_page_raw: function to write a raw page without ECC | 346 | * @write_page_raw: function to write a raw page without ECC |
332 | * @read_page: function to read a page according to the ecc generator requirements | 347 | * @read_page: function to read a page according to the ecc generator |
348 | * requirements. | ||
333 | * @read_subpage: function to read parts of the page covered by ECC. | 349 | * @read_subpage: function to read parts of the page covered by ECC. |
334 | * @write_page: function to write a page according to the ecc generator requirements | 350 | * @write_page: function to write a page according to the ecc generator |
351 | * requirements. | ||
335 | * @read_oob: function to read chip OOB data | 352 | * @read_oob: function to read chip OOB data |
336 | * @write_oob: function to write chip OOB data | 353 | * @write_oob: function to write chip OOB data |
337 | */ | 354 | */ |
@@ -393,13 +410,16 @@ struct nand_buffers { | |||
393 | 410 | ||
394 | /** | 411 | /** |
395 | * struct nand_chip - NAND Private Flash Chip Data | 412 | * struct nand_chip - NAND Private Flash Chip Data |
396 | * @IO_ADDR_R: [BOARDSPECIFIC] address to read the 8 I/O lines of the flash device | 413 | * @IO_ADDR_R: [BOARDSPECIFIC] address to read the 8 I/O lines of the |
397 | * @IO_ADDR_W: [BOARDSPECIFIC] address to write the 8 I/O lines of the flash device | 414 | * flash device |
415 | * @IO_ADDR_W: [BOARDSPECIFIC] address to write the 8 I/O lines of the | ||
416 | * flash device. | ||
398 | * @read_byte: [REPLACEABLE] read one byte from the chip | 417 | * @read_byte: [REPLACEABLE] read one byte from the chip |
399 | * @read_word: [REPLACEABLE] read one word from the chip | 418 | * @read_word: [REPLACEABLE] read one word from the chip |
400 | * @write_buf: [REPLACEABLE] write data from the buffer to the chip | 419 | * @write_buf: [REPLACEABLE] write data from the buffer to the chip |
401 | * @read_buf: [REPLACEABLE] read data from the chip into the buffer | 420 | * @read_buf: [REPLACEABLE] read data from the chip into the buffer |
402 | * @verify_buf: [REPLACEABLE] verify buffer contents against the chip data | 421 | * @verify_buf: [REPLACEABLE] verify buffer contents against the chip |
422 | * data. | ||
403 | * @select_chip: [REPLACEABLE] select chip nr | 423 | * @select_chip: [REPLACEABLE] select chip nr |
404 | * @block_bad: [REPLACEABLE] check, if the block is bad | 424 | * @block_bad: [REPLACEABLE] check, if the block is bad |
405 | * @block_markbad: [REPLACEABLE] mark the block bad | 425 | * @block_markbad: [REPLACEABLE] mark the block bad |
@@ -409,45 +429,60 @@ struct nand_buffers { | |||
409 | * mtd->oobsize, mtd->writesize and so on. | 429 | * mtd->oobsize, mtd->writesize and so on. |
410 | * @id_data contains the 8 bytes values of NAND_CMD_READID. | 430 | * @id_data contains the 8 bytes values of NAND_CMD_READID. |
411 | * Return with the bus width. | 431 | * Return with the bus width. |
412 | * @dev_ready: [BOARDSPECIFIC] hardwarespecific function for accesing device ready/busy line | 432 | * @dev_ready: [BOARDSPECIFIC] hardwarespecific function for accesing |
413 | * If set to NULL no access to ready/busy is available and the ready/busy information | 433 | * device ready/busy line. If set to NULL no access to |
414 | * is read from the chip status register | 434 | * ready/busy is available and the ready/busy information |
415 | * @cmdfunc: [REPLACEABLE] hardwarespecific function for writing commands to the chip | 435 | * is read from the chip status register. |
416 | * @waitfunc: [REPLACEABLE] hardwarespecific function for wait on ready | 436 | * @cmdfunc: [REPLACEABLE] hardwarespecific function for writing |
437 | * commands to the chip. | ||
438 | * @waitfunc: [REPLACEABLE] hardwarespecific function for wait on | ||
439 | * ready. | ||
417 | * @ecc: [BOARDSPECIFIC] ecc control ctructure | 440 | * @ecc: [BOARDSPECIFIC] ecc control ctructure |
418 | * @buffers: buffer structure for read/write | 441 | * @buffers: buffer structure for read/write |
419 | * @hwcontrol: platform-specific hardware control structure | 442 | * @hwcontrol: platform-specific hardware control structure |
420 | * @ops: oob operation operands | 443 | * @ops: oob operation operands |
421 | * @erase_cmd: [INTERN] erase command write function, selectable due to AND support | 444 | * @erase_cmd: [INTERN] erase command write function, selectable due |
445 | * to AND support. | ||
422 | * @scan_bbt: [REPLACEABLE] function to scan bad block table | 446 | * @scan_bbt: [REPLACEABLE] function to scan bad block table |
423 | * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transfering data from array to read regs (tR) | 447 | * @chip_delay: [BOARDSPECIFIC] chip dependent delay for transfering |
448 | * data from array to read regs (tR). | ||
424 | * @state: [INTERN] the current state of the NAND device | 449 | * @state: [INTERN] the current state of the NAND device |
425 | * @oob_poi: poison value buffer | 450 | * @oob_poi: poison value buffer |
426 | * @page_shift: [INTERN] number of address bits in a page (column address bits) | 451 | * @page_shift: [INTERN] number of address bits in a page (column |
452 | * address bits). | ||
427 | * @phys_erase_shift: [INTERN] number of address bits in a physical eraseblock | 453 | * @phys_erase_shift: [INTERN] number of address bits in a physical eraseblock |
428 | * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry | 454 | * @bbt_erase_shift: [INTERN] number of address bits in a bbt entry |
429 | * @chip_shift: [INTERN] number of address bits in one chip | 455 | * @chip_shift: [INTERN] number of address bits in one chip |
430 | * @options: [BOARDSPECIFIC] various chip options. They can partly be set to inform nand_scan about | 456 | * @options: [BOARDSPECIFIC] various chip options. They can partly |
431 | * special functionality. See the defines for further explanation | 457 | * be set to inform nand_scan about special functionality. |
432 | * @badblockpos: [INTERN] position of the bad block marker in the oob area | 458 | * See the defines for further explanation. |
459 | * @badblockpos: [INTERN] position of the bad block marker in the oob | ||
460 | * area. | ||
433 | * @cellinfo: [INTERN] MLC/multichip data from chip ident | 461 | * @cellinfo: [INTERN] MLC/multichip data from chip ident |
434 | * @numchips: [INTERN] number of physical chips | 462 | * @numchips: [INTERN] number of physical chips |
435 | * @chipsize: [INTERN] the size of one chip for multichip arrays | 463 | * @chipsize: [INTERN] the size of one chip for multichip arrays |
436 | * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1 | 464 | * @pagemask: [INTERN] page number mask = number of (pages / chip) - 1 |
437 | * @pagebuf: [INTERN] holds the pagenumber which is currently in data_buf | 465 | * @pagebuf: [INTERN] holds the pagenumber which is currently in |
466 | * data_buf. | ||
438 | * @subpagesize: [INTERN] holds the subpagesize | 467 | * @subpagesize: [INTERN] holds the subpagesize |
439 | * @onfi_version: [INTERN] holds the chip ONFI version (BCD encoded), non 0 if ONFI supported | 468 | * @onfi_version: [INTERN] holds the chip ONFI version (BCD encoded), |
440 | * @onfi_params: [INTERN] holds the ONFI page parameter when ONFI is supported, 0 otherwise | 469 | * non 0 if ONFI supported. |
470 | * @onfi_params: [INTERN] holds the ONFI page parameter when ONFI is | ||
471 | * supported, 0 otherwise. | ||
441 | * @ecclayout: [REPLACEABLE] the default ecc placement scheme | 472 | * @ecclayout: [REPLACEABLE] the default ecc placement scheme |
442 | * @bbt: [INTERN] bad block table pointer | 473 | * @bbt: [INTERN] bad block table pointer |
443 | * @bbt_td: [REPLACEABLE] bad block table descriptor for flash lookup | 474 | * @bbt_td: [REPLACEABLE] bad block table descriptor for flash |
475 | * lookup. | ||
444 | * @bbt_md: [REPLACEABLE] bad block table mirror descriptor | 476 | * @bbt_md: [REPLACEABLE] bad block table mirror descriptor |
445 | * @badblock_pattern: [REPLACEABLE] bad block scan pattern used for initial bad block scan | 477 | * @badblock_pattern: [REPLACEABLE] bad block scan pattern used for initial |
446 | * @controller: [REPLACEABLE] a pointer to a hardware controller structure | 478 | * bad block scan. |
447 | * which is shared among multiple independend devices | 479 | * @controller: [REPLACEABLE] a pointer to a hardware controller |
480 | * structure which is shared among multiple independend | ||
481 | * devices. | ||
448 | * @priv: [OPTIONAL] pointer to private chip date | 482 | * @priv: [OPTIONAL] pointer to private chip date |
449 | * @errstat: [OPTIONAL] hardware specific function to perform additional error status checks | 483 | * @errstat: [OPTIONAL] hardware specific function to perform |
450 | * (determine if errors are correctable) | 484 | * additional error status checks (determine if errors are |
485 | * correctable). | ||
451 | * @write_page: [REPLACEABLE] High-level page write function | 486 | * @write_page: [REPLACEABLE] High-level page write function |
452 | */ | 487 | */ |
453 | 488 | ||
@@ -457,24 +492,32 @@ struct nand_chip { | |||
457 | 492 | ||
458 | uint8_t (*read_byte)(struct mtd_info *mtd); | 493 | uint8_t (*read_byte)(struct mtd_info *mtd); |
459 | u16 (*read_word)(struct mtd_info *mtd); | 494 | u16 (*read_word)(struct mtd_info *mtd); |
460 | void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len); | 495 | void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, |
461 | void (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len); | 496 | int len); |
462 | int (*verify_buf)(struct mtd_info *mtd, const uint8_t *buf, int len); | 497 | void (*read_buf)(struct mtd_info *mtd, uint8_t *buf, |
498 | int len); | ||
499 | int (*verify_buf)(struct mtd_info *mtd, const uint8_t *buf, | ||
500 | int len); | ||
463 | void (*select_chip)(struct mtd_info *mtd, int chip); | 501 | void (*select_chip)(struct mtd_info *mtd, int chip); |
464 | int (*block_bad)(struct mtd_info *mtd, loff_t ofs, int getchip); | 502 | int (*block_bad)(struct mtd_info *mtd, loff_t ofs, |
503 | int getchip); | ||
465 | int (*block_markbad)(struct mtd_info *mtd, loff_t ofs); | 504 | int (*block_markbad)(struct mtd_info *mtd, loff_t ofs); |
466 | void (*cmd_ctrl)(struct mtd_info *mtd, int dat, | 505 | void (*cmd_ctrl)(struct mtd_info *mtd, int dat, |
467 | unsigned int ctrl); | 506 | unsigned int ctrl); |
468 | int (*init_size)(struct mtd_info *mtd, | 507 | int (*init_size)(struct mtd_info *mtd, |
469 | struct nand_chip *this, u8 *id_data); | 508 | struct nand_chip *this, u8 *id_data); |
470 | int (*dev_ready)(struct mtd_info *mtd); | 509 | int (*dev_ready)(struct mtd_info *mtd); |
471 | void (*cmdfunc)(struct mtd_info *mtd, unsigned command, int column, int page_addr); | 510 | void (*cmdfunc)(struct mtd_info *mtd, unsigned command, |
472 | int (*waitfunc)(struct mtd_info *mtd, struct nand_chip *this); | 511 | int column, int page_addr); |
512 | int (*waitfunc)(struct mtd_info *mtd, | ||
513 | struct nand_chip *this); | ||
473 | void (*erase_cmd)(struct mtd_info *mtd, int page); | 514 | void (*erase_cmd)(struct mtd_info *mtd, int page); |
474 | int (*scan_bbt)(struct mtd_info *mtd); | 515 | int (*scan_bbt)(struct mtd_info *mtd); |
475 | int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, int state, int status, int page); | 516 | int (*errstat)(struct mtd_info *mtd, struct nand_chip *this, |
476 | int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, | 517 | int state, int status, int page); |
477 | const uint8_t *buf, int page, int cached, int raw); | 518 | int (*write_page)(struct mtd_info *mtd, |
519 | struct nand_chip *chip, const uint8_t *buf, int page, | ||
520 | int cached, int raw); | ||
478 | 521 | ||
479 | int chip_delay; | 522 | int chip_delay; |
480 | unsigned int options; | 523 | unsigned int options; |
@@ -557,7 +600,7 @@ struct nand_flash_dev { | |||
557 | */ | 600 | */ |
558 | struct nand_manufacturers { | 601 | struct nand_manufacturers { |
559 | int id; | 602 | int id; |
560 | char * name; | 603 | char *name; |
561 | }; | 604 | }; |
562 | 605 | ||
563 | extern struct nand_flash_dev nand_flash_ids[]; | 606 | extern struct nand_flash_dev nand_flash_ids[]; |
@@ -570,7 +613,7 @@ extern int nand_isbad_bbt(struct mtd_info *mtd, loff_t offs, int allowbbt); | |||
570 | extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, | 613 | extern int nand_erase_nand(struct mtd_info *mtd, struct erase_info *instr, |
571 | int allowbbt); | 614 | int allowbbt); |
572 | extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len, | 615 | extern int nand_do_read(struct mtd_info *mtd, loff_t from, size_t len, |
573 | size_t * retlen, uint8_t * buf); | 616 | size_t *retlen, uint8_t *buf); |
574 | 617 | ||
575 | /** | 618 | /** |
576 | * struct platform_nand_chip - chip level device structure | 619 | * struct platform_nand_chip - chip level device structure |