public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* U-boot bch4_sw vs omap bch4_hw
@ 2012-12-07 15:26 jean-philippe francois
  2012-12-08  8:29 ` Ivan Djelic
  0 siblings, 1 reply; 6+ messages in thread
From: jean-philippe francois @ 2012-12-07 15:26 UTC (permalink / raw)
  To: ivan.djelic; +Cc: linux-mtd

Hi Ivan,

I have applied your patches for hardware bch ecc support on
OMAP. On the linux side, everything is fine. However I have some trouble
when it comes to u-boot and kernel interoperability.

A nand page written with bch4_sw ecc by U-boot fails the ecc step when
read by the kernel. Looking at a nanddump, OOB placement and size of
the ecc data are the same.

Do you know of any patch for u-boot that would make the  bch4_sw ecc
identical to the kernel one ?

Thank you,
Jean-Philippe François

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: U-boot bch4_sw vs omap bch4_hw
  2012-12-07 15:26 U-boot bch4_sw vs omap bch4_hw jean-philippe francois
@ 2012-12-08  8:29 ` Ivan Djelic
  2012-12-10  9:41   ` jean-philippe francois
  0 siblings, 1 reply; 6+ messages in thread
From: Ivan Djelic @ 2012-12-08  8:29 UTC (permalink / raw)
  To: jean-philippe francois; +Cc: linux-mtd@lists.infradead.org

On Fri, Dec 07, 2012 at 03:26:06PM +0000, jean-philippe francois wrote:
> Hi Ivan,
> 
> I have applied your patches for hardware bch ecc support on
> OMAP. On the linux side, everything is fine. However I have some trouble
> when it comes to u-boot and kernel interoperability.
> 
> A nand page written with bch4_sw ecc by U-boot fails the ecc step when
> read by the kernel. Looking at a nanddump, OOB placement and size of
> the ecc data are the same.
> 
> Do you know of any patch for u-boot that would make the  bch4_sw ecc
> identical to the kernel one ?

Hi Jean-Philippe,

If you point me to a git repo with the exact u-boot version you are using,
I can probably provide a patch (or at least understand the problem).
BR,
--
Ivan

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: U-boot bch4_sw vs omap bch4_hw
  2012-12-08  8:29 ` Ivan Djelic
@ 2012-12-10  9:41   ` jean-philippe francois
  2012-12-10 10:35     ` Andreas Bießmann
  2012-12-13 14:35     ` Ivan Djelic
  0 siblings, 2 replies; 6+ messages in thread
From: jean-philippe francois @ 2012-12-10  9:41 UTC (permalink / raw)
  To: Ivan Djelic; +Cc: linux-mtd@lists.infradead.org

2012/12/8 Ivan Djelic <ivan.djelic@parrot.com>:
> On Fri, Dec 07, 2012 at 03:26:06PM +0000, jean-philippe francois wrote:
>> Hi Ivan,
>>
>> I have applied your patches for hardware bch ecc support on
>> OMAP. On the linux side, everything is fine. However I have some trouble
>> when it comes to u-boot and kernel interoperability.
>>
>> A nand page written with bch4_sw ecc by U-boot fails the ecc step when
>> read by the kernel. Looking at a nanddump, OOB placement and size of
>> the ecc data are the same.
>>
>> Do you know of any patch for u-boot that would make the  bch4_sw ecc
>> identical to the kernel one ?
>
> Hi Jean-Philippe,
>
> If you point me to a git repo with the exact u-boot version you are using,
> I can probably provide a patch (or at least understand the problem).
> BR,
> --
> Ivan
I am using an u-boot from the arago project :
http://arago-project.org/git/projects/?p=u-boot-omap3.git;a=tags

So it is quite old.
I will probably have to modify x-loader, too.
Both implementation use very similar file for hardware assisted
bch decoding.

If this code is too old for you to look at, could you help me find an omap
project that "new ecc" all the way up from x-loader to u-boot + kernel ?

If I understands things correctly, I have two options if I want to use
Nand that needs
4-bit ecc :
- Stick with the old ecc scheme in x-loader and u-boot, and use
software 4-bit bch in the kernel.
  Is this compatible with using ubifs ?
- Implement new ecc scheme in x-loader and u-boot, and use hardware
assisted bch-4 in the kernel.
Is this correct ?

Thank you for your interest,

Jean-Philippe François.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: U-boot bch4_sw vs omap bch4_hw
  2012-12-10  9:41   ` jean-philippe francois
