Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

drivers: spi: Add basic support rpi-pico SPI (PrimeCell SSP PL022) #45131

Merged
merged 5 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions boards/arm/rpi_pico/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ hardware features:
* - I2C
- :kconfig:option:`CONFIG_I2C`
- :dtcompatible:`snps,designware-i2c`
* - SPI
- :kconfig:option:`CONFIG_SPI`
- :dtcompatible:`raspberrypi,pico-spi`
* - USB Device
- :kconfig:option:`CONFIG_USB_DEVICE_STACK`
- :dtcompatible:`raspberrypi,pico-usbd`
Expand Down
10 changes: 10 additions & 0 deletions boards/arm/rpi_pico/rpi_pico-pinctrl.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@
};
};

spi0_default: spi0_default {
group1 {
pinmux = <SPI0_CSN_P17>, <SPI0_SCK_P18>, <SPI0_TX_P19>;
};
group2 {
pinmux = <SPI0_RX_P16>;
input-enable;
};
};

pwm_ch4b_default: pwm_ch4b_default {
group1 {
pinmux = <PWM_4B_P25>;
Expand Down
9 changes: 9 additions & 0 deletions boards/arm/rpi_pico/rpi_pico.dts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

/dts-v1/;

#include <freq.h>

#include <rpi_pico/rp2040.dtsi>
#include "rpi_pico-pinctrl.dtsi"
#include <zephyr/dt-bindings/pwm/pwm.h>
Expand Down Expand Up @@ -103,6 +105,13 @@
pinctrl-names = "default";
};

&spi0 {
clock-frequency = <DT_FREQ_M(8)>;
status = "okay";
pinctrl-0 = <&spi0_default>;
pinctrl-names = "default";
};

&wdt0 {
status = "okay";
};
Expand Down
1 change: 1 addition & 0 deletions boards/arm/rpi_pico/rpi_pico.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ supported:
- uart
- gpio
- i2c
- spi
yonsch marked this conversation as resolved.
Show resolved Hide resolved
- hwinfo
- watchdog
- pwm
1 change: 1 addition & 0 deletions drivers/spi/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,6 @@ zephyr_library_sources_ifdef(CONFIG_SPI_BITBANG spi_bitbang.c)
zephyr_library_sources_ifdef(CONFIG_SPI_XEC_QMSPI_LDMA spi_xec_qmspi_ldma.c)
zephyr_library_sources_ifdef(CONFIG_SPI_GD32 spi_gd32.c)
zephyr_library_sources_ifdef(CONFIG_SPI_MCHP_QSPI spi_mchp_mss_qspi.c)
zephyr_library_sources_ifdef(CONFIG_SPI_PL022 spi_pl022.c)

zephyr_library_sources_ifdef(CONFIG_USERSPACE spi_handlers.c)
2 changes: 2 additions & 0 deletions drivers/spi/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -103,4 +103,6 @@ source "drivers/spi/Kconfig.gd32"

source "drivers/spi/Kconfig.mchp_mss_qspi"

source "drivers/spi/Kconfig.pl022"

endif # SPI
16 changes: 16 additions & 0 deletions drivers/spi/Kconfig.pl022
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Copyright (c) 2022 TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
# SPDX-License-Identifier: Apache-2.0

config SPI_PL022
default y
depends on DT_HAS_ARM_PL022_ENABLED
bool "ARM PL022 SPI driver"

if SPI_PL022

config SPI_PL022_INTERRUPT
bool "PL022 interrupt mode"
help
Enables interrupt support for PL022 SPI driver.

endif
Loading