All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kestrel seventyfour <kestrelseventyfour@gmail.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mtd: rawnand: xway: No hardcoded ECC engine, use device tree setting
Date: Wed, 25 Aug 2021 16:07:05 +0200	[thread overview]
Message-ID: <CAE9cyGRuoaiTu40Yu0po3dykk1fTq_VkqwNfrQkJq8DR6FPRpw@mail.gmail.com> (raw)
In-Reply-To: <20210825105126.4c1c15cb@xps13>

Hi Miquèl,

Am Mi., 25. Aug. 2021 um 10:51 Uhr schrieb Miquel Raynal
<miquel.raynal@bootlin.com>:
>
>
> Kestrel seventyfour <kestrelseventyfour@gmail.com> wrote on Wed, 25 Aug
> 2021 10:47:40 +0200:
>
> > Hi Miquèl,
> >
> > Am Di., 24. Aug. 2021 um 19:22 Uhr schrieb Miquel Raynal
> > <miquel.raynal@bootlin.com>:
> > >
> > > Hello,
> > >
> > > Kestrel seventyfour <kestrelseventyfour@gmail.com> wrote on Tue, 24 Aug
> > > 2021 09:15:49 +0200:
> > >
> > > > Hi Miquèl,
> > > >
> > > > Am Mo., 23. Aug. 2021 um 17:24 Uhr schrieb Miquel Raynal
> > > > <miquel.raynal@bootlin.com>:
> > > > >
> > > > > Hi Kestrel,
> > > > >
> > > > > Kestrel seventyfour <kestrelseventyfour@gmail.com> wrote on Mon, 23 Aug
> > > > > 2021 13:19:43 +0200:
> > > > >
> > > > > > Hi Miquèl,
> > > > > >
> > > > > > Am Do., 19. Aug. 2021 um 10:03 Uhr schrieb Miquel Raynal
> > > > > > <miquel.raynal@bootlin.com>:
> > > > ...
> > > > > >
> > > > > > thank you for your response.
> > > > > > If I remove the nand-ecc-xxx properties in the device tree, the device with
> > > > > > the Toshiba NAND chip is working. However, the device with the Micron
> > > > > > NAND fails with NO ECC functions supplied; hardware ECC not possible,
> > > > > > seems to be at line 5367 or equivalent.
> > > > > > https://elixir.bootlin.com/linux/latest/source/drivers/mtd/nand/raw/nand_base.c#L5367
> > > > > >
> > > > > > It looks like the micron nand driver supports on die only if its
> > > > > > specified int the
> > > > > > Device tree:
> > > > > > https://elixir.bootlin.com/linux/latest/source/drivers/mtd/nand/raw/nand_micron.c#L511
> > > > > > The Micron NAND driver probably needs to set the ECC type to ON DIE if the
> > > > > > variable ondie contains the supported attribute?!
> > > > >
> > > > > You're right but I don't see any easy upstream-able solution here.
> > > > > Changing the behavior in the Xway driver would certainly break users,
> > > > > changing the behavior in the Micron driver would certainly break even
> > > > > more users. The root cause being an absence of proper description (the
> > > > > integration changed). Honestly I feel stuck, maybe you can try to
> > > > > register your device, if it fails, change the integration in the driver
> > > > > (to an ondie ecc engine) then retry?
> > > > >
> > > > > Thanks,
> > > > > Miquèl
> > > >
> > > > Do you think adding something like below at the following location
> > > > https://elixir.bootlin.com/linux/latest/source/drivers/mtd/nand/raw/xway_nand.c#L223
> > > > would be upstreamable (with or without device tree property?)?
> > > >
> > > >         err = nand_scan(&data->chip, 1);
> > > >         if (err /* && of_property_read_bool(np, "lantiq,retry-on-die") */) {
> > > >                 data->chip.ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_DIE;
> > > >                 err = nand_scan(&data->chip, 1);
> > > >                 if (err) return err;
> > > >         }
> > > >
> > > > It still throws the kernel warning on first try, but the second try then works.
> > >
> > > Can you please remind me what is xway/lantiq/your setup/how public it
> > > is/who's using this driver?
> > >
> > > Thanks,
> > > Miquèl
> >
> > Its for Openwrt, I would like to add support for 3 more devices
> > AVM fritzbox 3490/5490 and 7490. They all have varying NAND chips.
> > I have initially created a PR to have my initial patch tested:
> > https://github.com/openwrt/openwrt/pull/4426
> > There is already one device supported which has two DTBs one for
> > Micron and one for non Micron (3370), but its not very straight forward.
> > Without having this issue solved, flashing those devices would be
> > possibly having issues depending on NAND chip or the awkward
> > workaround of flashing one image and if it does not boot, boot the
> > other one. Without self soldered serial console, it would not very
> > easy to figure out the NAND manufacturer.
> > The AVM stock firmware is old kernel and does not use device
> > tree for NAND, they just query all possible manufacturers and set
> > up NAND based on manufacturer query.
>
> But in this case can't you check the 'root' compatible against certain
> values and and some kind of quirk in the ->attach() hook to update the
> ECC engine to the right one?
>
> Thanks,
> Miquèl

