[PATCH 0/7] [U-Boot] spi: atmel-quadspi: Refresh and add classic mode support

Eugen Hristev eugen.hristev at linaro.org
Thu Jan 30 15:07:27 CET 2025



On 1/23/25 14:12, Alexander Dahl wrote:
> Hello everyone,
> 
> this patch series is for U-Boot, although Linux might be affected.
> 
> The quadspi controller on microchip (former atmel) sama5d2, sam9x60 and
> other soc variants of the at91 family is usually used in hardware
> accelerated spi-mem mode.  It also supports a classic mode for
> interfacing all kinds of SPI peripherals like ADCs, IO expanders,
> displays, you name it.  However the drivers in Linux and U-Boot did not
> support that mode, yet.
> 
> While spi-mem subsystem interface is comparable between Linux and
> U-Boot, SPI subsystem interface is rather different in Linux and U-Boot.
> So there's no previously written Linux support just ported here.  I
> tried that, but the simple implementation for U-Boot's .xfer() used here
> does not work for Linux' .transfer_one() because of the OVRES flag set
> all the time.  I guess a more sophisticated approach has to be taken in
> Linux with interrupts, completions and/or dma?
> 
> According to commit 24c8ff4684c5 ("spi: Add Atmel QuadSPI driver")
> message, the initial U-Boot variant of this driver was ported from Linux
> v5.1-rc5 back then.  I hope it's okay to squash the fixes added to Linux
> after that into patch 2 and 3 of this series?
> 
> Patch 4 and 5 come from my efforts to hack this feature into the Linux
> driver.  (Not sure if those should be added to the Linux driver
> anyways, even if nobody ever implements transfer_one() over there?)
> 
> Patch 5 is the actual work, very much inspired by the current U-Boot
> driver atmel_spi for the generic SPI controllers on at91 family.
> 
> Patch 1 is copied from my other spi series for U-Boot, just added it
> here for better build results.
> 
> Patch 6 is optional, because not portable towards Linux.
> 
> Tested on top of v2024.10, because v2025.01 won't build as debug
> for sam9x60 as described in another thread.  But there are almost no
> changes related to at91 socs, boards, and drivers in the last months
> here, so it should be comparable.
> 
> Greets
> Alex
> 
> (Cc-ing the contributors of the Linux fixes here.)
> Cc: Tudor Ambarus <tudor.ambarus at microchip.com>
> Cc: Yoshitaka Ikeda <ikeda at nskint.co.jp>
> Cc: Csókás Bence <csokas.bence at prolan.hu>
> 
> Alexander Dahl (7):
>   spi: atmel-quadspi: Depend on SPI_MEM
>   spi: atmel-quadspi: Port collected fixes from Linux v5.10 and v5.15
>   spi: atmel-quadspi: Avoid overwriting MR register settings
>   spi: atmel-quadspi: Remove default mode setting at probe time
>   spi: atmel-quadspi: Allow setting SMM to classic SPI mode
>   spi: atmel-quadspi: Add support for classic SPI mode
>   spi: atmel-quadspi: Improve probe debugging
> 
>  drivers/spi/Kconfig         |   2 +-
>  drivers/spi/atmel-quadspi.c | 294 ++++++++++++++++++++++++++++--------
>  2 files changed, 228 insertions(+), 68 deletions(-)
> 
> 
> base-commit: 2eed5a1ff36217372e19f7513bd07077fc76718a

Hello Alex,

I had a quick look over your patches, but it would require to get a
review from SPI maintainers to apply these.

Eugen



More information about the U-Boot mailing list