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

Alexander Dahl ada at thorsis.com
Mon Mar 11 16:23:03 CET 2024


Hello raw NAND fans,

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?

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.

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
-- 
2.39.2



More information about the U-Boot mailing list