This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
但是nandflash中出现位反转时,uboot的ecc检测可以发现一位出错,但是内核的ecc却检测不出来,这是为什么呢;而且我看uboot和内核都是用的硬件ecc.
内核ecc.corrcet 代码:
static int omap_correct_data(struct mtd_info *mtd, u_char *dat,u_char *read_ecc, u_char *calc_ecc)
{
...
case OMAP_ECC_BCH8_CODE_HW:
eccsize = BCH8_ECC_OOB_BYTES;
for (i = 0; i < blockCnt; i++) {
eccflag = 0;
/* check if area is flashed */
for (j = 0; (j < eccsize) && (eccflag == 0); j++)
{
if (read_ecc[j] != 0xFF)
eccflag = 1;
}
if (eccflag == 1) {
eccflag = 0;
/* check if any ecc error */
for (j = 0; (j < eccsize) && (eccflag == 0);
j++)
{
if (calc_ecc[j] != 0)
eccflag = 1;
}
}
count = 0;
#if 1
if (eccflag == 1)
count = elm_decode_bch_error(0, calc_ecc,
err_loc);
#else
count = elm_decode_bch_error(0, calc_ecc,
err_loc);
#endif
if(count)
{
//printk(KERN_INFO "###########XXXXXXXXXXXXXXXXXX######count##%d/n",count);
}
for (j = 0; j < count; j++) {
u32 bit_pos, byte_pos;
bit_pos = err_loc[j] % 8;
byte_pos = (BCH8_ECC_MAX - err_loc[j] - 1) / 8;
if (err_loc[j] < BCH8_ECC_MAX)
dat[byte_pos] ^=
1 << bit_pos;
/* else, not interested to correct ecc */
}
stat += count;
calc_ecc = calc_ecc + 14;
read_ecc = read_ecc + 14;
dat += BCH8_ECC_BYTES;
}
break;
}
return stat;
}