From: Sascha Hauer <sha@pengutronix.de>
To: Tibault Damman <tibault.damman@basalte.be>
Cc: "barebox@lists.infradead.org" <barebox@lists.infradead.org>
Subject: Re: nand "BCH decoding failed" when using bch8_hw_romcode ecc mode
Date: Fri, 18 Mar 2022 12:59:25 +0100 [thread overview]
Message-ID: <20220318115925.GC12181@pengutronix.de> (raw)
In-Reply-To: <a4886a48-717f-d970-49af-551f3138e201@basalte.be>
On Fri, Mar 18, 2022 at 11:32:36AM +0100, Tibault Damman wrote:
> Gah, I just saw how that mail was sent, let me try that again:
>
>
> Because the data looks right(?), despite the error prints, I tried
> ubiformat again from barebox, then booted linux from SD, and attached
> the ubi nand partition in linux... which worked fine.
> All volumes and data were there.
>
> Very confused about what's going wrong here.
You can correctly write to the NAND and can even correctly read the
data, that's good news.
Reading is done in omap_gpmc_read_page_bch_rom_mode(). Here we have this
to read the OOB data:
> p = chip->oob_poi;
>
> p += omap_gpmc_read_buf_manual(chip, p, 2, 5);
>
> for (i = 0; i < 4; i++) {
> p += omap_gpmc_read_buf_manual(chip, p, 13, i + 1);
> p += omap_gpmc_read_buf_manual(chip, p, 1, 5);
> }
omap_gpmc_read_buf_manual() is called with uneven numbers of bytes. This
goes down to omap_read_buf_pref():
> /* take care of subpage reads */
> if (len % 4) {
> if (info->nand.options & NAND_BUSWIDTH_16)
> readsw(info->cs_base, buf, (len % 4) / 2);
> else
> readsb(info->cs_base, buf, len % 4);
> p = (u32 *) (buf + len % 4);
> len -= len % 4;
> }
This can't work properly for 16bit NANDs.
I don't know how to do this correctly though, you'll have to experiment
a bit here.
Have a look at "md -s /dev/nand0.raw 0+2112", then you can see how the
OOB data should look like and compare it with the data read in
omap_gpmc_read_page_bch_rom_mode(). The ".raw" is important, I saw you
printed 2112 bytes from a non raw device. I meant to print a single
page, on a non raw device that would be 2048. You might have to enable
CONFIG_MTD_RAW_DEVICE to get the raw device.
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
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
next prev parent reply other threads:[~2022-03-18 12:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-16 13:45 Tibault Damman
2022-03-17 7:46 ` Sascha Hauer
2022-03-18 9:49 ` Tibault Damman
2022-03-18 10:32 ` Tibault Damman
2022-03-18 11:59 ` Sascha Hauer [this message]
2022-03-18 21:41 ` Trent Piepho
2022-03-21 8:04 ` Tibault Damman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220318115925.GC12181@pengutronix.de \
--to=sha@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=tibault.damman@basalte.be \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox