mbox series

[0/7] mtd: nand: brcmnand: Backported fixes from Linux

Message ID 20240911-brcmnand-fixes-v1-0-be112a20aaf1@linaro.org
Headers show
Series mtd: nand: brcmnand: Backported fixes from Linux | expand

Message

Linus Walleij Sept. 11, 2024, 7:11 a.m. UTC
These are a number of assorted upstream Linux fixes to the
BRCMNAND driver that I have backported in an attempt to get
BRCMBCA working with U-Boot (still not there).

This patch set lowers the hamming distance between the Linux
and U-Boot drivers a bit as well, while we deviate quite
a bit it is still possible to bring fixes over thanks to
exercises like this.

The set tries to prepare the ground for the BCMBCA driver
which I have a port of which is however not yet working
as it should. This is why the read data callback is included.

These patches seem to work fine for me with my devices but
I know the maintainers have some nice test farms so try to
put these to test and see if we can merge them. I bet the
Broadcom folks has this on their TODO list anyway.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
Linus Walleij (1):
      mtd: rawnand: brcmnand: Add read data bus interface

William Zhang (6):
      mtd: rawnand: brcmnand: Fix ECC level field setting for v7.2 controller
      mtd: rawnand: brcmnand: Fix potential false time out warning
      mtd: rawnand: brcmnand: Fix potential out-of-bounds access in oob write
      mtd: rawnand: brcmnand: Fix mtd oobsize
      mtd: rawnand: brcmnand: Support write protection setting from dts
      mtd: rawnand: brcmnand: Add support for getting ecc setting from strap

 drivers/mtd/nand/raw/brcmnand/brcmnand.c | 206 ++++++++++++++++++++++++-------
 drivers/mtd/nand/raw/brcmnand/brcmnand.h |   2 +
 2 files changed, 164 insertions(+), 44 deletions(-)
---
base-commit: 5f044932413694475422d4b16607dfcf9aff8781
change-id: 20240911-brcmnand-fixes-dabd75230a63

Best regards,

Comments

William Zhang Sept. 12, 2024, 1:32 a.m. UTC | #1
Hi Linus,

Thanks for merging the patches to u-boot.   We actually had something
similar
here locally but just didn't get the chance to upstream yet.

We will review and compare your patches to ours and get back to you.

Thanks,
William

> -----Original Message-----
> From: Linus Walleij <linus.walleij@linaro.org>
> Sent: Wednesday, September 11, 2024 12:11 AM
> To: u-boot@lists.denx.de; Dario Binacchi
> <dario.binacchi@amarulasolutions.com>; Michael Trimarchi
> <michael@amarulasolutions.com>; Anand Gore
> <anand.gore@broadcom.com>; William Zhang
> <william.zhang@broadcom.com>; Kursad Oney
> <kursad.oney@broadcom.com>; Philippe Reynes
> <philippe.reynes@softathome.com>
> Cc: Linus Walleij <linus.walleij@linaro.org>; Florian Fainelli
> <florian.fainelli@broadcom.com>; Miquel Raynal
> <miquel.raynal@bootlin.com>; Kamal Dasu <kamal.dasu@broadcom.com>;
> David Regan <dregan@broadcom.com>
> Subject: [PATCH 0/7] mtd: nand: brcmnand: Backported fixes from Linux
>
> These are a number of assorted upstream Linux fixes to the
> BRCMNAND driver that I have backported in an attempt to get
> BRCMBCA working with U-Boot (still not there).
>
> This patch set lowers the hamming distance between the Linux
> and U-Boot drivers a bit as well, while we deviate quite
> a bit it is still possible to bring fixes over thanks to
> exercises like this.
>
> The set tries to prepare the ground for the BCMBCA driver
> which I have a port of which is however not yet working
> as it should. This is why the read data callback is included.
>
> These patches seem to work fine for me with my devices but
> I know the maintainers have some nice test farms so try to
> put these to test and see if we can merge them. I bet the
> Broadcom folks has this on their TODO list anyway.
>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> Linus Walleij (1):
>       mtd: rawnand: brcmnand: Add read data bus interface
>
> William Zhang (6):
>       mtd: rawnand: brcmnand: Fix ECC level field setting for v7.2
> controller
>       mtd: rawnand: brcmnand: Fix potential false time out warning
>       mtd: rawnand: brcmnand: Fix potential out-of-bounds access in oob
> write
>       mtd: rawnand: brcmnand: Fix mtd oobsize
>       mtd: rawnand: brcmnand: Support write protection setting from dts
>       mtd: rawnand: brcmnand: Add support for getting ecc setting from
> strap
>
>  drivers/mtd/nand/raw/brcmnand/brcmnand.c | 206
> ++++++++++++++++++++++++-------
>  drivers/mtd/nand/raw/brcmnand/brcmnand.h |   2 +
>  2 files changed, 164 insertions(+), 44 deletions(-)
> ---
> base-commit: 5f044932413694475422d4b16607dfcf9aff8781
> change-id: 20240911-brcmnand-fixes-dabd75230a63
>
> Best regards,
> --
> Linus Walleij <linus.walleij@linaro.org>
Linus Walleij Sept. 12, 2024, 8:15 a.m. UTC | #2
On Thu, Sep 12, 2024 at 3:32 AM William Zhang
<william.zhang@broadcom.com> wrote:

> Thanks for merging the patches to u-boot.   We actually had something
> similar
> here locally but just didn't get the chance to upstream yet.
>
> We will review and compare your patches to ours and get back to you.

Ah, excellent, I guess you guys know the stuff better than me
so I prefer if your patches are used.

