Skip to content

Conversation

@aurel32
Copy link
Contributor

@aurel32 aurel32 commented Apr 26, 2023

This PR tries to solve the problem of the shared interrupt on the STM32G0 line of MCUs (and probably other Cortex-M0 based lines) by adding an interrupt muxer for lines that are shared by multiple devices, by leveraging the existing multilevel interrupts framework.

It uses flag pending interrupts from each interrupt line available in the SYSCFG controller to correctly route the interrupts to the correct device, and correctly enable or disable the shared interrupt depending on the state of each individual interrupt.

The last two patch enables the shared interrupt on i2c, spi and ucpd and usb devices.

It is an alternative to #57146 (at least for STM32), which has some advantages over it:

  • It supports enabling and disabling an interrupt
  • The interrupt is routed to the right device driver, no spurious interrupt seen on the other device drivers.

It also has some drawbacks:

  • It uses more flash
  • Multilevel interrupt framework is complex to configure (see the last two commits changuing Kconfig.defconfig.*)

aurel32 added 3 commits April 26, 2023 23:32
This commit tries to solve the problem of the shared interrupt on the
STM32G0 line of MCUs (and probably other lines) by adding an interrupt
muxer for lines that are shared by multiple devices, leveraging the
existing multilevel interrupts framework.

It uses flag pending interrupts from each interrupt line available in
the SYSCFG controller to correctly route the interrupts to the correct
device, and correctly enable or disable the shared interrupt depending
on the state of each individual interrupt.

Signed-off-by: Aurelien Jarno <[email protected]>
Enable the shared interrupt muxer for the i2c2/3 and spi2/3 devices in
the device tree, and configure the multilevel interrupt framework
accordingly.

Signed-off-by: Aurelien Jarno <[email protected]>
Enable the shared interrupt muxer for ucpd1/2 devices on stm32g071/81
and ucpd1/ucpd2/usb devices on stm32g0b1/c1 in the device tree, and
configure the multilevel interrupt framework accordingly.

For that to the interrupt sharing support in the UCPD driver needs to be
removed as the instances won't see the interrupt of each other anymore.

Signed-off-by: Aurelien Jarno <[email protected]>
@aurel32
Copy link
Contributor Author

aurel32 commented Apr 30, 2023

  • It supports enabling and disabling an interrupt

This part actually doesn't work. While the multilevel interrupt framework correctly intercept the calls to IRQ_CONNECT, that's no the case for irq_enable and irq_disable. On ARM, they ended up routed directly to the NVIC, causing the parent interrupt to be enabled or disabled independently of the state of all the children interrupts.

@erwango erwango added the RFC Request For Comments: want input from the community label May 2, 2023
@github-actions
Copy link

github-actions bot commented Jul 2, 2023

This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: Devicetree Binding PR modifies or adds a Device Tree binding area: Interrupt Controller area: USB-C platform: STM32 ST Micro STM32 RFC Request For Comments: want input from the community Stale

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants