mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
drivers: rkflash: Support read retry for spinand read ECC fail
Change-Id: I498bc8a133a709ac66c3aeeb1cdd5a5ef2e0b466 Signed-off-by: Jon Lin <jon.lin@rock-chips.com>
This commit is contained in:
@@ -881,7 +881,9 @@ u32 sfc_nand_read_page(u8 cs, u32 addr, u32 *p_data, u32 *p_spare)
|
||||
u32 sec_per_page = p_nand_info->sec_per_page;
|
||||
u32 data_size = sec_per_page * SFC_NAND_SECTOR_SIZE;
|
||||
struct nand_mega_area *meta = &p_nand_info->meta;
|
||||
int retries = 0;
|
||||
|
||||
retry:
|
||||
ret = sfc_nand_read_page_raw(cs, addr, gp_page_buf);
|
||||
memcpy(p_data, gp_page_buf, data_size);
|
||||
p_spare[0] = gp_page_buf[(data_size + meta->off0) / 4];
|
||||
@@ -903,6 +905,10 @@ u32 sfc_nand_read_page(u8 cs, u32 addr, u32 *p_data, u32 *p_spare)
|
||||
|
||||
if (p_spare)
|
||||
rkflash_print_hex("spare:", p_spare, 4, 2);
|
||||
if (ret == SFC_NAND_ECC_ERROR && retries < 1) {
|
||||
retries++;
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
Reference in New Issue
Block a user