diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-07 13:17:30 -0400 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-07 13:17:30 -0400 |
| commit | c29aa153ef0469cddf0146d41ce6494bd76be78b (patch) | |
| tree | b49af4e6cf54e9988dd45640a86c4de7f49ddf6d /include/linux | |
| parent | 2b3a8fd735f86ebeb2b9d061054003000c36b654 (diff) | |
| parent | 4a4163caccae97a23d97c29032664ee7b7a498d0 (diff) | |
Merge tag 'for-linus-20140405' of git://git.infradead.org/linux-mtd
Pull MTD updates from Brian Norris:
- A few SPI NOR ID definitions
- Kill the NAND "max pagesize" restriction
- Fix some x16 bus-width NAND support
- Add NAND JEDEC parameter page support
- DT bindings for NAND ECC
- GPMI NAND updates (subpage reads)
- More OMAP NAND refactoring
- New STMicro SPI NOR driver (now in 40 patches!)
- A few other random bugfixes
* tag 'for-linus-20140405' of git://git.infradead.org/linux-mtd: (120 commits)
Fix index regression in nand_read_subpage
mtd: diskonchip: mem resource name is not optional
mtd: nand: fix mention to CONFIG_MTD_NAND_ECC_BCH
mtd: nand: fix GET/SET_FEATURES address on 16-bit devices
mtd: omap2: Use devm_ioremap_resource()
mtd: denali_dt: Use devm_ioremap_resource()
mtd: devices: elm: update DRIVER_NAME as "omap-elm"
mtd: devices: elm: configure parallel channels based on ecc_steps
mtd: devices: elm: clean elm_load_syndrome
mtd: devices: elm: check for hardware engine's design constraints
mtd: st_spi_fsm: Succinctly reorganise .remove()
mtd: st_spi_fsm: Allow loop to run at least once before giving up CPU
mtd: st_spi_fsm: Correct vendor name spelling issue - missing "M"
mtd: st_spi_fsm: Avoid duplicating MTD core code
mtd: st_spi_fsm: Remove useless consts from function arguments
mtd: st_spi_fsm: Convert ST SPI FSM (NOR) Flash driver to new DT partitions
mtd: st_spi_fsm: Move runtime configurable msg sequences into device's struct
mtd: st_spi_fsm: Supply the W25Qxxx chip specific configuration call-back
mtd: st_spi_fsm: Supply the S25FLxxx chip specific configuration call-back
mtd: st_spi_fsm: Supply the MX25xxx chip specific configuration call-back
...
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/mtd/mtd.h | 16 | ||||
| -rw-r--r-- | include/linux/mtd/nand.h | 135 | ||||
| -rw-r--r-- | include/linux/of_mtd.h | 12 | ||||
| -rw-r--r-- | include/linux/platform_data/elm.h | 10 | ||||
| -rw-r--r-- | include/linux/platform_data/mtd-nand-s3c2410.h | 8 |
5 files changed, 147 insertions, 34 deletions
diff --git a/include/linux/mtd/mtd.h b/include/linux/mtd/mtd.h index 8cc0e2fb6894..a1b0b4c8fd79 100644 --- a/include/linux/mtd/mtd.h +++ b/include/linux/mtd/mtd.h | |||
| @@ -204,12 +204,12 @@ struct mtd_info { | |||
| 204 | struct mtd_oob_ops *ops); | 204 | struct mtd_oob_ops *ops); |
| 205 | int (*_write_oob) (struct mtd_info *mtd, loff_t to, | 205 | int (*_write_oob) (struct mtd_info *mtd, loff_t to, |
| 206 | struct mtd_oob_ops *ops); | 206 | struct mtd_oob_ops *ops); |
| 207 | int (*_get_fact_prot_info) (struct mtd_info *mtd, struct otp_info *buf, | 207 | int (*_get_fact_prot_info) (struct mtd_info *mtd, size_t len, |
| 208 | size_t len); | 208 | size_t *retlen, struct otp_info *buf); |
| 209 | int (*_read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, | 209 | int (*_read_fact_prot_reg) (struct mtd_info *mtd, loff_t from, |
| 210 | size_t len, size_t *retlen, u_char *buf); | 210 | size_t len, size_t *retlen, u_char *buf); |
| 211 | int (*_get_user_prot_info) (struct mtd_info *mtd, struct otp_info *buf, | 211 | int (*_get_user_prot_info) (struct mtd_info *mtd, size_t len, |
| 212 | size_t len); | 212 | size_t *retlen, struct otp_info *buf); |
| 213 | int (*_read_user_prot_reg) (struct mtd_info *mtd, loff_t from, | 213 | int (*_read_user_prot_reg) (struct mtd_info *mtd, loff_t from, |
| 214 | size_t len, size_t *retlen, u_char *buf); | 214 | size_t len, size_t *retlen, u_char *buf); |
| 215 | int (*_write_user_prot_reg) (struct mtd_info *mtd, loff_t to, | 215 | int (*_write_user_prot_reg) (struct mtd_info *mtd, loff_t to, |
| @@ -278,12 +278,12 @@ static inline int mtd_write_oob(struct mtd_info *mtd, loff_t to, | |||
| 278 | return mtd->_write_oob(mtd, to, ops); | 278 | return mtd->_write_oob(mtd, to, ops); |
| 279 | } | 279 | } |
| 280 | 280 | ||
| 281 | int mtd_get_fact_prot_info(struct mtd_info *mtd, struct otp_info *buf, | 281 | int mtd_get_fact_prot_info(struct mtd_info *mtd, size_t len, size_t *retlen, |
| 282 | size_t len); | 282 | struct otp_info *buf); |
| 283 | int mtd_read_fact_prot_reg(struct mtd_info *mtd, loff_t from, size_t len, | 283 | int mtd_read_fact_prot_reg(struct mtd_info *mtd, loff_t from, size_t len, |
| 284 | size_t *retlen, u_char *buf); | 284 | size_t *retlen, u_char *buf); |
| 285 | int mtd_get_user_prot_info(struct mtd_info *mtd, struct otp_info *buf, | 285 | int mtd_get_user_prot_info(struct mtd_info *mtd, size_t len, size_t *retlen, |
| 286 | size_t len); | 286 | struct otp_info *buf); |
| 287 | int mtd_read_user_prot_reg(struct mtd_info *mtd, loff_t from, size_t len, | 287 | int mtd_read_user_prot_reg(struct mtd_info *mtd, loff_t from, size_t len, |
| 288 | size_t *retlen, u_char *buf); | 288 | size_t *retlen, u_char *buf); |
| 289 | int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to, size_t len, | 289 | int mtd_write_user_prot_reg(struct mtd_info *mtd, loff_t to, size_t len, |
diff --git a/include/linux/mtd/nand.h b/include/linux/mtd/nand.h index 32f8612469d8..450d61ec7f06 100644 --- a/include/linux/mtd/nand.h +++ b/include/linux/mtd/nand.h | |||
| @@ -52,14 +52,6 @@ extern int nand_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len); | |||
| 52 | #define NAND_MAX_CHIPS 8 | 52 | #define NAND_MAX_CHIPS 8 |
| 53 | 53 | ||
| 54 | /* | 54 | /* |
| 55 | * This constant declares the max. oobsize / page, which | ||
| 56 | * is supported now. If you add a chip with bigger oobsize/page | ||
| 57 | * adjust this accordingly. | ||
| 58 | */ | ||
| 59 | #define NAND_MAX_OOBSIZE 744 | ||
| 60 | #define NAND_MAX_PAGESIZE 8192 | ||
| 61 | |||
| 62 | /* | ||
| 63 | * Constants for hardware specific CLE/ALE/NCE function | 55 | * Constants for hardware specific CLE/ALE/NCE function |
| 64 | * | 56 | * |
| 65 | * These are bits which can be or'ed to set/clear multiple | 57 | * These are bits which can be or'ed to set/clear multiple |
| @@ -350,6 +342,84 @@ struct nand_onfi_vendor_micron { | |||
| 350 | u8 param_revision; | 342 | u8 param_revision; |
| 351 | } __packed; | 343 | } __packed; |
| 352 | 344 | ||
| 345 | struct jedec_ecc_info { | ||
| 346 | u8 ecc_bits; | ||
| 347 | u8 codeword_size; | ||
| 348 | __le16 bb_per_lun; | ||
| 349 | __le16 block_endurance; | ||
| 350 | u8 reserved[2]; | ||
| 351 | } __packed; | ||
| 352 | |||
| 353 | /* JEDEC features */ | ||
| 354 | #define JEDEC_FEATURE_16_BIT_BUS (1 << 0) | ||
| 355 | |||
| 356 | struct nand_jedec_params { | ||
| 357 | /* rev info and features block */ | ||
| 358 | /* 'J' 'E' 'S' 'D' */ | ||
| 359 | u8 sig[4]; | ||
| 360 | __le16 revision; | ||
| 361 | __le16 features; | ||
| 362 | u8 opt_cmd[3]; | ||
| 363 | __le16 sec_cmd; | ||
| 364 | u8 num_of_param_pages; | ||
| 365 | u8 reserved0[18]; | ||
| 366 | |||
| 367 | /* manufacturer information block */ | ||
| 368 | char manufacturer[12]; | ||
| 369 | char model[20]; | ||
| 370 | u8 jedec_id[6]; | ||
| 371 | u8 reserved1[10]; | ||
| 372 | |||
| 373 | /* memory organization block */ | ||
| 374 | __le32 byte_per_page; | ||
| 375 | __le16 spare_bytes_per_page; | ||
| 376 | u8 reserved2[6]; | ||
| 377 | __le32 pages_per_block; | ||
| 378 | __le32 blocks_per_lun; | ||
| 379 | u8 lun_count; | ||
| 380 | u8 addr_cycles; | ||
| 381 | u8 bits_per_cell; | ||
| 382 | u8 programs_per_page; | ||
| 383 | u8 multi_plane_addr; | ||
| 384 | u8 multi_plane_op_attr; | ||
| 385 | u8 reserved3[38]; | ||
| 386 | |||
| 387 | /* electrical parameter block */ | ||
| 388 | __le16 async_sdr_speed_grade; | ||
| 389 | __le16 toggle_ddr_speed_grade; | ||
| 390 | __le16 sync_ddr_speed_grade; | ||
| 391 | u8 async_sdr_features; | ||
| 392 | u8 toggle_ddr_features; | ||
| 393 | u8 sync_ddr_features; | ||
| 394 | __le16 t_prog; | ||
| 395 | __le16 t_bers; | ||
| 396 | __le16 t_r; | ||
| 397 | __le16 t_r_multi_plane; | ||
| 398 | __le16 t_ccs; | ||
| 399 | __le16 io_pin_capacitance_typ; | ||
| 400 | __le16 input_pin_capacitance_typ; | ||
| 401 | __le16 clk_pin_capacitance_typ; | ||
| 402 | u8 driver_strength_support; | ||
| 403 | __le16 t_ald; | ||
| 404 | u8 reserved4[36]; | ||
| 405 | |||
| 406 | /* ECC and endurance block */ | ||
| 407 | u8 guaranteed_good_blocks; | ||
| 408 | __le16 guaranteed_block_endurance; | ||
| 409 | struct jedec_ecc_info ecc_info[4]; | ||
| 410 | u8 reserved5[29]; | ||
| 411 | |||
| 412 | /* reserved */ | ||
| 413 | u8 reserved6[148]; | ||
| 414 | |||
| 415 | /* vendor */ | ||
| 416 | __le16 vendor_rev_num; | ||
| 417 | u8 reserved7[88]; | ||
| 418 | |||
| 419 | /* CRC for Parameter Page */ | ||
| 420 | __le16 crc; | ||
| 421 | } __packed; | ||
| 422 | |||
| 353 | /** | 423 | /** |
| 354 | * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices | 424 | * struct nand_hw_control - Control structure for hardware controller (e.g ECC generator) shared among independent devices |
| 355 | * @lock: protection lock | 425 | * @lock: protection lock |
| @@ -418,7 +488,7 @@ struct nand_ecc_ctrl { | |||
| 418 | int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip, | 488 | int (*read_page)(struct mtd_info *mtd, struct nand_chip *chip, |
| 419 | uint8_t *buf, int oob_required, int page); | 489 | uint8_t *buf, int oob_required, int page); |
| 420 | int (*read_subpage)(struct mtd_info *mtd, struct nand_chip *chip, | 490 | int (*read_subpage)(struct mtd_info *mtd, struct nand_chip *chip, |
| 421 | uint32_t offs, uint32_t len, uint8_t *buf); | 491 | uint32_t offs, uint32_t len, uint8_t *buf, int page); |
| 422 | int (*write_subpage)(struct mtd_info *mtd, struct nand_chip *chip, | 492 | int (*write_subpage)(struct mtd_info *mtd, struct nand_chip *chip, |
| 423 | uint32_t offset, uint32_t data_len, | 493 | uint32_t offset, uint32_t data_len, |
| 424 | const uint8_t *data_buf, int oob_required); | 494 | const uint8_t *data_buf, int oob_required); |
| @@ -435,17 +505,17 @@ struct nand_ecc_ctrl { | |||
| 435 | 505 | ||
| 436 | /** | 506 | /** |
| 437 | * struct nand_buffers - buffer structure for read/write | 507 | * struct nand_buffers - buffer structure for read/write |
| 438 | * @ecccalc: buffer for calculated ECC | 508 | * @ecccalc: buffer pointer for calculated ECC, size is oobsize. |
| 439 | * @ecccode: buffer for ECC read from flash | 509 | * @ecccode: buffer pointer for ECC read from flash, size is oobsize. |
| 440 | * @databuf: buffer for data - dynamically sized | 510 | * @databuf: buffer pointer for data, size is (page size + oobsize). |
| 441 | * | 511 | * |
| 442 | * Do not change the order of buffers. databuf and oobrbuf must be in | 512 | * Do not change the order of buffers. databuf and oobrbuf must be in |
| 443 | * consecutive order. | 513 | * consecutive order. |
| 444 | */ | 514 | */ |
| 445 | struct nand_buffers { | 515 | struct nand_buffers { |
| 446 | uint8_t ecccalc[NAND_MAX_OOBSIZE]; | 516 | uint8_t *ecccalc; |
| 447 | uint8_t ecccode[NAND_MAX_OOBSIZE]; | 517 | uint8_t *ecccode; |
| 448 | uint8_t databuf[NAND_MAX_PAGESIZE + NAND_MAX_OOBSIZE]; | 518 | uint8_t *databuf; |
| 449 | }; | 519 | }; |
| 450 | 520 | ||
| 451 | /** | 521 | /** |
| @@ -523,8 +593,12 @@ struct nand_buffers { | |||
| 523 | * @subpagesize: [INTERN] holds the subpagesize | 593 | * @subpagesize: [INTERN] holds the subpagesize |
| 524 | * @onfi_version: [INTERN] holds the chip ONFI version (BCD encoded), | 594 | * @onfi_version: [INTERN] holds the chip ONFI version (BCD encoded), |
| 525 | * non 0 if ONFI supported. | 595 | * non 0 if ONFI supported. |
| 596 | * @jedec_version: [INTERN] holds the chip JEDEC version (BCD encoded), | ||
| 597 | * non 0 if JEDEC supported. | ||
| 526 | * @onfi_params: [INTERN] holds the ONFI page parameter when ONFI is | 598 | * @onfi_params: [INTERN] holds the ONFI page parameter when ONFI is |
| 527 | * supported, 0 otherwise. | 599 | * supported, 0 otherwise. |
| 600 | * @jedec_params: [INTERN] holds the JEDEC parameter page when JEDEC is | ||
| 601 | * supported, 0 otherwise. | ||
| 528 | * @read_retries: [INTERN] the number of read retry modes supported | 602 | * @read_retries: [INTERN] the number of read retry modes supported |
| 529 | * @onfi_set_features: [REPLACEABLE] set the features for ONFI nand | 603 | * @onfi_set_features: [REPLACEABLE] set the features for ONFI nand |
| 530 | * @onfi_get_features: [REPLACEABLE] get the features for ONFI nand | 604 | * @onfi_get_features: [REPLACEABLE] get the features for ONFI nand |
| @@ -597,7 +671,11 @@ struct nand_chip { | |||
| 597 | int badblockbits; | 671 | int badblockbits; |
| 598 | 672 | ||
| 599 | int onfi_version; | 673 | int onfi_version; |
| 600 | struct nand_onfi_params onfi_params; | 674 | int jedec_version; |
| 675 | union { | ||
| 676 | struct nand_onfi_params onfi_params; | ||
| 677 | struct nand_jedec_params jedec_params; | ||
| 678 | }; | ||
| 601 | 679 | ||
| 602 | int read_retries; | 680 | int read_retries; |
| 603 | 681 | ||
| @@ -840,4 +918,29 @@ static inline bool nand_is_slc(struct nand_chip *chip) | |||
| 840 | { | 918 | { |
| 841 | return chip->bits_per_cell == 1; | 919 | return chip->bits_per_cell == 1; |
| 842 | } | 920 | } |
| 921 | |||
| 922 | /** | ||
| 923 | * Check if the opcode's address should be sent only on the lower 8 bits | ||
| 924 | * @command: opcode to check | ||
| 925 | */ | ||
| 926 | static inline int nand_opcode_8bits(unsigned int command) | ||
| 927 | { | ||
| 928 | switch (command) { | ||
| 929 | case NAND_CMD_READID: | ||
| 930 | case NAND_CMD_PARAM: | ||
| 931 | case NAND_CMD_GET_FEATURES: | ||
| 932 | case NAND_CMD_SET_FEATURES: | ||
| 933 | return 1; | ||
| 934 | default: | ||
| 935 | break; | ||
| 936 | } | ||
| 937 | return 0; | ||
| 938 | } | ||
| 939 | |||
| 940 | /* return the supported JEDEC features. */ | ||
| 941 | static inline int jedec_feature(struct nand_chip *chip) | ||
| 942 | { | ||
| 943 | return chip->jedec_version ? le16_to_cpu(chip->jedec_params.features) | ||
| 944 | : 0; | ||
| 945 | } | ||
| 843 | #endif /* __LINUX_MTD_NAND_H */ | 946 | #endif /* __LINUX_MTD_NAND_H */ |
diff --git a/include/linux/of_mtd.h b/include/linux/of_mtd.h index cb32d9c1e8dc..e266caa36402 100644 --- a/include/linux/of_mtd.h +++ b/include/linux/of_mtd.h | |||
| @@ -13,6 +13,8 @@ | |||
| 13 | 13 | ||
| 14 | #include <linux/of.h> | 14 | #include <linux/of.h> |
| 15 | int of_get_nand_ecc_mode(struct device_node *np); | 15 | int of_get_nand_ecc_mode(struct device_node *np); |
| 16 | int of_get_nand_ecc_step_size(struct device_node *np); | ||
| 17 | int of_get_nand_ecc_strength(struct device_node *np); | ||
| 16 | int of_get_nand_bus_width(struct device_node *np); | 18 | int of_get_nand_bus_width(struct device_node *np); |
| 17 | bool of_get_nand_on_flash_bbt(struct device_node *np); | 19 | bool of_get_nand_on_flash_bbt(struct device_node *np); |
| 18 | 20 | ||
| @@ -23,6 +25,16 @@ static inline int of_get_nand_ecc_mode(struct device_node *np) | |||
| 23 | return -ENOSYS; | 25 | return -ENOSYS; |
| 24 | } | 26 | } |
| 25 | 27 | ||
| 28 | static inline int of_get_nand_ecc_step_size(struct device_node *np) | ||
| 29 | { | ||
| 30 | return -ENOSYS; | ||
| 31 | } | ||
| 32 | |||
| 33 | static inline int of_get_nand_ecc_strength(struct device_node *np) | ||
| 34 | { | ||
| 35 | return -ENOSYS; | ||
| 36 | } | ||
| 37 | |||
| 26 | static inline int of_get_nand_bus_width(struct device_node *np) | 38 | static inline int of_get_nand_bus_width(struct device_node *np) |
| 27 | { | 39 | { |
| 28 | return -ENOSYS; | 40 | return -ENOSYS; |
diff --git a/include/linux/platform_data/elm.h b/include/linux/platform_data/elm.h index bf0a83b7ed9d..4edb40676b3f 100644 --- a/include/linux/platform_data/elm.h +++ b/include/linux/platform_data/elm.h | |||
| @@ -26,13 +26,6 @@ enum bch_ecc { | |||
| 26 | /* ELM support 8 error syndrome process */ | 26 | /* ELM support 8 error syndrome process */ |
| 27 | #define ERROR_VECTOR_MAX 8 | 27 | #define ERROR_VECTOR_MAX 8 |
| 28 | 28 | ||
| 29 | #define BCH8_ECC_OOB_BYTES 13 | ||
| 30 | #define BCH4_ECC_OOB_BYTES 7 | ||
| 31 | /* RBL requires 14 byte even though BCH8 uses only 13 byte */ | ||
| 32 | #define BCH8_SIZE (BCH8_ECC_OOB_BYTES + 1) | ||
| 33 | /* Uses 1 extra byte to handle erased pages */ | ||
| 34 | #define BCH4_SIZE (BCH4_ECC_OOB_BYTES + 1) | ||
| 35 | |||
| 36 | /** | 29 | /** |
| 37 | * struct elm_errorvec - error vector for elm | 30 | * struct elm_errorvec - error vector for elm |
| 38 | * @error_reported: set true for vectors error is reported | 31 | * @error_reported: set true for vectors error is reported |
| @@ -50,5 +43,6 @@ struct elm_errorvec { | |||
| 50 | 43 | ||
| 51 | void elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc, | 44 | void elm_decode_bch_error_page(struct device *dev, u8 *ecc_calc, |
| 52 | struct elm_errorvec *err_vec); | 45 | struct elm_errorvec *err_vec); |
| 53 | int elm_config(struct device *dev, enum bch_ecc bch_type); | 46 | int elm_config(struct device *dev, enum bch_ecc bch_type, |
| 47 | int ecc_steps, int ecc_step_size, int ecc_syndrome_size); | ||
| 54 | #endif /* __ELM_H */ | 48 | #endif /* __ELM_H */ |
diff --git a/include/linux/platform_data/mtd-nand-s3c2410.h b/include/linux/platform_data/mtd-nand-s3c2410.h index b64115fa93a4..36bb92172f47 100644 --- a/include/linux/platform_data/mtd-nand-s3c2410.h +++ b/include/linux/platform_data/mtd-nand-s3c2410.h | |||
| @@ -1,5 +1,4 @@ | |||
| 1 | /* arch/arm/mach-s3c2410/include/mach/nand.h | 1 | /* |
| 2 | * | ||
| 3 | * Copyright (c) 2004 Simtec Electronics | 2 | * Copyright (c) 2004 Simtec Electronics |
| 4 | * Ben Dooks <ben@simtec.co.uk> | 3 | * Ben Dooks <ben@simtec.co.uk> |
| 5 | * | 4 | * |
| @@ -10,6 +9,9 @@ | |||
| 10 | * published by the Free Software Foundation. | 9 | * published by the Free Software Foundation. |
| 11 | */ | 10 | */ |
| 12 | 11 | ||
| 12 | #ifndef __MTD_NAND_S3C2410_H | ||
| 13 | #define __MTD_NAND_S3C2410_H | ||
| 14 | |||
| 13 | /** | 15 | /** |
| 14 | * struct s3c2410_nand_set - define a set of one or more nand chips | 16 | * struct s3c2410_nand_set - define a set of one or more nand chips |
| 15 | * @disable_ecc: Entirely disable ECC - Dangerous | 17 | * @disable_ecc: Entirely disable ECC - Dangerous |
| @@ -65,3 +67,5 @@ struct s3c2410_platform_nand { | |||
| 65 | * it with the s3c_device_nand. This allows @nand to be __initdata. | 67 | * it with the s3c_device_nand. This allows @nand to be __initdata. |
| 66 | */ | 68 | */ |
| 67 | extern void s3c_nand_set_platdata(struct s3c2410_platform_nand *nand); | 69 | extern void s3c_nand_set_platdata(struct s3c2410_platform_nand *nand); |
| 70 | |||
| 71 | #endif /*__MTD_NAND_S3C2410_H */ | ||