Do you even have U-Boot working on BCMBCA? I didn't get the
NAND to detect properly yet despite all the backported patches. :/

Yours,
Linus Walleij
William Zhang Sept. 16, 2024, 4:45 a.m. UTC | #3
> -----Original Message-----
> From: Linus Walleij <linus.walleij@linaro.org>
> Sent: Thursday, September 12, 2024 1:16 AM
> To: William Zhang <william.zhang@broadcom.com>
> Cc: u-boot@lists.denx.de; Dario Binacchi
> <dario.binacchi@amarulasolutions.com>; Michael Trimarchi
> <michael@amarulasolutions.com>; Anand Gore
> <anand.gore@broadcom.com>; Kursad Oney
> <kursad.oney@broadcom.com>; Philippe Reynes
> <philippe.reynes@softathome.com>; Florian Fainelli
> <florian.fainelli@broadcom.com>; Miquel Raynal
> <miquel.raynal@bootlin.com>; Kamal Dasu <kamal.dasu@broadcom.com>;
> David Regan <dregan@broadcom.com>
> Subject: Re: [PATCH 0/7] mtd: nand: brcmnand: Backported fixes from
> Linux
>
> On Thu, Sep 12, 2024 at 3:32 AM William Zhang
> <william.zhang@broadcom.com> wrote:
>
> > Thanks for merging the patches to u-boot.   We actually had something
> > similar
> > here locally but just didn't get the chance to upstream yet.
> >
> > We will review and compare your patches to ours and get back to you.
>
> Ah, excellent, I guess you guys know the stuff better than me
> so I prefer if your patches are used.
>
> Do you even have U-Boot working on BCMBCA? I didn't get the
> NAND to detect properly yet despite all the backported patches. :/
>
Yes we have it working.  And your patches works too after fixing two
Issues that I will comment on the specific patch.  You will need to
enable the  NAND related configurations and the nand dts node.

You can use existing dts node to set the specific ecc level, oob size and
ecc step size.  Or use the new automatically detection from the strap
property brcm,nand-ecc-use-strap that I upstreamed to linux.

What SoC do you use?

> Yours,
> Linus Walleij
Linus Walleij Sept. 16, 2024, 9:22 a.m. UTC | #4
On Mon, Sep 16, 2024 at 6:45 AM William Zhang
<william.zhang@broadcom.com> wrote:

> Yes we have it working.  And your patches works too after fixing two
> Issues that I will comment on the specific patch.

Yay!

>  You will need to
> enable the  NAND related configurations and the nand dts node.

Aha maybe I simply missed the DTS node...

> You can use existing dts node to set the specific ecc level, oob size and
> ecc step size.  Or use the new automatically detection from the strap
> property brcm,nand-ecc-use-strap that I upstreamed to linux.

I was planning to used the strap, which is ... what we should have been
doing all the time. Oh well, no turning back time I guess. Maybe we
can fix a lot of DTS:es to use the strap though?

> What SoC do you use?

This is on BCM6846.

Thanks William!
Linus
William Zhang Sept. 17, 2024, 12:19 a.m. UTC | #5
> -----Original Message-----
> From: Linus Walleij <linus.walleij@linaro.org>
> Sent: Monday, September 16, 2024 2:23 AM
> To: William Zhang <william.zhang@broadcom.com>
> Cc: u-boot@lists.denx.de; Dario Binacchi
> <dario.binacchi@amarulasolutions.com>; Michael Trimarchi
> <michael@amarulasolutions.com>; Anand Gore
> <anand.gore@broadcom.com>; Kursad Oney
> <kursad.oney@broadcom.com>; Philippe Reynes
> <philippe.reynes@softathome.com>; Florian Fainelli
> <florian.fainelli@broadcom.com>; Miquel Raynal
> <miquel.raynal@bootlin.com>; Kamal Dasu <kamal.dasu@broadcom.com>;
> David Regan <dregan@broadcom.com>
> Subject: Re: [PATCH 0/7] mtd: nand: brcmnand: Backported fixes from
> Linux
>
> On Mon, Sep 16, 2024 at 6:45 AM William Zhang
> <william.zhang@broadcom.com> wrote:
>
> > Yes we have it working.  And your patches works too after fixing two
> > Issues that I will comment on the specific patch.
>
> Yay!
>
> >  You will need to
> > enable the  NAND related configurations and the nand dts node.
>
> Aha maybe I simply missed the DTS node...
>
> > You can use existing dts node to set the specific ecc level, oob size
> > and
> > ecc step size.  Or use the new automatically detection from the strap
> > property brcm,nand-ecc-use-strap that I upstreamed to linux.
>
> I was planning to used the strap, which is ... what we should have been
> doing all the time. Oh well, no turning back time I guess. Maybe we
> can fix a lot of DTS:es to use the strap though?
>
Yes we will upstream the dts including the binding document and other
related patches.   Your series can go in first.

> > What SoC do you use?
>
> This is on BCM6846.
>
6846 will work.  Let me know if it still does not work after dts fix.

> Thanks William!
> Linus
Linus Walleij Sept. 17, 2024, 7:07 p.m. UTC | #6
On Tue, Sep 17, 2024 at 2:19 AM William Zhang
<william.zhang@broadcom.com> wrote:

> > > What SoC do you use?
> >
> > This is on BCM6846.
> >
> 6846 will work.  Let me know if it still does not work after dts fix.

Yes it work just fine! I dropped
CONFIG_SYS_NAND_ONFI_DETECTION and then it detects
and works fine on Genexis XG6846B, see here for a full
session where I do some ubifs inspection:
https://dflund.se/~triad/krad/genexis-xg6846b/ubi-info.txt

Yours,
Linus Walleij