zephyr icon indicating copy to clipboard operation
zephyr copied to clipboard

RFC: Allow multiple ICE40 on the same SPI bus

Open benediktibk opened this issue 4 months ago • 1 comments

Introduction

Currently it is not possible to have multiple ICE40 on the same SPI bus, as described in #77983. The reason for this is the necessity in some cases to do some bitbanging instead of real SPI to get the timing right. To do so the ICE40 driver currently instantiates the pinctrl config from its parent, the SPI master, which will create a name collision if multiple ICE40 are on the same SPI bus.

Proposed change

There are several options how this problem can be addressed:

  1. Extend the SPI driver API with a function which resets or reapplies the pinctrl config. This was already proposed in https://github.com/zephyrproject-rtos/zephyr/pull/77980 and rejected by the SPI maintainer.
  2. Implement a Kconfig which selects the available load modes (SPI and GPIO bitbang). This will then reduce the impact of the issue, as MCUs on which the GPIO bitbang mode is not required can then use multiple ICE40 on the same bus. But it won't solve it completely.
  3. Implement some peripheral deallocation/allocation mechanism, like in #20012. This would definitely resolve the issue, but it hasn't gotten much traction since its creation in 2019.
  4. Modify the pinctrl macros to avoid the name collision. This would resolve the issue, but the pinctrl maintainer hasn't been to fond of the general idea that a foreign devices modifies the pinctrl anyway.

This issue has already been discussed in the Dev-WG and the decision there was to try find a bigger audience to get more inputs. Therefore, I'm absolutely glad for ideas on how I can proceed. It is a nasty bug, which we should definitely get rid of in the long run.

benediktibk avatar Oct 17 '24 15:10 benediktibk