summaryrefslogtreecommitdiffstats
path: root/drivers/mtd/peb.c
Commit message (Collapse)AuthorAgeFilesLines
* mtd: peb: Add function to skip bad blocksSascha Hauer2019-01-281-0/+27
| | | | | | | | This adds a function that given a pointer to a PEB number increases the number until the corresponding PEB is good. It also checks for the PEB number being inside the mtd device. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Revert "globalvar: make globalvar functions more consistent"Sascha Hauer2017-06-131-3/+3
| | | | This reverts commit 1b4a05c9263ae26083526acfabdea1ef96531a1d.
* globalvar: make globalvar functions more consistentSascha Hauer2017-04-111-3/+3
| | | | | | | | | Similar to the device parameter functions also make the globalvar functions more consistent. This also adds support for readonly globalvars and changes several existing globalvars which should really be readonly to readonly. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: when creating bitflips the offset has to be page alignedSascha Hauer2017-03-301-0/+2
| | | | | | | | mtd_peb_create_bitflips() assumes the offset is page aligned. Enforce this and in the nand_bitlfip command print a warning if it's not aligned. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: create bitflips in the correct pageSascha Hauer2017-03-301-1/+1
| | | | | | | | In mtd_peb_create_bitflips() buf always points to the first page in a block. If we want to create bitflips in other pages we have to add the offset into the block. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: peb: Fix format specifierSascha Hauer2017-01-101-1/+1
| | | | | | The correct format specifier for size_t is %zu. Use it. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: peb: fix usage of uninitialized variableSascha Hauer2017-01-101-3/+2
| | | | | | | 'read' is used in an error message but never assigned a value to. Remove the variable. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* commands: Create nand_bitflip commandSascha Hauer2016-04-061-0/+121
| | | | | | | | | | | | | | | | | | | This adds a command to flip bits in a Nand flash. This is useful for testing purposes to check if flipped bits are corrected and if the driver returns the correct number of bitflips. The command writes a configurable number of bitflips to a single Nand page. If the -r option is not given the results are reproducible, so calling the same command twice will revert the bitflips. The command uses the raw read/write Nand operations which are probably less tested than the regular read/write operations, so the command may produce surprising results. As of writing the command has been tested with the GPMI Nand driver and the imx-nand driver with fixes posted. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mtd: Introduce mtd-peb APISascha Hauer2016-04-061-0/+537
Code which properly wants to handle Nand flash has to work in a block based way since blocks are the entities that are erased or may become bad. The regular mtd API works based on offsets in the device which introduces unhandy 64bit arithmetics and the requirement to align buffers to blocks. This introduces the mtd peb API (PEB for physical Erase Block) which allows the users to work in a block oriented way. The API is heavily inspired by the UBI IO layer and in fact can replace parts thereof later. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>