TF-M GPIO MCU-select IOCTL compiled out

It seems there might be a small issue with the TF-M GPIO MCU-select IOCTL plumbing on nRF54L — specifically when a non-secure app tries to configure sQSPI GPIOs (and presumably any other co-processor pins, e.g. FLPR) via TF-M's secure GPIO service.

Looks like nRF54L support for this service was started but the last bit got missed: the secure-side handler already explicitly knows about nRF54L (tfm_platform_hal_gpio_service / valid_mcu_select in tfm_platform_hal_ioctl.c switch on NRF54L_SERIES and call nrf_gpio_pin_control_select()), so somebody clearly went in and did the real work. The four #if gates in front of that handler were just never updated to also recognise GPIO_PIN_CNF_CTRLSEL_Msk (the nRF54L name for the same field — nRF53/91 spell it MCUSEL). Net effect: on /ns nRF54L builds the whole tfm_platform_gpio_pin_mcu_select() path is compiled out, the NS app calls soc_secure_gpio_pin_mcu_select(), the call returns success, and absolutely nothing happens to the pin mux — sQSPI's SCK/MOSI/CS stay on the APP controller and the peripheral never toggles a line.

Broken at upstream HEAD

Same #if defined(GPIO_PIN_CNF_MCUSEL_Msk) pattern, four places (i.e. just the gates around the already-correct handler):

  1. zephyr @ a7ef09af9c  modules/trusted-firmware-m/nordic/src/tfm_platform_system.c#L26
  2. sdk-nrf @ 24d2dc87c7  modules/trusted-firmware-m/tfm_boards/src/tfm_platform_system.c#L150
  3. tf-m @ c630c687ae  .../tfm_ioctl_core_s_api.c#L41
  4. tf-m @ c630c687ae  .../tfm_ioctl_core_ns_api.c#L42

NCS forks (nrfconnect/sdk-zephyr, nrfconnect/sdk-trusted-firmware-m) carry the same code; their GitHub issues are disabled so filing here. Happy to mirror to TrustedFirmware-M's tracker if preferred.

Fix — one-line widen on each gate

-#if defined(GPIO_PIN_CNF_MCUSEL_Msk)
+#if defined(GPIO_PIN_CNF_MCUSEL_Msk) || defined(GPIO_PIN_CNF_CTRLSEL_Msk)

(and matching #endif comments). Internal handler already keys off NRF54L_SERIES so no other code change is needed — this is purely about letting the existing nRF54L handler actually be reached.

Repro / verification

Custom nRF54LM20A /ns board, NCS 3.0, sQSPI driving an external display.

  • Stock SDK: tfm_platform_gpio_pin_mcu_select() is a no-op, sQSPI pins stay on the APP controller, no SCK/MOSI ever toggles.
  • With the four gates widened: pins route to sQSPI correctly, peripheral works.
Related