public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: "Rafał Miłecki" <zajec5@gmail.com>
To: William Zhang <william.zhang@broadcom.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	u-boot@lists.denx.de, Tom Rini <trini@konsulko.com>
Cc: Anand Gore <anand.gore@broadcom.com>,
	Kursad Oney <kursad.oney@broadcom.com>,
	Joel Peshkin <joel.peshkin@broadcom.com>,
	Philippe Reynes <philippe.reynes@softathome.com>,
	Brian Norris <computersforpeace@gmail.com>
Subject: Re: [PATCH] mtd: rawnand: nand_base: Handle algorithm selection
Date: Thu, 26 Jan 2023 09:04:00 +0100	[thread overview]
Message-ID: <c4316304-4be5-daef-e1c2-2498ec878d5e@gmail.com> (raw)
In-Reply-To: <67b8db8e-0cd9-b2d1-19ff-ba9afdab15d2@broadcom.com>

On 26.01.2023 02:14, William Zhang wrote:
> On 01/21/2023 03:43 PM, Linus Walleij wrote:
>> For BRCMNAND with 1-bit BCH ECC (BCH-1) such as used on the
>> D-Link DIR-885L and DIR-890L routers, we need to explicitly
>> select the ECC like this in the device tree:
>>
>>    nand-ecc-algo = "bch";
>>    nand-ecc-strength = <1>;
>>    nand-ecc-step-size = <512>;
>>
>> This is handled by the Linux kernel but U-Boot core does
>> not respect this. Fix it up by parsing the algorithm and
>> preserve the behaviour using this property to select
>> software BCH as far as possible.
> 
> For 1 bit HW ECC, the BRCMNAND driver only uses HAMMING ECC.  The brcmnand_setup_dev function should take care of it with just these two properties in the device tress without any code changes:
>      nand-ecc-strength = <1>;
>      nand-ecc-step-size = <512>;
> unless these D-Link device has always been using software BCH-1 and wants to continue to use software BCH-1.

Please check
arch/arm/boot/dts/bcm5301x-nand-cs0-bch1.dtsi
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/bcm5301x-nand-cs0-bch1.dtsi

It's included by
arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/bcm47094-dlink-dir-885l.dts

I can confirm D-Link decided to use BCH-1 for some of its devices. I
didn't expect it neither and that required fixing up brcmnand driver in
Linux actually.


> BTW,  I didn't see this change from master branch of linux nand base driver. The "nand-ecc-algo" is only used by the ecc engine code(ecc.c) but this code is not in the u-boot obviously. Were you porting this from a different version of linux nand driver?

My original proposal for brcmnand looked like this:
[PATCH 3/3] mtd: brcmnand: respect ECC algorithm set by NAND subsystem
https://lore.kernel.org/lkml/1461324197-1333-3-git-send-email-zajec5@gmail.com/

It was reworked by Brian to a more backward compatible solution that got
accepted:
[PATCH] mtd: brcmnand: respect ECC algorithm set by the NAND subsystem
https://lore.kernel.org/lkml/20160426055355.GA25981@localhost/
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=666b65683dad9aa90efaa4aad24ef3710101e3aa

  reply	other threads:[~2023-01-26  8:04 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-21 23:43 [PATCH] mtd: rawnand: nand_base: Handle algorithm selection Linus Walleij
2023-01-26  1:14 ` William Zhang
2023-01-26  8:04   ` Rafał Miłecki [this message]
2023-01-26  8:59   ` Linus Walleij
2023-01-26 17:40     ` William Zhang
2023-03-07 23:05 ` Linus Walleij
2023-03-08 16:55   ` Tom Rini
2023-03-08 17:10     ` Michael Nazzareno Trimarchi
2023-03-08 17:48 ` Michael Nazzareno Trimarchi

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=c4316304-4be5-daef-e1c2-2498ec878d5e@gmail.com \
    --to=zajec5@gmail.com \
    --cc=anand.gore@broadcom.com \
    --cc=computersforpeace@gmail.com \
    --cc=joel.peshkin@broadcom.com \
    --cc=kursad.oney@broadcom.com \
    --cc=linus.walleij@linaro.org \
    --cc=philippe.reynes@softathome.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=william.zhang@broadcom.com \
    /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