maybe I wrote the wrong thing, but what do you mean with root compatible.
The controller is always NAND xway and I think there are 4 different
NAND chip types. But the stock firmware just queries the NAND
manufacturer name, not a date or type/model of the devices. E.g. 7490 can
have Micron or Macronix NAND, but querying the Micron id or Macronix
id requires a change to the xway driver?
Do you mean something like in the first patch do query the manufacturer
but just for all the 4?

Thanks, Daniel.

WARNING: multiple messages have this Message-ID (diff)
From: Kestrel seventyfour <kestrelseventyfour@gmail.com>
To: Miquel Raynal <miquel.raynal@bootlin.com>
Cc: Richard Weinberger <richard@nod.at>,
	Vignesh Raghavendra <vigneshr@ti.com>,
	linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] mtd: rawnand: xway: No hardcoded ECC engine, use device tree setting
Date: Wed, 25 Aug 2021 16:07:05 +0200	[thread overview]
Message-ID: <CAE9cyGRuoaiTu40Yu0po3dykk1fTq_VkqwNfrQkJq8DR6FPRpw@mail.gmail.com> (raw)
In-Reply-To: <20210825105126.4c1c15cb@xps13>

Hi Miquèl,

Am Mi., 25. Aug. 2021 um 10:51 Uhr schrieb Miquel Raynal
<miquel.raynal@bootlin.com>:
>
>
> Kestrel seventyfour <kestrelseventyfour@gmail.com> wrote on Wed, 25 Aug
> 2021 10:47:40 +0200:
>
> > Hi Miquèl,
> >
> > Am Di., 24. Aug. 2021 um 19:22 Uhr schrieb Miquel Raynal
> > <miquel.raynal@bootlin.com>:
> > >
> > > Hello,
> > >
> > > Kestrel seventyfour <kestrelseventyfour@gmail.com> wrote on Tue, 24 Aug
> > > 2021 09:15:49 +0200:
> > >
> > > > Hi Miquèl,
> > > >
> > > > Am Mo., 23. Aug. 2021 um 17:24 Uhr schrieb Miquel Raynal
> > > > <miquel.raynal@bootlin.com>:
> > > > >
> > > > > Hi Kestrel,
> > > > >
> > > > > Kestrel seventyfour <kestrelseventyfour@gmail.com> wrote on Mon, 23 Aug
> > > > > 2021 13:19:43 +0200:
> > > > >
> > > > > > Hi Miquèl,
> > > > > >
> > > > > > Am Do., 19. Aug. 2021 um 10:03 Uhr schrieb Miquel Raynal
> > > > > > <miquel.raynal@bootlin.com>:
> > > > ...
> > > > > >
> > > > > > thank you for your response.
> > > > > > If I remove the nand-ecc-xxx properties in the device tree, the device with
> > > > > > the Toshiba NAND chip is working. However, the device with the Micron
> > > > > > NAND fails with NO ECC functions supplied; hardware ECC not possible,
> > > > > > seems to be at line 5367 or equivalent.
> > > > > > https://elixir.bootlin.com/linux/latest/source/drivers/mtd/nand/raw/nand_base.c#L5367
> > > > > >
> > > > > > It looks like the micron nand driver supports on die only if its
> > > > > > specified int the
> > > > > > Device tree:
> > > > > > https://elixir.bootlin.com/linux/latest/source/drivers/mtd/nand/raw/nand_micron.c#L511
> > > > > > The Micron NAND driver probably needs to set the ECC type to ON DIE if the
> > > > > > variable ondie contains the supported attribute?!
> > > > >
> > > > > You're right but I don't see any easy upstream-able solution here.
> > > > > Changing the behavior in the Xway driver would certainly break users,
> > > > > changing the behavior in the Micron driver would certainly break even
> > > > > more users. The root cause being an absence of proper description (the
> > > > > integration changed). Honestly I feel stuck, maybe you can try to
> > > > > register your device, if it fails, change the integration in the driver
> > > > > (to an ondie ecc engine) then retry?
> > > > >
> > > > > Thanks,
> > > > > Miquèl
> > > >
> > > > Do you think adding something like below at the following location
> > > > https://elixir.bootlin.com/linux/latest/source/drivers/mtd/nand/raw/xway_nand.c#L223
> > > > would be upstreamable (with or without device tree property?)?
> > > >
> > > >         err = nand_scan(&data->chip, 1);
> > > >         if (err /* && of_property_read_bool(np, "lantiq,retry-on-die") */) {
> > > >                 data->chip.ecc.engine_type = NAND_ECC_ENGINE_TYPE_ON_DIE;
> > > >                 err = nand_scan(&data->chip, 1);
> > > >                 if (err) return err;
> > > >         }
> > > >
> > > > It still throws the kernel warning on first try, but the second try then works.
> > >
> > > Can you please remind me what is xway/lantiq/your setup/how public it
> > > is/who's using this driver?
> > >
> > > Thanks,
> > > Miquèl
> >
> > Its for Openwrt, I would like to add support for 3 more devices
> > AVM fritzbox 3490/5490 and 7490. They all have varying NAND chips.
> > I have initially created a PR to have my initial patch tested:
> > https://github.com/openwrt/openwrt/pull/4426
> > There is already one device supported which has two DTBs one for
> > Micron and one for non Micron (3370), but its not very straight forward.
> > Without having this issue solved, flashing those devices would be
> > possibly having issues depending on NAND chip or the awkward
> > workaround of flashing one image and if it does not boot, boot the
> > other one. Without self soldered serial console, it would not very
> > easy to figure out the NAND manufacturer.
> > The AVM stock firmware is old kernel and does not use device
> > tree for NAND, they just query all possible manufacturers and set
> > up NAND based on manufacturer query.
>
> But in this case can't you check the 'root' compatible against certain
> values and and some kind of quirk in the ->attach() hook to update the
> ECC engine to the right one?
>
> Thanks,
> Miquèl

