diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-09 21:51:35 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2012-10-09 21:51:35 -0400 |
| commit | 10f39f04b2cb7a06ba5d4ea0f20bd156d0367bee (patch) | |
| tree | 758f9736bcf0303da4edd5f52afd8ed10e8ea642 /include/linux | |
| parent | 72055425e53540d9d0e59a57ac8c9b8ce77b62d5 (diff) | |
| parent | f5cf8f07423b2677cebebcebc863af77223a4972 (diff) | |
Merge tag 'for-linus-20121009' of git://git.infradead.org/mtd-2.6
Pull MTD updates from David Woodhouse:
- Disable broken mtdchar mmap() on MMU systems
- Additional ECC tests for NAND flash, and some test cleanups
- New NAND and SPI chip support
- Fixes/cleanup for SH FLCTL NAND controller driver
- Improved hardware support for GPMI NAND controller
- Conversions to device-tree support for various drivers
- Removal of obsolete drivers (sbc8xxx, bcmring, etc.)
- New LPC32xx drivers for MLC and SLC NAND
- Further cleanup of NAND OOB/ECC handling
- UAPI cleanup merge from David Howells (just moving files, since MTD
headers were sorted out long ago to separate user-visible from kernel
bits)
* tag 'for-linus-20121009' of git://git.infradead.org/mtd-2.6: (168 commits)
mtd: Disable mtdchar mmap on MMU systems
UAPI: (Scripted) Disintegrate include/mtd
mtd: nand: detect Samsung K9GBG08U0A, K9GAG08U0F ID
mtd: nand: decode Hynix MLC, 6-byte ID length
mtd: nand: increase max OOB size to 640
mtd: nand: add generic READ ID length calculation functions
mtd: nand: split simple ID decode into its own function
mtd: nand: split extended ID decoding into its own function
mtd: nand: split BB marker options decoding into its own function
mtd: nand: remove redundant ID read
mtd: nand: remove unnecessary variable
mtd: docg4: add missing HAS_IOMEM dependency
mtd: gpmi: initialize the timing registers only one time
mtd: gpmi: add EDO feature for imx6q
mtd: gpmi: do not set the default values for the extra clocks
mtd: gpmi: simplify the DLL setting code
mtd: gpmi: add a new field for HW_GPMI_CTRL1
mtd: gpmi: do not get the clock frequency in gpmi_begin()
mtd: gpmi: add a new field for HW_GPMI_TIMING1
mtd: add helpers to get the supportted ONFI timing mode
...
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/bcma/bcma_driver_chipcommon.h | 2 | ||||
| -rw-r--r-- | include/linux/mtd/bbm.h | 7 | ||||
| -rw-r--r-- | include/linux/mtd/lpc32xx_mlc.h | 20 | ||||
| -rw-r--r-- | include/linux/mtd/lpc32xx_slc.h | 20 | ||||
| -rw-r--r-- | include/linux/mtd/mtd.h | 9 | ||||
| -rw-r--r-- | include/linux/mtd/nand.h | 72 | ||||
| -rw-r--r-- | include/linux/mtd/sh_flctl.h | 23 |
7 files changed, 115 insertions, 38 deletions
diff --git a/include/linux/bcma/bcma_driver_chipcommon.h b/include/linux/bcma/bcma_driver_chipcommon.h index 6ba45d2b99db..1cf1749440ac 100644 --- a/include/linux/bcma/bcma_driver_chipcommon.h +++ b/include/linux/bcma/bcma_driver_chipcommon.h | |||
| @@ -522,6 +522,8 @@ struct bcma_sflash { | |||
| 522 | u32 blocksize; | 522 | u32 blocksize; |
| 523 | u16 numblocks; | 523 | u16 numblocks; |
| 524 | u32 size; | 524 | u32 size; |
| 525 | |||
| 526 | struct mtd_info *mtd; | ||
| 525 | }; | 527 | }; |
| 526 | #endif | 528 | #endif |
| 527 | 529 | ||
diff --git a/include/linux/mtd/bbm.h b/include/linux/mtd/bbm.h index 650ef352f045..211ff67e8b0d 100644 --- a/include/linux/mtd/bbm.h +++ b/include/linux/mtd/bbm.h | |||
| @@ -78,8 +78,6 @@ struct nand_bbt_descr { | |||
| 78 | #define NAND_BBT_LASTBLOCK 0x00000010 | 78 | #define NAND_BBT_LASTBLOCK 0x00000010 |
| 79 | /* The bbt is at the given page, else we must scan for the bbt */ | 79 | /* The bbt is at the given page, else we must scan for the bbt */ |
| 80 | #define NAND_BBT_ABSPAGE 0x00000020 | 80 | #define NAND_BBT_ABSPAGE 0x00000020 |
| 81 | /* The bbt is at the given page, else we must scan for the bbt */ | ||
| 82 | #define NAND_BBT_SEARCH 0x00000040 | ||
| 83 | /* bbt is stored per chip on multichip devices */ | 81 | /* bbt is stored per chip on multichip devices */ |
| 84 | #define NAND_BBT_PERCHIP 0x00000080 | 82 | #define NAND_BBT_PERCHIP 0x00000080 |
| 85 | /* bbt has a version counter at offset veroffs */ | 83 | /* bbt has a version counter at offset veroffs */ |
| @@ -110,7 +108,10 @@ struct nand_bbt_descr { | |||
| 110 | * OOB area. This option is passed to the default bad block table function. | 108 | * OOB area. This option is passed to the default bad block table function. |
| 111 | */ | 109 | */ |
| 112 | #define NAND_BBT_USE_FLASH 0x00020000 | 110 | #define NAND_BBT_USE_FLASH 0x00020000 |
| 113 | /* Do not store flash based bad block table in OOB area; store it in-band */ | 111 | /* |
| 112 | * Do not store flash based bad block table marker in the OOB area; store it | ||
| 113 | * in-band. | ||
| 114 | */ | ||
| 114 | #define NAND_BBT_NO_OOB 0x00040000 | 115 | #define NAND_BBT_NO_OOB 0x00040000 |
| 115 | /* | 116 | /* |
| 116 | * Do not write new bad block markers to OOB; useful, e.g., when ECC covers | 117 | * Do not write new bad block markers to OOB; useful, e.g., when ECC covers |
diff --git a/include/linux/mtd/lpc32xx_mlc.h b/include/linux/mtd/lpc32xx_mlc.h new file mode 100644 index 000000000000..d91b1e35631e --- /dev/null +++ b/include/linux/mtd/lpc32xx_mlc.h | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | /* | ||
| 2 | * Platform data for LPC32xx SoC MLC NAND controller | ||
| 3 | * | ||
| 4 | * Copyright © 2012 Roland Stigge | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License version 2 as | ||
| 8 | * published by the Free Software Foundation. | ||
| 9 | */ | ||
| 10 | |||
| 11 | #ifndef __LINUX_MTD_LPC32XX_MLC_H | ||
| 12 | #define __LINUX_MTD_LPC32XX_MLC_H | ||
| 13 | |||
| 14 | #include <linux/dmaengine.h> | ||
| 15 | |||
| 16 | struct lpc32xx_mlc_platform_data { | ||
| 17 | bool (*dma_filter)(struct dma_chan *chan, void *filter_param); | ||
| 18 | }; | ||
| 19 | |||
| 20 | #endif /* __LINUX_MTD_LPC32XX_MLC_H */ | ||
diff --git a/include/linux/mtd/lpc32xx_slc.h b/include/linux/mtd/lpc32xx_slc.h new file mode 100644 index 000000000000..1169548a1535 --- /dev/null +++ b/include/linux/mtd/lpc32xx_slc.h | |||
| @@ -0,0 +1,20 @@ | |||
| 1 | /* | ||
| 2 | * Platform data for LPC32xx SoC SLC NAND controller | ||
| 3 | * | ||
| 4 | * Copyright © 2012 Roland Stigge | ||
| 5 | * | ||
| 6 | * This program is free software; you can redistribute it and/or modify | ||
| 7 | * it under the terms of the GNU General Public License version 2 as | ||
| 8 | * published by the Free Software Foundation. | ||
| 9 | */ | ||
| 10 | |||
| 11 | #ifndef __LINUX_MTD_LPC32XX_SLC_H | ||
| 12 | #define __LINUX_MTD_LPC32XX_SLC_H | ||
| 13 | |||
| 14 | #include <linux/dmaengine.h> | ||
| 15 | |||
| 16 | struct lpc32xx_slc_platform_data { | ||
| 17 | bool (*dma_filter)(struct dma_chan *chan, void *filter_param); | ||
| 18 | }; | ||
| 19 | |||
| 20 | #endif /* __LINUX_MTD_LPC32XX_SLC_H */ | ||
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 63dadc0dfb62..81d61e704599 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
| @@ -265,14 +265,7 @@ int mtd_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, | |||
| 265 | int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, | 265 | int mtd_panic_write(struct mtd_info *mtd, loff_t to, size_t len, size_t *retlen, |
| 266 | const u_char *buf); | 266 | const u_char *buf); |
| 267 | 267 | ||
| 268 | static inline int mtd_read_oob(struct mtd_info *mtd, loff_t from, | 268 | int mtd_read_oob(struct mtd_info *mtd, loff_t from, struct mtd_oob_ops *ops); |
| 269 | struct mtd_oob_ops *ops) | ||
| 270 | { | ||
| 271 | ops->retlen = ops->oobretlen = 0; | ||
| 272 | if (!mtd->_read_oob) | ||
| 273 | return -EOPNOTSUPP; | ||
| 274 | return mtd->_read_oob(mtd, from, ops); | ||
| 275 | } | ||
| 276 | 269 | ||
| 277 | static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to, | 270 | static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to, |
| 278 | struct mtd_oob_ops *ops) | 271 | struct mtd_oob_ops *ops) |
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 57977c640529..24e915957e4f 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
| @@ -56,7 +56,7 @@ extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len); | |||
| 56 | * 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 |
| 57 | * adjust this accordingly. | 57 | * adjust this accordingly. |
| 58 | */ | 58 | */ |
| 59 | #define NAND_MAX_OOBSIZE 576 | 59 | #define NAND_MAX_OOBSIZE 640 |
| 60 | #define NAND_MAX_PAGESIZE 8192 | 60 | #define NAND_MAX_PAGESIZE 8192 |
| 61 | 61 | ||
| 62 | /* | 62 | /* |
| @@ -92,6 +92,8 @@ extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len); | |||
| 92 | #define NAND_CMD_READID 0x90 | 92 | #define NAND_CMD_READID 0x90 |
| 93 | #define NAND_CMD_ERASE2 0xd0 | 93 | #define NAND_CMD_ERASE2 0xd0 |
| 94 | #define NAND_CMD_PARAM 0xec | 94 | #define NAND_CMD_PARAM 0xec |
| 95 | #define NAND_CMD_GET_FEATURES 0xee | ||
| 96 | #define NAND_CMD_SET_FEATURES 0xef | ||
| 95 | #define NAND_CMD_RESET 0xff | 97 | #define NAND_CMD_RESET 0xff |
| 96 | 98 | ||
| 97 | #define NAND_CMD_LOCK 0x2a | 99 | #define NAND_CMD_LOCK 0x2a |
| @@ -185,12 +187,6 @@ typedef enum { | |||
| 185 | * This happens with the Renesas AG-AND chips, possibly others. | 187 | * This happens with the Renesas AG-AND chips, possibly others. |
| 186 | */ | 188 | */ |
| 187 | #define BBT_AUTO_REFRESH 0x00000080 | 189 | #define BBT_AUTO_REFRESH 0x00000080 |
| 188 | /* | ||
| 189 | * Chip does not require ready check on read. True | ||
| 190 | * for all large page devices, as they do not support | ||
| 191 | * autoincrement. | ||
| 192 | */ | ||
| 193 | #define NAND_NO_READRDY 0x00000100 | ||
| 194 | /* Chip does not allow subpage writes */ | 190 | /* Chip does not allow subpage writes */ |
| 195 | #define NAND_NO_SUBPAGE_WRITE 0x00000200 | 191 | #define NAND_NO_SUBPAGE_WRITE 0x00000200 |
| 196 | 192 | ||
| @@ -200,6 +196,9 @@ typedef enum { | |||
| 200 | /* Device behaves just like nand, but is readonly */ | 196 | /* Device behaves just like nand, but is readonly */ |
| 201 | #define NAND_ROM 0x00000800 | 197 | #define NAND_ROM 0x00000800 |
| 202 | 198 | ||
| 199 | /* Device supports subpage reads */ | ||
| 200 | #define NAND_SUBPAGE_READ 0x00001000 | ||
| 201 | |||
| 203 | /* Options valid for Samsung large page devices */ | 202 | /* Options valid for Samsung large page devices */ |
| 204 | #define NAND_SAMSUNG_LP_OPTIONS \ | 203 | #define NAND_SAMSUNG_LP_OPTIONS \ |
| 205 | (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK) | 204 | (NAND_NO_PADDING | NAND_CACHEPRG | NAND_COPYBACK) |
| @@ -208,12 +207,7 @@ typedef enum { | |||
| 208 | #define NAND_MUST_PAD(chip) (!(chip->options & NAND_NO_PADDING)) | 207 | #define NAND_MUST_PAD(chip) (!(chip->options & NAND_NO_PADDING)) |
| 209 | #define NAND_HAS_CACHEPROG(chip) ((chip->options & NAND_CACHEPRG)) | 208 | #define NAND_HAS_CACHEPROG(chip) ((chip->options & NAND_CACHEPRG)) |
| 210 | #define NAND_HAS_COPYBACK(chip) ((chip->options & NAND_COPYBACK)) | 209 | #define NAND_HAS_COPYBACK(chip) ((chip->options & NAND_COPYBACK)) |
| 211 | /* Large page NAND with SOFT_ECC should support subpage reads */ | 210 | #define NAND_HAS_SUBPAGE_READ(chip) ((chip->options & NAND_SUBPAGE_READ)) |
| 212 | #define NAND_SUBPAGE_READ(chip) ((chip->ecc.mode == NAND_ECC_SOFT) \ | ||
| 213 | && (chip->page_shift > 9)) | ||
| 214 | |||
| 215 | /* Mask to zero out the chip options, which come from the id table */ | ||
| 216 | #define NAND_CHIPOPTIONS_MSK 0x0000ffff | ||
| 217 | 211 | ||
| 218 | /* Non chip related options */ | 212 | /* Non chip related options */ |
| 219 | /* This option skips the bbt scan during initialization. */ | 213 | /* This option skips the bbt scan during initialization. */ |
| @@ -237,6 +231,21 @@ typedef enum { | |||
| 237 | /* Keep gcc happy */ | 231 | /* Keep gcc happy */ |
| 238 | struct nand_chip; | 232 | struct nand_chip; |
| 239 | 233 | ||
| 234 | /* ONFI timing mode, used in both asynchronous and synchronous mode */ | ||
| 235 | #define ONFI_TIMING_MODE_0 (1 << 0) | ||
| 236 | #define ONFI_TIMING_MODE_1 (1 << 1) | ||
| 237 | #define ONFI_TIMING_MODE_2 (1 << 2) | ||
| 238 | #define ONFI_TIMING_MODE_3 (1 << 3) | ||
| 239 | #define ONFI_TIMING_MODE_4 (1 << 4) | ||
| 240 | #define ONFI_TIMING_MODE_5 (1 << 5) | ||
| 241 | #define ONFI_TIMING_MODE_UNKNOWN (1 << 6) | ||
| 242 | |||
| 243 | /* ONFI feature address */ | ||
| 244 | #define ONFI_FEATURE_ADDR_TIMING_MODE 0x1 | ||
| 245 | |||
| 246 | /* ONFI subfeature parameters length */ | ||
| 247 | #define ONFI_SUBFEATURE_PARAM_LEN 4 | ||
| 248 | |||
| 240 | struct nand_onfi_params { | 249 | struct nand_onfi_params { |
| 241 | /* rev info and features block */ | 250 | /* rev info and features block */ |
| 242 | /* 'O' 'N' 'F' 'I' */ | 251 | /* 'O' 'N' 'F' 'I' */ |
| @@ -334,8 +343,10 @@ struct nand_hw_control { | |||
| 334 | * @read_page_raw: function to read a raw page without ECC | 343 | * @read_page_raw: function to read a raw page without ECC |
| 335 | * @write_page_raw: function to write a raw page without ECC | 344 | * @write_page_raw: function to write a raw page without ECC |
| 336 | * @read_page: function to read a page according to the ECC generator | 345 | * @read_page: function to read a page according to the ECC generator |
| 337 | * requirements. | 346 | * requirements; returns maximum number of bitflips corrected in |
| 338 | * @read_subpage: function to read parts of the page covered by ECC. | 347 | * any single ECC step, 0 if bitflips uncorrectable, -EIO hw error |
| 348 | * @read_subpage: function to read parts of the page covered by ECC; | ||
| 349 | * returns same as read_page() | ||
| 339 | * @write_page: function to write a page according to the ECC generator | 350 | * @write_page: function to write a page according to the ECC generator |
| 340 | * requirements. | 351 | * requirements. |
| 341 | * @write_oob_raw: function to write chip OOB data without ECC | 352 | * @write_oob_raw: function to write chip OOB data without ECC |
| @@ -361,13 +372,13 @@ struct nand_ecc_ctrl { | |||
| 361 | uint8_t *calc_ecc); | 372 | uint8_t *calc_ecc); |
| 362 | int (*read_page_raw)(struct mtd_info *mtd, struct nand_chip *chip, | 373 | int (*read_page_raw)(struct mtd_info *mtd, struct nand_chip *chip, |
| 363 | uint8_t *buf, int oob_required, int page); | 374 | uint8_t *buf, int oob_required, int page); |
| 364 | void (*write_page_raw)(struct mtd_info *mtd, struct nand_chip *chip, | 375 | int (*write_page_raw)(struct mtd_info *mtd, struct nand_chip *chip, |
| 365 | const uint8_t *buf, int oob_required); | 376 | const uint8_t *buf, int oob_required); |
| 366 | int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip, | 377 | int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip, |
| 367 | uint8_t *buf, int oob_required, int page); | 378 | uint8_t *buf, int oob_required, int page); |
| 368 | int (*read_subpage)(struct mtd_info *mtd, struct nand_chip *chip, | 379 | int (*read_subpage)(struct mtd_info *mtd, struct nand_chip *chip, |
| 369 | uint32_t offs, uint32_t len, uint8_t *buf); | 380 | uint32_t offs, uint32_t len, uint8_t *buf); |
| 370 | void (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, | 381 | int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, |
| 371 | const uint8_t *buf, int oob_required); | 382 | const uint8_t *buf, int oob_required); |
| 372 | int (*write_oob_raw)(struct mtd_info *mtd, struct nand_chip *chip, | 383 | int (*write_oob_raw)(struct mtd_info *mtd, struct nand_chip *chip, |
| 373 | int page); | 384 | int page); |
| @@ -403,8 +414,6 @@ struct nand_buffers { | |||
| 403 | * @read_word: [REPLACEABLE] read one word from the chip | 414 | * @read_word: [REPLACEABLE] read one word from the chip |
| 404 | * @write_buf: [REPLACEABLE] write data from the buffer to the chip | 415 | * @write_buf: [REPLACEABLE] write data from the buffer to the chip |
| 405 | * @read_buf: [REPLACEABLE] read data from the chip into the buffer | 416 | * @read_buf: [REPLACEABLE] read data from the chip into the buffer |
| 406 | * @verify_buf: [REPLACEABLE] verify buffer contents against the chip | ||
| 407 | * data. | ||
| 408 | * @select_chip: [REPLACEABLE] select chip nr | 417 | * @select_chip: [REPLACEABLE] select chip nr |
| 409 | * @block_bad: [REPLACEABLE] check, if the block is bad | 418 | * @block_bad: [REPLACEABLE] check, if the block is bad |
| 410 | * @block_markbad: [REPLACEABLE] mark the block bad | 419 | * @block_markbad: [REPLACEABLE] mark the block bad |
| @@ -462,6 +471,8 @@ struct nand_buffers { | |||
| 462 | * non 0 if ONFI supported. | 471 | * non 0 if ONFI supported. |
| 463 | * @onfi_params: [INTERN] holds the ONFI page parameter when ONFI is | 472 | * @onfi_params: [INTERN] holds the ONFI page parameter when ONFI is |
| 464 | * supported, 0 otherwise. | 473 | * supported, 0 otherwise. |
| 474 | * @onfi_set_features [REPLACEABLE] set the features for ONFI nand | ||
| 475 | * @onfi_get_features [REPLACEABLE] get the features for ONFI nand | ||
| 465 | * @ecclayout: [REPLACEABLE] the default ECC placement scheme | 476 | * @ecclayout: [REPLACEABLE] the default ECC placement scheme |
| 466 | * @bbt: [INTERN] bad block table pointer | 477 | * @bbt: [INTERN] bad block table pointer |
| 467 | * @bbt_td: [REPLACEABLE] bad block table descriptor for flash | 478 | * @bbt_td: [REPLACEABLE] bad block table descriptor for flash |
| @@ -487,7 +498,6 @@ struct nand_chip { | |||
| 487 | u16 (*read_word)(struct mtd_info *mtd); | 498 | u16 (*read_word)(struct mtd_info *mtd); |
| 488 | void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len); | 499 | void (*write_buf)(struct mtd_info *mtd, const uint8_t *buf, int len); |
| 489 | void (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len); | 500 | void (*read_buf)(struct mtd_info *mtd, uint8_t *buf, int len); |
| 490 | int (*verify_buf)(struct mtd_info *mtd, const uint8_t *buf, int len); | ||
| 491 | void (*select_chip)(struct mtd_info *mtd, int chip); | 501 | void (*select_chip)(struct mtd_info *mtd, int chip); |
| 492 | int (*block_bad)(struct mtd_info *mtd, loff_t ofs, int getchip); | 502 | int (*block_bad)(struct mtd_info *mtd, loff_t ofs, int getchip); |
| 493 | int (*block_markbad)(struct mtd_info *mtd, loff_t ofs); | 503 | int (*block_markbad)(struct mtd_info *mtd, loff_t ofs); |
| @@ -505,6 +515,10 @@ struct nand_chip { | |||
| 505 | int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, | 515 | int (*write_page)(struct mtd_info *mtd, struct nand_chip *chip, |
| 506 | const uint8_t *buf, int oob_required, int page, | 516 | const uint8_t *buf, int oob_required, int page, |
| 507 | int cached, int raw); | 517 | int cached, int raw); |
| 518 | int (*onfi_set_features)(struct mtd_info *mtd, struct nand_chip *chip, | ||
| 519 | int feature_addr, uint8_t *subfeature_para); | ||
| 520 | int (*onfi_get_features)(struct mtd_info *mtd, struct nand_chip *chip, | ||
| 521 | int feature_addr, uint8_t *subfeature_para); | ||
| 508 | 522 | ||
| 509 | int chip_delay; | 523 | int chip_delay; |
| 510 | unsigned int options; | 524 | unsigned int options; |
| @@ -559,6 +573,7 @@ struct nand_chip { | |||
| 559 | #define NAND_MFR_MICRON 0x2c | 573 | #define NAND_MFR_MICRON 0x2c |
| 560 | #define NAND_MFR_AMD 0x01 | 574 | #define NAND_MFR_AMD 0x01 |
| 561 | #define NAND_MFR_MACRONIX 0xc2 | 575 | #define NAND_MFR_MACRONIX 0xc2 |
| 576 | #define NAND_MFR_EON 0x92 | ||
| 562 | 577 | ||
| 563 | /** | 578 | /** |
| 564 | * struct nand_flash_dev - NAND Flash Device ID Structure | 579 | * struct nand_flash_dev - NAND Flash Device ID Structure |
| @@ -641,6 +656,7 @@ struct platform_device; | |||
| 641 | * ALE/CLE/nCE. Also used to write command and address | 656 | * ALE/CLE/nCE. Also used to write command and address |
| 642 | * @write_buf: platform specific function for write buffer | 657 | * @write_buf: platform specific function for write buffer |
| 643 | * @read_buf: platform specific function for read buffer | 658 | * @read_buf: platform specific function for read buffer |
| 659 | * @read_byte: platform specific function to read one byte from chip | ||
| 644 | * @priv: private data to transport driver specific settings | 660 | * @priv: private data to transport driver specific settings |
| 645 | * | 661 | * |
| 646 | * All fields are optional and depend on the hardware driver requirements | 662 | * All fields are optional and depend on the hardware driver requirements |
| @@ -677,4 +693,20 @@ struct platform_nand_chip *get_platform_nandchip(struct mtd_info *mtd) | |||
| 677 | return chip->priv; | 693 | return chip->priv; |
| 678 | } | 694 | } |
| 679 | 695 | ||
| 696 | /* return the supported asynchronous timing mode. */ | ||
| 697 | static inline int onfi_get_async_timing_mode(struct nand_chip *chip) | ||
| 698 | { | ||
| 699 | if (!chip->onfi_version) | ||
| 700 | return ONFI_TIMING_MODE_UNKNOWN; | ||
| 701 | return le16_to_cpu(chip->onfi_params.async_timing_mode); | ||
| 702 | } | ||
| 703 | |||
| 704 | /* return the supported synchronous timing mode. */ | ||
| 705 | static inline int onfi_get_sync_timing_mode(struct nand_chip *chip) | ||
| 706 | { | ||
| 707 | if (!chip->onfi_version) | ||
| 708 | return ONFI_TIMING_MODE_UNKNOWN; | ||
| 709 | return le16_to_cpu(chip->onfi_params.src_sync_timing_mode); | ||
| 710 | } | ||
| 711 | |||
| 680 | #endif /* __LINUX_MTD_NAND_H */ | 712 | #endif /* __LINUX_MTD_NAND_H */ |
diff --git a/include/linux/mtd/sh_flctl.h b/include/linux/mtd/sh_flctl.h index a38e1fa8af01..01e4b15b280e 100644 --- a/include/linux/mtd/sh_flctl.h +++ b/include/linux/mtd/sh_flctl.h | |||
| @@ -49,7 +49,6 @@ | |||
| 49 | #define FLERRADR(f) (f->reg + 0x98) | 49 | #define FLERRADR(f) (f->reg + 0x98) |
| 50 | 50 | ||
| 51 | /* FLCMNCR control bits */ | 51 | /* FLCMNCR control bits */ |
| 52 | #define ECCPOS2 (0x1 << 25) | ||
| 53 | #define _4ECCCNTEN (0x1 << 24) | 52 | #define _4ECCCNTEN (0x1 << 24) |
| 54 | #define _4ECCEN (0x1 << 23) | 53 | #define _4ECCEN (0x1 << 23) |
| 55 | #define _4ECCCORRECT (0x1 << 22) | 54 | #define _4ECCCORRECT (0x1 << 22) |
| @@ -59,9 +58,6 @@ | |||
| 59 | #define QTSEL_E (0x1 << 17) | 58 | #define QTSEL_E (0x1 << 17) |
| 60 | #define ENDIAN (0x1 << 16) /* 1 = little endian */ | 59 | #define ENDIAN (0x1 << 16) /* 1 = little endian */ |
| 61 | #define FCKSEL_E (0x1 << 15) | 60 | #define FCKSEL_E (0x1 << 15) |
| 62 | #define ECCPOS_00 (0x00 << 12) | ||
| 63 | #define ECCPOS_01 (0x01 << 12) | ||
| 64 | #define ECCPOS_02 (0x02 << 12) | ||
| 65 | #define ACM_SACCES_MODE (0x01 << 10) | 61 | #define ACM_SACCES_MODE (0x01 << 10) |
| 66 | #define NANWF_E (0x1 << 9) | 62 | #define NANWF_E (0x1 << 9) |
| 67 | #define SE_D (0x1 << 8) /* Spare area disable */ | 63 | #define SE_D (0x1 << 8) /* Spare area disable */ |
| @@ -107,6 +103,14 @@ | |||
| 107 | #define DOCMD2_E (0x1 << 17) /* 2nd cmd stage execute */ | 103 | #define DOCMD2_E (0x1 << 17) /* 2nd cmd stage execute */ |
| 108 | #define DOCMD1_E (0x1 << 16) /* 1st cmd stage execute */ | 104 | #define DOCMD1_E (0x1 << 16) /* 1st cmd stage execute */ |
| 109 | 105 | ||
| 106 | /* FLINTDMACR control bits */ | ||
| 107 | #define ESTERINTE (0x1 << 24) /* ECC error interrupt enable */ | ||
| 108 | #define AC1CLR (0x1 << 19) /* ECC FIFO clear */ | ||
| 109 | #define AC0CLR (0x1 << 18) /* Data FIFO clear */ | ||
| 110 | #define ECERB (0x1 << 9) /* ECC error */ | ||
| 111 | #define STERB (0x1 << 8) /* Status error */ | ||
| 112 | #define STERINTE (0x1 << 4) /* Status error enable */ | ||
| 113 | |||
| 110 | /* FLTRCR control bits */ | 114 | /* FLTRCR control bits */ |
| 111 | #define TRSTRT (0x1 << 0) /* translation start */ | 115 | #define TRSTRT (0x1 << 0) /* translation start */ |
| 112 | #define TREND (0x1 << 1) /* translation end */ | 116 | #define TREND (0x1 << 1) /* translation end */ |
| @@ -125,9 +129,15 @@ | |||
| 125 | #define _4ECCEND (0x1 << 1) /* 4 symbols end */ | 129 | #define _4ECCEND (0x1 << 1) /* 4 symbols end */ |
| 126 | #define _4ECCEXST (0x1 << 0) /* 4 symbols exist */ | 130 | #define _4ECCEXST (0x1 << 0) /* 4 symbols exist */ |
| 127 | 131 | ||
| 128 | #define INIT_FL4ECCRESULT_VAL 0x03FF03FF | ||
| 129 | #define LOOP_TIMEOUT_MAX 0x00010000 | 132 | #define LOOP_TIMEOUT_MAX 0x00010000 |
| 130 | 133 | ||
| 134 | enum flctl_ecc_res_t { | ||
| 135 | FL_SUCCESS, | ||
| 136 | FL_REPAIRABLE, | ||
| 137 | FL_ERROR, | ||
| 138 | FL_TIMEOUT | ||
| 139 | }; | ||
| 140 | |||
| 131 | struct sh_flctl { | 141 | struct sh_flctl { |
| 132 | struct mtd_info mtd; | 142 | struct mtd_info mtd; |
| 133 | struct nand_chip chip; | 143 | struct nand_chip chip; |
| @@ -145,8 +155,7 @@ struct sh_flctl { | |||
| 145 | uint32_t erase_ADRCNT; /* bits of FLCMDCR in ERASE1 cmd */ | 155 | uint32_t erase_ADRCNT; /* bits of FLCMDCR in ERASE1 cmd */ |
| 146 | uint32_t rw_ADRCNT; /* bits of FLCMDCR in READ WRITE cmd */ | 156 | uint32_t rw_ADRCNT; /* bits of FLCMDCR in READ WRITE cmd */ |
| 147 | uint32_t flcmncr_base; /* base value of FLCMNCR */ | 157 | uint32_t flcmncr_base; /* base value of FLCMNCR */ |
| 148 | 158 | uint32_t flintdmacr_base; /* irq enable bits */ | |
| 149 | int hwecc_cant_correct[4]; | ||
| 150 | 159 | ||
| 151 | unsigned page_size:1; /* NAND page size (0 = 512, 1 = 2048) */ | 160 | unsigned page_size:1; /* NAND page size (0 = 512, 1 = 2048) */ |
| 152 | unsigned hwecc:1; /* Hardware ECC (0 = disabled, 1 = enabled) */ | 161 | unsigned hwecc:1; /* Hardware ECC (0 = disabled, 1 = enabled) */ |
