drivers: i2c: dw: scope the NVIC pending-clear to RTS5912 and use k_irq_clear_pending() - #117365
Open
nashif wants to merge 2 commits into
Open
drivers: i2c: dw: scope the NVIC pending-clear to RTS5912 and use k_irq_clear_pending()#117365nashif wants to merge 2 commits into
nashif wants to merge 2 commits into
Conversation
i2c_dw_transfer_complete() clears the NVIC pending bit for its own IRQ line after clearing the IP-level interrupt source. This was added along with the RTS5912 support in commit 748789e ("drivers: i2c: rts5912 i2c dirver") but gated on CONFIG_CPU_CORTEX_M, so every Cortex-M user of the DesignWare IP -- RP2040/RP2350, SiWG917, Synaptics SR100 -- silently inherited a Realtek-specific workaround, and the shared IP driver grew a dependency on cmsis_core.h. Clearing the NVIC pending bit after the source has already been cleared also discards any interrupt that latched in between, so it is not a harmless no-op on parts that do not need it. Gate the call, the cmsis_core.h include and the irqnumber config member on CONFIG_I2C_RTS5912 instead, matching the other RTS5912 carve-outs already present in Kconfig.dw. Behaviour on RTS5912 is unchanged; other Cortex-M platforms return to the pre-748789eadf710 behaviour. Dropping irqnumber for everyone else also removes a DT_INST_IRQN() on PCIe instances, which have no devicetree interrupt of their own. Also drop the unused zephyr/arch/cpu.h include added by the same commit; it is a pure dispatch header and kernel.h and irq.h already provide everything the driver uses. Assisted-by: Claude:claude-opus-5 Signed-off-by: Anas Nashif <anas.nashif@intel.com>
Replace the direct NVIC_ClearPendingIRQ() call in the RTS5912 quirk path with the portable k_irq_clear_pending() and drop the cmsis_core.h include, removing the last piece of CPU-specific code from the DesignWare I2C driver. RTS5912 is a plain-NVIC Cortex-M33, so the capability is always available where the quirk compiles. Assisted-by: Claude:claude-opus-5 Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
i2c_dw_transfer_complete() clears the NVIC pending bit for its own IRQ
line after clearing the IP-level interrupt source. This was added along
with the RTS5912 support in commit 748789e ("drivers: i2c: rts5912
i2c dirver") but gated on CONFIG_CPU_CORTEX_M, so every Cortex-M user of
the DesignWare IP -- RP2040/RP2350, SiWG917, Synaptics SR100 -- silently
inherited a Realtek-specific workaround, and the shared IP driver grew a
dependency on cmsis_core.h.
Clearing the NVIC pending bit after the source has already been cleared
also discards any interrupt that latched in between, so it is not a
harmless no-op on parts that do not need it.
Gate the call, the cmsis_core.h include and the irqnumber config member
on CONFIG_I2C_RTS5912 instead, matching the other RTS5912 carve-outs
already present in Kconfig.dw. Behaviour on RTS5912 is unchanged; other
Cortex-M platforms return to the pre-748789eadf710 behaviour. Dropping
irqnumber for everyone else also removes a DT_INST_IRQN() on PCIe
instances, which have no devicetree interrupt of their own.
Also drop the unused zephyr/arch/cpu.h include added by the same commit;
it is a pure dispatch header and kernel.h and irq.h already provide
everything the driver uses.