[RFC PATCH 0/3] mtd: nand: raw: atmel: Using dm driver for older sam9 SoCs

Eugen Hristev eugen.hristev at collabora.com
Mon Mar 18 10:54:01 CET 2024


On 3/11/24 17:23, Alexander Dahl wrote:
> Hello raw NAND fans,
> 

Hello Alexander,

Thank you for your efforts

> today I thought it would be interesting to have all that automatic NAND
> flash timings setting usable with an old board featuring a at91sam9g20
> SoC, which would pave the way to get rid of the old atmel raw nand
> driver eventually.  My "let's try this quickly" ended up in "damn this
> took hours and now I'm stuck".
> 
> Those older SoCs have no hardware ecc engine like the sama5d2 or sam9x60
> have, which the Linux driver can work with.  (The U-Boot driver was
> ported from Linux back then.)
> 
> The problem is NAND flash detection fails because the atmel nand
> controller drivers fails on probing.  In fact
> `atmel_nand_controller_init()` tries to set the pointer `nc->pmecc` by
> calling `devm_atmel_pmecc_get()`.  That one probably gets a
> -EPROBE_DEFER returned by `atmel_pmecc_get_by_node()` and then
> `atmel_nand_controller_init()` returns -EPROBE_DEFER too and probing the
> driver fails.  I suspect it should work fine if `nc->pmecc` would be
> NULL, but I have no idea what would be the right place to implement
> this.  I also suspect that -EPROBE_DEFER contradicts the U-Boot driver
> model somehow?  The raw/atmel/nand-controller driver was adapted (quite
> a bit) to work with U-Boot, but maybe some aspects of U-Boot driver
> model where not considered correctly?

I added Simon, to give us a hint on how to approach this.
How I see it, is that the probing of the NAND should pause, and then the DM should
look for the dependency, and probe it. if that dependency fails, then NAND probe
fails. But returning DEFER would not be good since I do not believe there is
another probe attempt unless manually done so (and it would be weird to get some
error on first probe and success on the next, at least in u-boot state of mind)
Maybe Simon can give us some ideas

> 
> The attached patches are what I have so far, marked them as RFC because
> my actual goal of using the new dm based driver for the old SoC was not
> completed.

Patches look good, but I am not sure whether they bring any additional value as you
claim it's not working. Maybe they could be picked up and worked more to get it
into the state you want ?
>From my knowledge, investing effort into these old SoCs is not a priority for the
at91 people.

Eugen
> 
> Greets
> Alex
> 
> P.S.: Patch stack based on next.
> 
> Alexander Dahl (3):
>   ARM: dts: at91sam9260: Add modern NAND controller nodes
>   memory: atmel-ebi: Add compatible for older 9260 cores
>   mtd: nand: raw: atmel: Remove redundant PMECC probe
> 
>  arch/arm/dts/at91sam9260.dtsi                | 47 ++++++++++++++++++++
>  drivers/memory/atmel_ebi.c                   |  1 +
>  drivers/mtd/nand/raw/atmel/nand-controller.c |  7 ---
>  drivers/mtd/nand/raw/atmel/pmecc.c           |  1 +
>  4 files changed, 49 insertions(+), 7 deletions(-)
> 
> 
> base-commit: beedf675b36841ce1e077779157a87a6505317e6



More information about the U-Boot mailing list