Skip to content

Commit 85cbc7a

Browse files
ThreeEightscarlescufi
authored andcommitted
drivers: spi: spi_pico_pio: Add basic support for SPI via PIO
Add fundamental feature support for RP2040 PIO SPI peripherals. This commit implements synchronous transfer with 8-bit MSB format. Using PIO allows any GPIO pins to be assigned the roles of CS, CLK, MOSI, and MISO. Optional features not implemented yet: - Interrupt based transfer - DMA transfer - Slave mode - Varying word size - 3-wire SPI support - LSB-first Updated in response to review comments. Further updates from second round of review. Rename spi_pico_pio.c source to match zephyr/MAINTAINERS.yml Remove unnecessary initialization code. Resolve merge conflicts Signed-off-by: Steve Boylan <[email protected]>
1 parent 31a6594 commit 85cbc7a

File tree

6 files changed

+413
-0
lines changed

6 files changed

+413
-0
lines changed

boards/arm/rpi_pico/doc/index.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ hardware features:
9292
* - UART (PIO)
9393
- :kconfig:option:`CONFIG_SERIAL`
9494
- :dtcompatible:`raspberrypi,pico-uart-pio`
95+
* - SPI (PIO)
96+
- :kconfig:option:`CONFIG_SPI`
97+
- :dtcompatible:`raspberrypi,pico-spi-pio`
9598

9699
Pin Mapping
97100
===========

drivers/spi/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ zephyr_library_sources_ifdef(CONFIG_SPI_SMARTBOND spi_smartbond.c)
4242
zephyr_library_sources_ifdef(CONFIG_SPI_OPENTITAN spi_opentitan.c)
4343
zephyr_library_sources_ifdef(CONFIG_SPI_NUMAKER spi_numaker.c)
4444
zephyr_library_sources_ifdef(CONFIG_SPI_AMBIQ spi_ambiq.c)
45+
zephyr_library_sources_ifdef(CONFIG_SPI_RPI_PICO_PIO spi_rpi_pico_pio.c)
4546

4647
zephyr_library_sources_ifdef(CONFIG_SPI_RTIO spi_rtio.c)
4748
zephyr_library_sources_ifdef(CONFIG_SPI_ASYNC spi_signal.c)

drivers/spi/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,6 @@ source "drivers/spi/Kconfig.numaker"
131131

132132
source "drivers/spi/Kconfig.ambiq"
133133

134+
source "drivers/spi/Kconfig.rpi_pico"
135+
134136
endif # SPI

drivers/spi/Kconfig.rpi_pico

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Copyright (c) 2023 Stephen Boylan <[email protected]>
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
config SPI_RPI_PICO_PIO
5+
bool "Raspberry Pi PICO PIO SPI controller driver"
6+
default y
7+
depends on DT_HAS_RASPBERRYPI_PICO_SPI_PIO_ENABLED
8+
select PICOSDK_USE_PIO
9+
select PICOSDK_USE_CLAIM
10+
help
11+
Enable driving SPI via PIO on the PICO

0 commit comments

Comments
 (0)