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

Conversation

soburi
Copy link
Member

@soburi soburi commented Apr 26, 2022

Add fundamental feature support for rpi-pico's SPI peripheral.
This commit implements synchronous transfer with 8bit-MSB format.

I verified my environment with two test programs.
tests/drivers/spi/spi_loopback test is work well.
(rpi_pico seems to have a problem when running device-testing by the twister,
locally build and flashing and check console output.)
And also samples/subsys/fs/fat_fs/ works.

rp2040 datasheet says the SoC has ARM PrimeCell SSP PL022 as the SPI peripheral.
So this PL022 driver implementation can compile without rpi_pico SDK.

Optional feature are not currently implemented yet.
It is work in future.

  • DMA transfer is not implemented yet.
  • Slave mode is not implemented yet.
  • Currently support only 8-bit data transfer.

Hardware limitation:

  • LSB-first format is not supported by hardware.

@github-actions github-actions bot added area: API Changes to public APIs area: Boards area: Devicetree area: Devicetree Binding PR modifies or adds a Device Tree binding area: Modules area: SPI SPI bus labels Apr 26, 2022
@soburi soburi force-pushed the support_pico_spi branch 2 times, most recently from 79e6546 to c59e0ac Compare April 26, 2022 12:13
@soburi soburi changed the title drivers: spi: Add basic support rpi-pico SPI [draft] drivers: spi: Add basic support rpi-pico SPI Apr 30, 2022
@soburi soburi force-pushed the support_pico_spi branch from c59e0ac to eb4b68a Compare April 30, 2022 12:00
@soburi soburi requested a review from yonsch as a code owner April 30, 2022 12:00
@soburi soburi changed the title [draft] drivers: spi: Add basic support rpi-pico SPI drivers: spi: Add basic support rpi-pico SPI (PrimeCell SSP PL022) Apr 30, 2022
@yonsch yonsch added the platform: Raspberry Pi Pico Raspberry Pi Pico (RPi Pico) label May 1, 2022
Copy link
Contributor

@yonsch yonsch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My review for the Pico parts

boards/arm/rpi_pico/rpi_pico-pinctrl.dtsi Outdated Show resolved Hide resolved
boards/arm/rpi_pico/rpi_pico.yaml Show resolved Hide resolved
dts/arm/rpi_pico/rp2040.dtsi Outdated Show resolved Hide resolved
@yonsch
Copy link
Contributor

yonsch commented May 2, 2022

Two more things:

  1. Why is CSN missing from the board's pinmux?
  2. Set a default clock-frequency in rpi_pico.dts

@soburi
Copy link
Member Author

soburi commented May 4, 2022

Hi, @yonsch,

  • Why is CSN missing from the board's pinmux?

It is my mistakes. Just forgot it.
CS pin is often controlled by 'cs-gpios' as gpio, so I misunderstood that I didn't must need it.

  • Set a default clock-frequency in rpi_pico.dts

Set 8MHz to default.
It can works also in peripheral mode (pclk/12 =~ 10MHz) and with enough safety margin.

@soburi soburi requested a review from yonsch May 4, 2022 11:35
@soburi soburi force-pushed the support_pico_spi branch 3 times, most recently from 1d6fcfd to aba8ed9 Compare May 4, 2022 13:59
@carlescufi carlescufi requested review from andrei-edward-popa and petejohanson and removed request for andrei-edward-popa and petejohanson August 17, 2022 17:32
@soburi soburi requested review from andrei-edward-popa and removed request for petejohanson August 18, 2022 03:31
@carlescufi carlescufi merged commit a7721aa into zephyrproject-rtos:main Aug 18, 2022
@soburi soburi deleted the support_pico_spi branch August 18, 2022 08:36
@yonsch
Copy link
Contributor

yonsch commented Aug 18, 2022

@soburi Congratulations, and thank you for your patience!

@soburi
Copy link
Member Author

soburi commented Aug 18, 2022

Hi, @yonsch ,

thank you for your helps.
And also please #45137, It makes life happy with GDB!

soburi added a commit to soburi/zephyr that referenced this pull request Aug 2, 2023
Add myself as codeowner of previously committed driver.

- zephyrproject-rtos#45131

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
fabiobaltieri pushed a commit that referenced this pull request Aug 3, 2023
Add myself as codeowner of previously committed driver.

- #45131

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
kunoh pushed a commit to kunoh/zephyr that referenced this pull request Aug 7, 2023
Add myself as codeowner of previously committed driver.

- zephyrproject-rtos#45131

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
umarnisar92 pushed a commit to nisarumar/zephyr that referenced this pull request Aug 15, 2023
Add myself as codeowner of previously committed driver.

- zephyrproject-rtos#45131

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
meshium pushed a commit to meshium/zephyr that referenced this pull request Aug 16, 2023
Add myself as codeowner of previously committed driver.

- zephyrproject-rtos#45131

Signed-off-by: TOKITA Hiroshi <tokita.hiroshi@fujitsu.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: ADC Analog-to-Digital Converter (ADC) area: API Changes to public APIs area: Boards area: Devicetree Binding PR modifies or adds a Device Tree binding area: Devicetree area: Documentation area: File System area: Modules area: Sensors Sensors area: SPI SPI bus area: Tests Issues related to a particular existing or missing test manifest-hal_rpi_pico platform: Raspberry Pi Pico Raspberry Pi Pico (RPi Pico)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants