.../devicetree/bindings/spi/spacemit,k1-spi.yaml | 84 +++ arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 7 + arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi | 20 + arch/riscv/boot/dts/spacemit/k1.dtsi | 15 + drivers/spi/Kconfig | 9 + drivers/spi/Makefile | 1 + drivers/spi/spi-spacemit-k1.c | 789 +++++++++++++++++++++ 7 files changed, 925 insertions(+)
This series adds support for the SPI controller found in the SpacemiT
K1 SoC. The driver currently supports only master mode. The controller
has two 32-entry FIFOs and supports PIO and DMA for transfers.
Starting with v8, I am taking over from Alex Elder to shepherd this
series upstream. Alex developed versions 1 through 7.
Version 10 fixes a buffer-offset + unsigned underflow on 16/32 bpw
transfers (8 bpw worked because bytes == 1), reported by Mark Brown.
(Note, this is a distinct series from the QSPI driver, which was
merged recently.)
End-to-end tested on Banana Pi BPI-F3 with a GigaDevice GD25Q64E SPI
NOR wired to the spi3 GPIO header pins.
BR,
Guodong
Between version 9 and version 10:
Patch 2:
- Initialise tx_resid/rx_resid to transfer->len (matching the
"bytes left in transfer" struct comment and the byte-stride
decrement in the per-word helpers) and divide by drv_data->bytes
where the FIFO burst is capped in words.
Here is version 9 of this series:
https://patch.msgid.link/20260427-spi-spacemit-k1-v9-0-ff753b551302@riscstar.com
Between version 8 and version 9:
Patch 1:
- Subject prefixes in the order of "spi: dt-bindings: ..."
Patch 2:
- k1_spi_dma_prep(): nested ternary to switch.
- k1_spi_ssp_isr(): return IRQ_NONE based on SSP_STATUS bits
- k1_spi_ssp_isr(): rename reading of SSP_STATUS to 'status' (and
'top_ctrl' for SSP_TOP_CTRL); stop overwriting it.
Here is version 8 of this series:
https://patch.msgid.link/20260410-spi-spacemit-k1-v8-0-53ebb48a4146@riscstar.com
Between version 7 and version 8:
- Use // comments for the file header (Mark Brown)
- Remove open-coded DMA mapping (k1_spi_map_dma_buffer(),
k1_spi_unmap_dma_buffer(), k1_spi_map_dma_buffers(), the dummy
buffer, k1_spi_io struct); use SPI core DMA mapping via
transfer->tx_sg/rx_sg instead
- Add can_dma() callback, replacing open-coded transfer length
checks
- Add set_cs() callback for chip select control via the
TOP_HOLD_FRAME_LOW bit
- Switch from transfer_one_message() to transfer_one()
- DMA completion calls spi_finalize_current_transfer() directly
instead of using a completion
- Add SSP_STATUS_BCE (bit count error) to error detection
- Return IRQ_NONE early if no transfer is active, before
acknowledging interrupts
- Simplify k1_spi_driver_data struct
- ~160 fewer lines of code
Here is version 7 of this series:
https://lore.kernel.org/lkml/20251114185745.2838358-1-elder@riscstar.com/
Between version 6 and version 7:
- DIV_ROUND_UP_ULL() is now used when setting the speed, to address
two errors reported by the Intel kernel test robot on 32-bit builds
- Fixed a bug interpreting the resource pointer in k1_spi_dma_cleanup()
- The driver is now built as a module by default, if ARCH_SPACEMIT
is defined
Here is version 6 of this series:
https://lore.kernel.org/lkml/20251027125504.297033-1-elder@riscstar.com/
Between version 5 and version 6:
- Rebase only
Here is version 5 of this series:
https://lore.kernel.org/lkml/20251013123309.2252042-1-elder@riscstar.com/
Between version 4 and version 5:
- Added Yixun's Reviewed-by tag on patch 3
Here is version 4 of this series:
https://lore.kernel.org/lkml/20250925121714.2514932-1-elder@riscstar.com/
Between version 3 and version 4 (all suggested by Yixun):
- Fixed an underrun/overrun comment error
- Renamed a pinctrl node
- Formatted dmas and dma-names properties on one line
Here is version 3 of this series:
https://lore.kernel.org/lkml/20250922161717.1590690-1-elder@riscstar.com/
Between version 2 and version 3:
- Add Conor's Acked-by to patch 1
- Add Rob's Reviewed-by to patch 1
- Added imply_PDMA to the SPI_SPACEMIT_K1 Kconfig option
- Fixed a bug pointed out by Vivian (and Troy) in word-sized reads
- Added a comment stating we use 1, 2, or 4 bytes per word
- Cleaned up DMA channels properly in case of failure setting up
- No longer use devm_*() for allocating DMA channels or buffer
- Moved the SPI controller into the dma-bus memory region
Here is version 2 of this series:
https://lore.kernel.org/lkml/20250919155914.935608-1-elder@riscstar.com/
Between version 1 and version 2:
- Use enum rather than const for the binding compatible string
- Omit the label and status property in the binding example
- The spi-spacemit-k1.o make target is now added in sorted order
- The SPI_SPACEMIT_K1 config option is added in sorted order
- The SPI_SPACEMIT_K1 config does *not* depend on MMP_PDMA,
however MMP_PDMA is checked at runtime, and if not enabled,
DMA will not be used
- Read/modify/writes of registers no longer use an additional
"virt" variable to hold the address accessed
- The k1_spi_driver_data->ioaddr field has been renamed base
- The DMA address for the base address is maintained, rather than
saving the DMA address of the data register
- The spi-max-frequency property value is now bounds checked
- A local variable is now initialized to 0 in k1_spi_write_word()
- The driver name is now "k1-spi"
- DT aliases are used rather than spacemit,k1-ssp-id for bus number
- The order of two pin control properties was changed as requested
- Clock names and DMA names are now on one line in the "k1.dtsi"
- The interrupts property is used rather than interrupts-extended
Here is version 1 of this series:
https://lore.kernel.org/lkml/20250917220724.288127-1-elder@riscstar.com/
Alex Elder (3):
dt-bindings: spi: add SpacemiT K1 SPI support
spi: spacemit: introduce SpacemiT K1 SPI controller driver
riscv: dts: spacemit: define a SPI controller node
Signed-off-by: Guodong Xu <guodong@riscstar.com>
---
Alex Elder (3):
spi: dt-bindings: add SpacemiT K1 SPI support
spi: spacemit: introduce SpacemiT K1 SPI controller driver
riscv: dts: spacemit: define a SPI controller node
.../devicetree/bindings/spi/spacemit,k1-spi.yaml | 84 +++
arch/riscv/boot/dts/spacemit/k1-bananapi-f3.dts | 7 +
arch/riscv/boot/dts/spacemit/k1-pinctrl.dtsi | 20 +
arch/riscv/boot/dts/spacemit/k1.dtsi | 15 +
drivers/spi/Kconfig | 9 +
drivers/spi/Makefile | 1 +
drivers/spi/spi-spacemit-k1.c | 789 +++++++++++++++++++++
7 files changed, 925 insertions(+)
---
base-commit: 559f264e403e4d58d56a17595c60a1de011c5e20
change-id: 20260407-spi-spacemit-k1-e0957c311152
Best regards,
--
Guodong Xu <guodong@riscstar.com>
On Sat, 02 May 2026 21:30:50 -0400, Guodong Xu wrote:
> This series adds support for the SPI controller found in the SpacemiT
> K1 SoC. The driver currently supports only master mode. The controller
> has two 32-entry FIFOs and supports PIO and DMA for transfers.
>
> Starting with v8, I am taking over from Alex Elder to shepherd this
> series upstream. Alex developed versions 1 through 7.
>
> [...]
Applied, thanks!
[3/3] riscv: dts: spacemit: define a SPI controller node
https://github.com/spacemit-com/linux/commit/c580774185426ea316396b1dc3f1737a3ad3800a
Best regards,
--
Yixun Lan <dlan@kernel.org>
On Sat, 02 May 2026 21:30:50 -0400, Guodong Xu wrote:
> spi: support the SpacemiT K1 SPI controller
>
> This series adds support for the SPI controller found in the SpacemiT
> K1 SoC. The driver currently supports only master mode. The controller
> has two 32-entry FIFOs and supports PIO and DMA for transfers.
>
> Starting with v8, I am taking over from Alex Elder to shepherd this
> series upstream. Alex developed versions 1 through 7.
>
> [...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi.git for-7.2
Thanks!
[1/3] spi: dt-bindings: add SpacemiT K1 SPI support
https://git.kernel.org/broonie/spi/c/b610d5333c4b
[2/3] spi: spacemit: introduce SpacemiT K1 SPI controller driver
https://git.kernel.org/broonie/spi/c/efcd8b9d1111
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
© 2016 - 2026 Red Hat, Inc.