zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.5k stars 6.43k forks source link

Multiple ICE40 instances on the same SPI master #77983

Open benediktibk opened 1 week ago

benediktibk commented 1 week ago

Describe the bug When multiple ICE40 instances on the same SPI master are enabled the build will fail, as there will be multiple instances of the same pinctrl-config object within fpga_ice40.c.

To Reproduce

  1. CONFIG_PINCTRL=y
  2. enable two instances of lattice,ice40-fpga on the same master.
  3. west build -> BOOM

Expected behavior It should be possible to use two ICE40 with PINCTRL on the same SPI master.

tbursztyka commented 1 week ago

Could you give more detailed steps on how to reproduce? I miss the board and the sample/test to use.

benediktibk commented 1 week ago

Could you give more detailed steps on how to reproduce? I miss the board and the sample/test to use.

With the current setup the corresponding test doesn't trigger the issue, as there is a workaround for it in place. But if you set CONFIG_PINCTRL=y in zephyr/tests/drivers/build_all/fpga/prj.conf you can trigger the issue with west build --board nucleo_f746zg zephyr/tests/drivers/build_all/fpga.

cfriedt commented 6 days ago

This issue also came up when the ice40 driver was added. But at the time, there was no clean way to program multiple nodes on the same SPI bus, since it was not possible to reset to a default SPI pinctrl state.

Ultimately, the SPI API will likely need to be changed to fix this issue.