diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2016-02-26 10:29:16 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2016-04-06 10:17:51 +0200 |
commit | eef520a32b72606793cd02b2af57e559c64f8620 (patch) | |
tree | b2104c9a9d6d449b68711bb0ebe233b57ccd886f /include/mtd | |
parent | fdac29be6259e75ded9b322949ed56236b30d47d (diff) | |
download | barebox-eef520a32b72606793cd02b2af57e559c64f8620.tar.gz barebox-eef520a32b72606793cd02b2af57e559c64f8620.tar.xz |
mtd: Introduce mtd-peb API
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>
Diffstat (limited to 'include/mtd')
-rw-r--r-- | include/mtd/mtd-peb.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/mtd/mtd-peb.h b/include/mtd/mtd-peb.h new file mode 100644 index 0000000000..50ac9a5cca --- /dev/null +++ b/include/mtd/mtd-peb.h @@ -0,0 +1,21 @@ +#ifndef __LINUX_MTD_MTDPEB_H +#define __LINUX_MTD_MTDPEB_H + +#include <linux/mtd/mtd.h> + +int mtd_peb_read(struct mtd_info *mtd, void *buf, int pnum, int offset, + int len); +int mtd_peb_write(struct mtd_info *mtd, const void *buf, int pnum, int offset, + int len); + +int mtd_peb_torture(struct mtd_info *mtd, int pnum); +int mtd_peb_erase(struct mtd_info *mtd, int pnum); +int mtd_peb_mark_bad(struct mtd_info *mtd, int pnum); +int mtd_peb_is_bad(struct mtd_info *mtd, int pnum); +int mtd_peb_check_all_ff(struct mtd_info *mtd, int pnum, int offset, int len, + int warn); +int mtd_peb_verify(struct mtd_info *mtd, const void *buf, int pnum, + int offset, int len); +int mtd_num_pebs(struct mtd_info *mtd); + +#endif /* __LINUX_MTD_MTDPEB_H */ |