mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* Nand with 256 oob
@ 2014-07-11 14:13 Raphaël Poggi
  2014-07-14  6:21 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Raphaël Poggi @ 2014-07-11 14:13 UTC (permalink / raw)
  To: barebox

Hi all !

I want to use barebox with nand support (Soft ECC) on a custom board
based on SAM9M10, but the nand has a 256 oob size and it is not
supported on barebox.

Barebox fails, because there is no oob scheme defined for 256 size.

if (!chip->ecc.layout && (chip->ecc.mode != NAND_ECC_SOFT_BCH)) {
switch (mtd->oobsize) {
case 8:
chip->ecc.layout = &nand_oob_8;
break;
case 16:
chip->ecc.layout = &nand_oob_16;
break;
case 64:
chip->ecc.layout = &nand_oob_64;
break;
case 128:
chip->ecc.layout = &nand_oob_128;
break;
default:
pr_warn("No oob scheme defined for oobsize %d\n",
  mtd->oobsize);
BUG();
}
}


I have found this oob_256 scheme but I don't know if it's correct or not.

static struct nand_ecclayout nand_oob_256 = {
.eccbytes = 96,
.eccpos = {
160, 161, 162, 163, 164, 165, 166, 167,
168, 169, 170, 171, 172, 173, 174, 175,
   176, 177, 178, 179, 180, 181, 182, 183,
   184, 185, 186, 187, 188, 189, 190, 191,
   192, 193, 194, 195, 196, 197, 198, 199,
   200, 201, 202, 203, 204, 205, 206, 207,
   208, 209, 210, 211, 212, 213, 214, 215,
   216, 217, 218, 219, 220, 221, 222, 223,
   224, 225, 226, 227, 228, 229, 230, 231,
   232, 233, 234, 235, 236, 237, 238, 239,
   240, 241, 242, 243, 244, 245, 246, 247,
   248, 249, 250, 251, 252, 253, 254, 255},
.oobfree = {
{.offset = 2,
.length = 158}}
};

Can we use this scheme ? Or there is another solution ?

Thanks,
Raphaël

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

* Re: Nand with 256 oob
  2014-07-11 14:13 Nand with 256 oob Raphaël Poggi
@ 2014-07-14  6:21 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2014-07-14  6:21 UTC (permalink / raw)
  To: Raphaël Poggi; +Cc: barebox

On Fri, Jul 11, 2014 at 04:13:47PM +0200, Raphaël Poggi wrote:
> Hi all !
> 
> I want to use barebox with nand support (Soft ECC) on a custom board
> based on SAM9M10, but the nand has a 256 oob size and it is not
> supported on barebox.
> 
> Barebox fails, because there is no oob scheme defined for 256 size.
> 
> if (!chip->ecc.layout && (chip->ecc.mode != NAND_ECC_SOFT_BCH)) {
> switch (mtd->oobsize) {
> case 8:
> chip->ecc.layout = &nand_oob_8;
> break;
> case 16:
> chip->ecc.layout = &nand_oob_16;
> break;
> case 64:
> chip->ecc.layout = &nand_oob_64;
> break;
> case 128:
> chip->ecc.layout = &nand_oob_128;
> break;
> default:
> pr_warn("No oob scheme defined for oobsize %d\n",
>   mtd->oobsize);
> BUG();
> }
> }
> 
> 
> I have found this oob_256 scheme but I don't know if it's correct or not.
> 
> static struct nand_ecclayout nand_oob_256 = {
> .eccbytes = 96,
> .eccpos = {
> 160, 161, 162, 163, 164, 165, 166, 167,
> 168, 169, 170, 171, 172, 173, 174, 175,
>    176, 177, 178, 179, 180, 181, 182, 183,
>    184, 185, 186, 187, 188, 189, 190, 191,
>    192, 193, 194, 195, 196, 197, 198, 199,
>    200, 201, 202, 203, 204, 205, 206, 207,
>    208, 209, 210, 211, 212, 213, 214, 215,
>    216, 217, 218, 219, 220, 221, 222, 223,
>    224, 225, 226, 227, 228, 229, 230, 231,
>    232, 233, 234, 235, 236, 237, 238, 239,
>    240, 241, 242, 243, 244, 245, 246, 247,
>    248, 249, 250, 251, 252, 253, 254, 255},
> .oobfree = {
> {.offset = 2,
> .length = 158}}
> };
> 
> Can we use this scheme ? Or there is another solution ?

Please grep for nand_bch_init in both the kernel and barebox.
This function automatically constructs a suitable ecc layout
based on the NAND parameters. This code doesn't seem to have users
in barebox, so I don't know whether it works correctly, but
this is the way to go.

Sascha

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

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

end of thread, other threads:[~2014-07-14  6:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-11 14:13 Nand with 256 oob Raphaël Poggi
2014-07-14  6:21 ` Sascha Hauer

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