ubi: Change to fill ec_hdr and vid_hdr redundant space with ff data on rockchip

These hdr data is place in first two pages in the front of flash block,
most of the data is filled with 0 which may result in 0/1 data unbalance
and finally accelerate the data bit flip process. So using ff redundant
data pattern for data balancing is more stable for nand devices.

Change-Id: I77a9116a4575b94bc6e4da5334db4eaf3d8bcb83
Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
This commit is contained in:
Jon Lin
2025-06-03 16:25:05 +08:00
parent db89a88fcc
commit 2920b6bde8

View File

@@ -824,6 +824,14 @@ int ubi_io_write_ec_hdr(struct ubi_device *ubi, int pnum,
if (ubi_dbg_power_cut(ubi, POWER_CUT_EC_WRITE))
return -EROFS;
if (IS_ENABLED(CONFIG_ARCH_ROCKCHIP)) {
/*
* All FF data is relatively friendly to the data retention capability of SPI
* Nand devices.
*/
memset((char *)ec_hdr + sizeof(struct ubi_ec_hdr), 0xFF,
ubi->ec_hdr_alsize - sizeof(struct ubi_ec_hdr));
}
err = ubi_io_write(ubi, ec_hdr, pnum, 0, ubi->ec_hdr_alsize);
return err;
}
@@ -1074,6 +1082,14 @@ int ubi_io_write_vid_hdr(struct ubi_device *ubi, int pnum,
if (ubi_dbg_power_cut(ubi, POWER_CUT_VID_WRITE))
return -EROFS;
if (IS_ENABLED(CONFIG_ARCH_ROCKCHIP)) {
/*
* All FF data is relatively friendly to the data retention capability of SPI
* Nand devices.
*/
memset((char *)p + sizeof(struct ubi_vid_hdr), 0xFF,
ubi->vid_hdr_alsize - sizeof(struct ubi_vid_hdr));
}
err = ubi_io_write(ubi, p, pnum, ubi->vid_hdr_aloffset,
ubi->vid_hdr_alsize);
return err;