@ 2012-12-10 10:35     ` Andreas Bießmann
  2012-12-10 11:11       ` Andreas Bießmann
  2012-12-13 14:35     ` Ivan Djelic
  1 sibling, 1 reply; 6+ messages in thread
From: Andreas Bießmann @ 2012-12-10 10:35 UTC (permalink / raw)
  To: jean-philippe francois; +Cc: Ivan Djelic, linux-mtd@lists.infradead.org

Hi Ivan Djelic and Jean-Philippe Francois,

On 10.12.2012 10:41, jean-philippe francois wrote:
> 2012/12/8 Ivan Djelic <ivan.djelic@parrot.com>:
>> On Fri, Dec 07, 2012 at 03:26:06PM +0000, jean-philippe francois wrote:
>>> Hi Ivan,
>>>
>>> I have applied your patches for hardware bch ecc support on
>>> OMAP. On the linux side, everything is fine. However I have some trouble
>>> when it comes to u-boot and kernel interoperability.
>>>
>>> A nand page written with bch4_sw ecc by U-boot fails the ecc step when
>>> read by the kernel. Looking at a nanddump, OOB placement and size of
>>> the ecc data are the same.
>>>
>>> Do you know of any patch for u-boot that would make the  bch4_sw ecc
>>> identical to the kernel one ?

can you both please have a loot at
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/147698

>> Hi Jean-Philippe,
>>
>> If you point me to a git repo with the exact u-boot version you are using,
>> I can probably provide a patch (or at least understand the problem).
>> BR,
>> --
>> Ivan
> I am using an u-boot from the arago project :
> http://arago-project.org/git/projects/?p=u-boot-omap3.git;a=tags
> 
> So it is quite old.
> I will probably have to modify x-loader, too.

current u-boot do not need x-loader any more.

> Both implementation use very similar file for hardware assisted
> bch decoding.
> 
> If this code is too old for you to look at, could you help me find an omap
> project that "new ecc" all the way up from x-loader to u-boot + kernel ?
> 
> If I understands things correctly, I have two options if I want to use
> Nand that needs
> 4-bit ecc :
> - Stick with the old ecc scheme in x-loader and u-boot, and use
> software 4-bit bch in the kernel.
>   Is this compatible with using ubifs ?
> - Implement new ecc scheme in x-loader and u-boot, and use hardware
> assisted bch-4 in the kernel.
> Is this correct ?

 * use 1-bit hamming 'ROM-layout' for SPL mtd and 4-bit BCH8 in all
other sections, see my u-boot patches.

Would be great to have some testers for these patches.

Best regards

Andreas Bießmann

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: U-boot bch4_sw vs omap bch4_hw
  2012-12-10 10:35     ` Andreas Bießmann
@ 2012-12-10 11:11       ` Andreas Bießmann
  0 siblings, 0 replies; 6+ messages in thread
From: Andreas Bießmann @ 2012-12-10 11:11 UTC (permalink / raw)
  To: linux-mtd

On 10.12.2012 11:35, Andreas Bießmann wrote:
> Hi Ivan Djelic and Jean-Philippe Francois,
> 
> On 10.12.2012 10:41, jean-philippe francois wrote:
>> 2012/12/8 Ivan Djelic <ivan.djelic@parrot.com>:

<snip>

> 
>  * use 1-bit hamming 'ROM-layout' for SPL mtd and 4-bit BCH8 in all
> other sections, see my u-boot patches.

it is in fact 8-bit BCH (not 4-bit). I have chosen BCH8 here cause some
OMAP3 seem to have broken BCH4. The kernel also recommends to use BCH8
for the same cause. However this can be made configurable in u-boot.

best regards

Andreas Bießmann

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: U-boot bch4_sw vs omap bch4_hw
  2012-12-10  9:41   ` jean-philippe francois
  2012-12-10 10:35     ` Andreas Bießmann
@ 2012-12-13 14:35     ` Ivan Djelic
  1 sibling, 0 replies; 6+ messages in thread
