* ndfc ecc byte order
@ 2008-01-30 19:52 Sean MacLennan
2008-01-30 21:01 ` Stefan Roese
0 siblings, 1 reply; 4+ messages in thread
From: Sean MacLennan @ 2008-01-30 19:52 UTC (permalink / raw)
To: linuxppc-dev
There seems to be a byte order conflict between the u-boot and Linux
ndfc drivers.
u-boot has the following:
/* The NDFC uses Smart Media (SMC) bytes order*/
ecc_code[0] = p[2];
ecc_code[1] = p[1];
ecc_code[2] = p[3];
the kernel has:
ecc_code[0] = p[1];
ecc_code[1] = p[2];
ecc_code[2] = p[3];
I think u-boot has it right since u-boot and kernel software calculated
ECCs agree. Anybody know a reason *not* to switch to the SMC byte order?
Note that the kernel version will work if you are reading/writing from
the kernel since they agree on the wrong ECC :p
Cheers,
Sean
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ndfc ecc byte order
2008-01-30 19:52 ndfc ecc byte order Sean MacLennan
@ 2008-01-30 21:01 ` Stefan Roese
2008-02-01 8:12 ` Stefan Roese
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Roese @ 2008-01-30 21:01 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Sean MacLennan
On Wednesday 30 January 2008, Sean MacLennan wrote:
> There seems to be a byte order conflict between the u-boot and Linux
> ndfc drivers.
>
> u-boot has the following:
>
> /* The NDFC uses Smart Media (SMC) bytes order*/
> ecc_code[0] = p[2];
> ecc_code[1] = p[1];
> ecc_code[2] = p[3];
>
> the kernel has:
>
> ecc_code[0] = p[1];
> ecc_code[1] = p[2];
> ecc_code[2] = p[3];
>
> I think u-boot has it right since u-boot and kernel software calculated
> ECCs agree. Anybody know a reason *not* to switch to the SMC byte order?
Please take a look at Kconfig
config MTD_NAND_NDFC
tristate "NDFC NanD Flash Controller"
depends on 4xx && !PPC_MERGE
select MTD_NAND_ECC_SMC
So the SMC byte ordering is selected and it should match the version used in
U-Boot. In Linux the swapping is done in nand_ecc.c.
So it should work correctly in the current configuration. At least I didn't
notice any problems on all the 4xx platforms I used till now.
Best regards,
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ndfc ecc byte order
2008-01-30 21:01 ` Stefan Roese
@ 2008-02-01 8:12 ` Stefan Roese
2008-02-01 8:34 ` Stefan Roese
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Roese @ 2008-02-01 8:12 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Sean MacLennan
On Wednesday 30 January 2008, Stefan Roese wrote:
> On Wednesday 30 January 2008, Sean MacLennan wrote:
> > There seems to be a byte order conflict between the u-boot and Linux
> > ndfc drivers.
> >
> > u-boot has the following:
> >
> > /* The NDFC uses Smart Media (SMC) bytes order*/
> > ecc_code[0] = p[2];
> > ecc_code[1] = p[1];
> > ecc_code[2] = p[3];
> >
> > the kernel has:
> >
> > ecc_code[0] = p[1];
> > ecc_code[1] = p[2];
> > ecc_code[2] = p[3];
> >
> > I think u-boot has it right since u-boot and kernel software calculated
> > ECCs agree. Anybody know a reason *not* to switch to the SMC byte order?
>
> Please take a look at Kconfig
>
> config MTD_NAND_NDFC
> tristate "NDFC NanD Flash Controller"
> depends on 4xx && !PPC_MERGE
> select MTD_NAND_ECC_SMC
>
> So the SMC byte ordering is selected and it should match the version used
> in U-Boot. In Linux the swapping is done in nand_ecc.c.
Seems that I was incorrect here. Tests showed that writing from Linux and then
reading back from U-Boot results in ECC errors. My comment above is bogus,
since nand_calculate_ecc() from nand_ecc.c is not used with HW-ECC generation
enabled.
I'll send a patch to fix this in a short while.
Best regards,
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: ndfc ecc byte order
2008-02-01 8:12 ` Stefan Roese
@ 2008-02-01 8:34 ` Stefan Roese
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Roese @ 2008-02-01 8:34 UTC (permalink / raw)
To: linuxppc-dev; +Cc: Sean MacLennan
On Friday 01 February 2008, Stefan Roese wrote:
> > So the SMC byte ordering is selected and it should match the version used
> > in U-Boot. In Linux the swapping is done in nand_ecc.c.
>
> Seems that I was incorrect here. Tests showed that writing from Linux and
> then reading back from U-Boot results in ECC errors. My comment above is
> bogus, since nand_calculate_ecc() from nand_ecc.c is not used with HW-ECC
> generation enabled.
And after another coffee I noticed that the current Linux implementation is
correct. The U-Boot implementation needs to get fixed. Brown paper bag time
for me.
Best regards,
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2008-02-01 8:34 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-30 19:52 ndfc ecc byte order Sean MacLennan
2008-01-30 21:01 ` Stefan Roese
2008-02-01 8:12 ` Stefan Roese
2008-02-01 8:34 ` Stefan Roese
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).