maybe I wrote the wrong thing, but what do you mean with root compatible.
The controller is always NAND xway and I think there are 4 different
NAND chip types. But the stock firmware just queries the NAND
manufacturer name, not a date or type/model of the devices. E.g. 7490 can
have Micron or Macronix NAND, but querying the Micron id or Macronix
id requires a change to the xway driver?
Do you mean something like in the first patch do query the manufacturer
but just for all the 4?

Thanks, Daniel.

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

  reply	other threads:[~2021-08-25 14:07 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-08  7:26 [PATCH v2] mtd: rawnand: xway: No hardcoded ECC engine, use device tree setting Daniel Kestrel
2021-08-08  7:26 ` Daniel Kestrel
2021-08-16  7:31 ` Miquel Raynal
2021-08-16  7:31   ` Miquel Raynal
2021-08-19  7:21   ` Kestrel seventyfour
2021-08-19  7:21     ` Kestrel seventyfour
2021-08-19  8:03     ` Miquel Raynal
2021-08-19  8:03       ` Miquel Raynal
2021-08-23 11:19       ` Kestrel seventyfour
2021-08-23 11:19         ` Kestrel seventyfour
2021-08-23 15:24         ` Miquel Raynal
2021-08-23 15:24           ` Miquel Raynal
2021-08-24  7:15           ` Kestrel seventyfour
2021-08-24  7:15             ` Kestrel seventyfour
2021-08-24 17:22             ` Miquel Raynal
2021-08-24 17:22               ` Miquel Raynal
2021-08-25  8:47               ` Kestrel seventyfour
2021-08-25  8:47                 ` Kestrel seventyfour
2021-08-25  8:51                 ` Miquel Raynal
2021-08-25  8:51                   ` Miquel Raynal
2021-08-25 14:07                   ` Kestrel seventyfour [this message]
2021-08-25 14:07                     ` Kestrel seventyfour
2021-08-25 15:31                     ` Miquel Raynal
2021-08-25 15:31                       ` Miquel Raynal
2021-08-26  5:27                       ` Kestrel seventyfour
2021-08-26  5:27                         ` Kestrel seventyfour
2021-09-16 19:38 ` Jan Hoffmann
2021-09-16 19:38   ` Jan Hoffmann
2021-09-17 17:01   ` Miquel Raynal
2021-09-17 17:01     ` Miquel Raynal
2021-09-17 17:45     ` Jan Hoffmann
2021-09-17 17:45       ` Jan Hoffmann
2021-09-17 19:32       ` Miquel Raynal
2021-09-17 19:32         ` Miquel Raynal
2021-09-18 21:26         ` Jan Hoffmann
2021-09-18 21:26           ` Jan Hoffmann
2021-09-27 16:31           ` Miquel Raynal
2021-09-27 16:31             ` Miquel Raynal
2021-09-27 20:32             ` Jan Hoffmann
2021-09-27 20:32               ` Jan Hoffmann
2021-09-28  8:49               ` Miquel Raynal
2021-09-28  8:49                 ` Miquel Raynal

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=CAE9cyGRuoaiTu40Yu0po3dykk1fTq_VkqwNfrQkJq8DR6FPRpw@mail.gmail.com \
    --to=kestrelseventyfour@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=vigneshr@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.