* [U-Boot-Users] u-boot and CONFIG_MTD_NAND_ECC_SMC patch
@ 2008-06-11 0:06 mark roths
2008-06-17 18:30 ` Scott Wood
0 siblings, 1 reply; 2+ messages in thread
From: mark roths @ 2008-06-11 0:06 UTC (permalink / raw)
To: u-boot
Sorry if this has been covered already, the problem exists in all the u-boot
versions I have up to 1.2.0.
When linux has CONFIG_MTD_NAND_ECC_SMC configured, NAND flash sectors
written under linux appear to have ECC errors when read by u-boot.
The help for CONFIG_MTD_NAND_ECC_SMC:
Software ECC according to the Smart Media Specification.
The original Linux implementation had byte 0 and 1 swapped.
u-boot appears to conform to the 'original' linux implementation. The
following patch fixes this.
*** ../u-boot-1.1.5/drivers/nand/nand_ecc.c 2006-10-20
08:54:33.000000000 -0700
--- drivers/nand/nand_ecc.c 2008-06-10 12:59:21.000000000 -0700
***************
*** 118,123 ****
--- 118,124 ----
{
u_char idx, reg1, reg2, reg3;
int j;
+ u_char tmp0, tmp1;
/* Initialize variables */
reg1 = reg2 = reg3 = 0;
***************
*** 140,148 ****
--- 141,157 ----
/* Create non-inverted ECC code from line parity */
nand_trans_result(reg2, reg3, ecc_code);
+ #define CONFIG_MTD_NAND_ECC_SMC
/* Calculate final ECC code */
+ #ifdef CONFIG_MTD_NAND_ECC_SMC
+ tmp0 = ~ecc_code[0];
+ tmp1 = ~ecc_code[1];
+ ecc_code[0] = tmp1;
+ ecc_code[1] = tmp0;
+ #else
ecc_code[0] = ~ecc_code[0];
ecc_code[1] = ~ecc_code[1];
+ #endif
ecc_code[2] = ((~reg1) << 2) | 0x03;
return 0;
}
Mark Roths
Softair Microsystems
^ permalink raw reply [flat|nested] 2+ messages in thread
* [U-Boot-Users] u-boot and CONFIG_MTD_NAND_ECC_SMC patch
2008-06-11 0:06 [U-Boot-Users] u-boot and CONFIG_MTD_NAND_ECC_SMC patch mark roths
@ 2008-06-17 18:30 ` Scott Wood
0 siblings, 0 replies; 2+ messages in thread
From: Scott Wood @ 2008-06-17 18:30 UTC (permalink / raw)
To: u-boot
mark roths wrote:
> Sorry if this has been covered already, the problem exists in all the u-boot
> versions I have up to 1.2.0.
1.2.0 is rather old; you should check the latest code when submitting
bug reports and patches.
> *** ../u-boot-1.1.5/drivers/nand/nand_ecc.c 2006-10-20
> 08:54:33.000000000 -0700
> --- drivers/nand/nand_ecc.c 2008-06-10 12:59:21.000000000 -0700
> ***************
> *** 118,123 ****
> --- 118,124 ----
> {
> u_char idx, reg1, reg2, reg3;
> int j;
> + u_char tmp0, tmp1;
>
> /* Initialize variables */
> reg1 = reg2 = reg3 = 0;
> ***************
> *** 140,148 ****
> --- 141,157 ----
> /* Create non-inverted ECC code from line parity */
> nand_trans_result(reg2, reg3, ecc_code);
>
> + #define CONFIG_MTD_NAND_ECC_SMC
> /* Calculate final ECC code */
> + #ifdef CONFIG_MTD_NAND_ECC_SMC
> + tmp0 = ~ecc_code[0];
> + tmp1 = ~ecc_code[1];
> + ecc_code[0] = tmp1;
> + ecc_code[1] = tmp0;
> + #else
> ecc_code[0] = ~ecc_code[0];
> ecc_code[1] = ~ecc_code[1];
> + #endif
The current code appears to have a similar change already.
In the future, please use unified diffs, avoid whitespace mangling, and
add a Signed-off-by: line.
-Scott
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2008-06-17 18:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-06-11 0:06 [U-Boot-Users] u-boot and CONFIG_MTD_NAND_ECC_SMC patch mark roths
2008-06-17 18:30 ` Scott Wood
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox