diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-13 18:42:44 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2019-07-13 18:42:44 -0400 |
commit | 3f06962273e73c5f7a651726b191d531cadef788 (patch) | |
tree | 370219bd166ac6dda105901dd316a54c2f9ac3d0 /drivers/mtd/mtdconcat.c | |
parent | 2260840592fbed5be98ca03c97eb8172941f27ac (diff) | |
parent | 46ce10df799fb0647a9c0e3f793e66463a8d6773 (diff) |
Merge tag 'mtd/for-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux
Pull MTD updates from Miquel Raynal:
"This contains the following changes for MTD:
MTD core changes:
- New Hyperbus framework
- New _is_locked (concat) implementation
- Various cleanups
NAND core changes:
- use longest matching pattern in ->exec_op() default parser
- export NAND operation tracer
- add flag to indicate panic_write in MTD
- use kzalloc() instead of kmalloc() and memset()
Raw NAND controller drivers changes:
- brcmnand:
- fix BCH ECC layout for large page NAND parts
- fallback to detected ecc-strength, ecc-step-size
- when oops in progress use pio and interrupt polling
- code refactor code to introduce helper functions
- add support for v7.3 controller
- FSMC:
- use nand_op_trace for operation tracing
- GPMI:
- move all driver code into single file
- various cleanups (including dmaengine changes)
- use runtime PM to manage clocks
- implement exec_op
- MTK:
- correct low level time calculation of r/w cycle
- improve data sampling timing for read cycle
- add validity check for CE# pin setting
- fix wrongly assigned OOB buffer pointer issue
- re-license MTK NAND driver as Dual MIT/GPL
- STM32:
- manage the get_irq error case
- increase DMA completion timeouts
Raw NAND chips drivers changes:
- Macronix: add read-retry support
Onenand driver changes:
- add support for 8Gb datasize chips
- avoid fall-through warnings
SPI-NAND changes:
- define macros for page-read ops with three-byte addresses
- add support for two-byte device IDs and then for GigaDevice
GD5F1GQ4UFxxG
- add initial support for Paragon PN26G0xA
- handle the case where the last page read has bitflips
SPI-NOR core changes:
- add support for the mt25ql02g and w25q16jv flashes
- print error in case of jedec read id fails
- is25lp256: add post BFPT fix to correct the addr_width
SPI NOR controller drivers changes:
- intel-spi: Add support for Intel Elkhart Lake SPI serial flash
- smt32: remove the driver as the driver was replaced by spi-stm32-qspi.c
- cadence-quadspi: add reset control"
* tag 'mtd/for-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux: (60 commits)
mtd: concat: implement _is_locked mtd operation
mtd: concat: refactor concat_lock/concat_unlock
mtd: abi: do not use C++ style comments in uapi header
mtd: afs: remove unneeded NULL check
mtd: rawnand: stm32_fmc2: increase DMA completion timeouts
mtd: rawnand: Use kzalloc() instead of kmalloc() and memset()
mtd: hyperbus: Add driver for TI's HyperBus memory controller
mtd: spinand: read returns badly if the last page has bitflips
mtd: spinand: Add initial support for Paragon PN26G0xA
mtd: rawnand: mtk: Re-license MTK NAND driver as Dual MIT/GPL
mtd: rawnand: gpmi: remove double assignment to block_size
dt-bindings: mtd: brcmnand: Add brcmnand, brcmnand-v7.3 support
mtd: rawnand: brcmnand: Add support for v7.3 controller
mtd: rawnand: brcmnand: Refactored code to introduce helper functions
mtd: rawnand: brcmnand: When oops in progress use pio and interrupt polling
mtd: Add flag to indicate panic_write
mtd: rawnand: Add Macronix NAND read retry support
mtd: onenand: Avoid fall-through warnings
mtd: spinand: Add support for GigaDevice GD5F1GQ4UFxxG
mtd: spinand: Add support for two-byte device IDs
...
Diffstat (limited to 'drivers/mtd/mtdconcat.c')
-rw-r--r-- | drivers/mtd/mtdconcat.c | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/drivers/mtd/mtdconcat.c b/drivers/mtd/mtdconcat.c index 7324ff832b41..170a7221b35f 100644 --- a/drivers/mtd/mtdconcat.c +++ b/drivers/mtd/mtdconcat.c | |||
@@ -437,7 +437,8 @@ static int concat_erase(struct mtd_info *mtd, struct erase_info *instr) | |||
437 | return err; | 437 | return err; |
438 | } | 438 | } |
439 | 439 | ||
440 | static int concat_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) | 440 | static int concat_xxlock(struct mtd_info *mtd, loff_t ofs, uint64_t len, |
441 | bool is_lock) | ||
441 | { | 442 | { |
442 | struct mtd_concat *concat = CONCAT(mtd); | 443 | struct mtd_concat *concat = CONCAT(mtd); |
443 | int i, err = -EINVAL; | 444 | int i, err = -EINVAL; |
@@ -456,7 +457,10 @@ static int concat_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) | |||
456 | else | 457 | else |
457 | size = len; | 458 | size = len; |
458 | 459 | ||
459 | err = mtd_lock(subdev, ofs, size); | 460 | if (is_lock) |
461 | err = mtd_lock(subdev, ofs, size); | ||
462 | else | ||
463 | err = mtd_unlock(subdev, ofs, size); | ||
460 | if (err) | 464 | if (err) |
461 | break; | 465 | break; |
462 | 466 | ||
@@ -471,35 +475,33 @@ static int concat_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) | |||
471 | return err; | 475 | return err; |
472 | } | 476 | } |
473 | 477 | ||
478 | static int concat_lock(struct mtd_info *mtd, loff_t ofs, uint64_t len) | ||
479 | { | ||
480 | return concat_xxlock(mtd, ofs, len, true); | ||
481 | } | ||
482 | |||
474 | static int concat_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) | 483 | static int concat_unlock(struct mtd_info *mtd, loff_t ofs, uint64_t len) |
475 | { | 484 | { |
485 | return concat_xxlock(mtd, ofs, len, false); | ||
486 | } | ||
487 | |||
488 | static int concat_is_locked(struct mtd_info *mtd, loff_t ofs, uint64_t len) | ||
489 | { | ||
476 | struct mtd_concat *concat = CONCAT(mtd); | 490 | struct mtd_concat *concat = CONCAT(mtd); |
477 | int i, err = 0; | 491 | int i, err = -EINVAL; |
478 | 492 | ||
479 | for (i = 0; i < concat->num_subdev; i++) { | 493 | for (i = 0; i < concat->num_subdev; i++) { |
480 | struct mtd_info *subdev = concat->subdev[i]; | 494 | struct mtd_info *subdev = concat->subdev[i]; |
481 | uint64_t size; | ||
482 | 495 | ||
483 | if (ofs >= subdev->size) { | 496 | if (ofs >= subdev->size) { |
484 | size = 0; | ||
485 | ofs -= subdev->size; | 497 | ofs -= subdev->size; |
486 | continue; | 498 | continue; |
487 | } | 499 | } |
488 | if (ofs + len > subdev->size) | ||
489 | size = subdev->size - ofs; | ||
490 | else | ||
491 | size = len; | ||
492 | |||
493 | err = mtd_unlock(subdev, ofs, size); | ||
494 | if (err) | ||
495 | break; | ||
496 | 500 | ||
497 | len -= size; | 501 | if (ofs + len > subdev->size) |
498 | if (len == 0) | ||
499 | break; | 502 | break; |
500 | 503 | ||
501 | err = -EINVAL; | 504 | return mtd_is_locked(subdev, ofs, len); |
502 | ofs = 0; | ||
503 | } | 505 | } |
504 | 506 | ||
505 | return err; | 507 | return err; |
@@ -704,6 +706,7 @@ struct mtd_info *mtd_concat_create(struct mtd_info *subdev[], /* subdevices to c | |||
704 | concat->mtd._sync = concat_sync; | 706 | concat->mtd._sync = concat_sync; |
705 | concat->mtd._lock = concat_lock; | 707 | concat->mtd._lock = concat_lock; |
706 | concat->mtd._unlock = concat_unlock; | 708 | concat->mtd._unlock = concat_unlock; |
709 | concat->mtd._is_locked = concat_is_locked; | ||
707 | concat->mtd._suspend = concat_suspend; | 710 | concat->mtd._suspend = concat_suspend; |
708 | concat->mtd._resume = concat_resume; | 711 | concat->mtd._resume = concat_resume; |
709 | 712 | ||