From: Ivan Djelic @ 2012-12-13 14:35 UTC (permalink / raw)
  To: jean-philippe francois; +Cc: andreas.devel, linux-mtd@lists.infradead.org

On Mon, Dec 10, 2012 at 09:41:10AM +0000, jean-philippe francois wrote:
> 2012/12/8 Ivan Djelic <ivan.djelic@parrot.com>:
> > On Fri, Dec 07, 2012 at 03:26:06PM +0000, jean-philippe francois wrote:
> >> Hi Ivan,
> >>
> >> I have applied your patches for hardware bch ecc support on
> >> OMAP. On the linux side, everything is fine. However I have some trouble
> >> when it comes to u-boot and kernel interoperability.
> >>
> >> A nand page written with bch4_sw ecc by U-boot fails the ecc step when
> >> read by the kernel. Looking at a nanddump, OOB placement and size of
> >> the ecc data are the same.
> >>
> >> Do you know of any patch for u-boot that would make the  bch4_sw ecc
> >> identical to the kernel one ?
> >
> > Hi Jean-Philippe,
> >
> > If you point me to a git repo with the exact u-boot version you are using,
> > I can probably provide a patch (or at least understand the problem).
> > BR,
> > --
> > Ivan
> I am using an u-boot from the arago project :
> http://arago-project.org/git/projects/?p=u-boot-omap3.git;a=tags
> 
> So it is quite old.
> I will probably have to modify x-loader, too.
> Both implementation use very similar file for hardware assisted
> bch decoding.
> 
> If this code is too old for you to look at, could you help me find an omap
> project that "new ecc" all the way up from x-loader to u-boot + kernel ?
> 
> If I understands things correctly, I have two options if I want to use
> Nand that needs
> 4-bit ecc :
> - Stick with the old ecc scheme in x-loader and u-boot, and use
> software 4-bit bch in the kernel.
>   Is this compatible with using ubifs ?
> - Implement new ecc scheme in x-loader and u-boot, and use hardware
> assisted bch-4 in the kernel.
> Is this correct ?
> 

Hi Jean-Philippe,

I had a look at your u-boot version. It uses a BCH ECC layout from a TI
patch, which is indeed different from the current OMAP3 kernel version:

1. BCH4 ecc sequence is made of 13 nibbles stored into 7 bytes (14 nibbles) such
that there is a (zero) padding nibble. This padding nibble is stored:
 - at the end of the sequence in the kernel
 - at the beginning of the sequence in arago u-boot

2. ECC is computed on different input data sets:
 - kernel always computes an ecc vector on 512 bytes
 - arago u-boot computes an ecc vector on 512+6.5 bytes (data + ecc), which
   results in a zero ecc vector if no error was detected (and makes reading and
   writing asymmetric)

3. Kernel codes adds a constant polynomial to enable erased page reading.

Point 2 and 3 would be very easily fixed if ecc alignment were the same in
both cases; but it is not (point 1), so the fix is a little trickier and is
the resulting code is basically identical to the patch referenced by
Andreas Bießmann.

HTH,
--
Ivan

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-12-13 14:35 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-07 15:26 U-boot bch4_sw vs omap bch4_hw jean-philippe francois
2012-12-08  8:29 ` Ivan Djelic
2012-12-10  9:41   ` jean-philippe francois
2012-12-10 10:35     ` Andreas Bießmann
2012-12-10 11:11       ` Andreas Bießmann
2012-12-13 14:35     ` Ivan Djelic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox