[PATCH 0/4] Facilitate new atmel raw nand driver for SAMA5D2

Eugen Hristev eugen.hristev at collabora.com
Wed Jan 24 05:06:30 CET 2024


On 12/12/23 18:04, Alexander Dahl wrote:
> Hei hei,
> 
> for some downstream boards with SAMA5D27 SiP SoCs with raw NAND flash I
> added the necessary nodes to sama5d2.dtsi with just one little
> guesswork: the clocks.  Motivation was to fix reading from raw nand
> flash which failed on some of those boards, while others worked fine.
> So I suppose the timings for the external interface were set to too slow
> values. (IIRC I took them from the sama5d2_ptc_ek_nandflash board code
> back in 2019.)
> 
> The solution was basically to switch from the old non-DM driver with
> hardcoded timings for the external memory interface to the new DM based
> driver introduced earlier this year, which sets the timings based on
> ONFI parameters read from the flash chip.
> 
> Works for me, but I have no boards with that SoC _and_ a raw NAND flash
> at hand, which are supported by upstream U-Boot.  The only matching
> upstream config is sama5d2_ptc_ek_nandflash_defconfig but because we
> don't have that board, I did not touch it.
> 
> (When that driver was added with 6a8dfd57220d ("nand: atmel: Add DM
> based NAND driver") the author claims in the commit message it was
> tested on SAMA5D3, but none of the sama5d3 configs actually uses it.)
> 
> Some more changes to the board dts are necessary, but porting from Linux
> is straightforward.  The necessary changes to the defconfig should look
> like this:
> 
>  # CONFIG_I2C is not set
>  CONFIG_LED=y
>  CONFIG_LED_GPIO=y
> +CONFIG_ATMEL_EBI=y
> +CONFIG_MFD_ATMEL_SMC=y
>  # CONFIG_MMC is not set
>  CONFIG_MTD=y
> -CONFIG_NAND_ATMEL=y
> -CONFIG_ATMEL_NAND_HW_PMECC=y
> -CONFIG_PMECC_CAP=8
> +CONFIG_DM_MTD=y
> +CONFIG_DM_NAND_ATMEL=y
>  CONFIG_SYS_NAND_ONFI_DETECTION=y
>  CONFIG_PHY_SMSC=y
>  CONFIG_MACB=y
> 
> Hope the changes are acceptable nevertheless.  The last patch has a
> trivial fix for the new atmel raw nand driver which I came up with while
> working on this.
> 
> Greets
> Alex
> 
> Cc: Eugen Hristev <eugen.hristev at collabora.com>
> Cc: Dario Binacchi <dario.binacchi at amarulasolutions.com>
> Cc: Michael Trimarchi <michael at amarulasolutions.com>
> Cc: Wenyou Yang <wenyou.yang at microchip.com>
> Cc: Balamanikandan Gunasundar <balamanikandan.gunasundar at microchip.com>
> 
> Alexander Dahl (4):
>   ARM: dts: at91: sama5d2: Move sfr node
>   ARM: dts: at91: sama5d2: Port ebi/nand nodes from linux
>   ARM: dts: at91: sama5d2: Align more node names with Linux
>   mtd: nand: raw: atmel: Remove duplicate definitions
> 
>  arch/arm/dts/sama5d2.dtsi          | 74 ++++++++++++++++++++++++++----
>  drivers/mtd/nand/raw/atmel/pmecc.c |  3 --
>  2 files changed, 65 insertions(+), 12 deletions(-)
> 
> 
> base-commit: 2f0282922b2c458eea7f85c500a948a587437b63


Applied series to u-boot-at91/master, thanks !


More information about the U-Boot mailing list