Skip to content

spi: atmel-quadspi: Refresh and add classic mode support

Alexander Dahl u-boot 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest7 patches 7 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/7spi: atmel-quadspi: Depend on SPI_MEMdrivers/spi/Kconfig+1 -10 replies
2/7spi: atmel-quadspi: Port collected fixes from Linux v5.10 and v5.15drivers/spi/atmel-quadspi.c+14 -130 replies
3/7spi: atmel-quadspi: Avoid overwriting MR register settingsdrivers/spi/atmel-quadspi.c+51 -450 replies
4/7spi: atmel-quadspi: Remove default mode setting at probe timedrivers/spi/atmel-quadspi.c+0 -50 replies
5/7spi: atmel-quadspi: Allow setting SMM to classic SPI modedrivers/spi/atmel-quadspi.c+12 -80 replies
6/7spi: atmel-quadspi: Add support for classic SPI modedrivers/spi/atmel-quadspi.c+154 -12 replies
7/7spi: atmel-quadspi: Improve probe debuggingdrivers/spi/atmel-quadspi.c+9 -80 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

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

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 <[email protected]>
Cc: Yoshitaka Ikeda <[email protected]>
Cc: Csókás Bence <[email protected]>

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

Signature · 1 line
2.39.5