diff options
author | Nikhilesh Reddy <reddyn@codeaurora.org> | 2015-09-24 16:32:56 -0700 |
---|---|---|
committer | David Keitel <dkeitel@codeaurora.org> | 2016-03-23 21:12:58 -0700 |
commit | 4223684cd81440885a8c06ddad6e7dac98c60b48 (patch) | |
tree | 71747bfe093f8498e7ffbc7f1ec7921ab7b37649 /drivers/mtd/ubi/io.c | |
parent | d0d79bf6f7e2a653bfff8f313f1ad8a51793fbbc (diff) |
ubi: Add scrub_all support to UBI
The data on NAND parts degrades overtime. This is known as data decay.
This decay is accelarated by extreme temperatures.
When data on nand is read over and over again this can also cause decay
of data. This is known as read disturb and can degrade the data in
the page/block that is read and the adjacent cells as well.
This data degrade can be corrected to a certain degree by the nand
driver/controller using the ECC but this is not sufficient specially
in products designed to last years.
The only way to combat the decay is to "refresh" the data by moving it
to a new location.
Add scrub_all support to UBI to facilitate the data refresh.
Change-Id: Ifafb82fe4ddb7120277dcfbbff79b3e087ca344d
Signed-off-by: Nikhilesh Reddy <reddyn@codeaurora.org>
Diffstat (limited to 'drivers/mtd/ubi/io.c')
-rw-r--r-- | drivers/mtd/ubi/io.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c index 10cf3b549959..617541e86f80 100644 --- a/drivers/mtd/ubi/io.c +++ b/drivers/mtd/ubi/io.c @@ -1101,6 +1101,14 @@ int ubi_io_write_vid_hdr(struct ubi_device *ubi, int pnum, dbg_io("write VID header to PEB %d", pnum); ubi_assert(pnum >= 0 && pnum < ubi->peb_count); + /* + * Re-erase the PEB before using it. This should minimize any issues + * from decay of charge in this block. + */ + err = ubi_wl_erase_peb(ubi, pnum); + if (err) + return err; + err = self_check_peb_ec_hdr(ubi, pnum); if (err) return err; @@ -1120,6 +1128,8 @@ int ubi_io_write_vid_hdr(struct ubi_device *ubi, int pnum, p = (char *)vid_hdr - ubi->vid_hdr_shift; err = ubi_io_write(ubi, p, pnum, ubi->vid_hdr_aloffset, ubi->vid_hdr_alsize); + if (!err) + ubi_wl_update_peb_sqnum(ubi, pnum, vid_hdr); return err; } |