Skip to content

drivers: uart: fix IRQ Config #92940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Shreyas-Shankar155
Copy link
Contributor

Fix UART_NS16550_IRQ_FLAGS macro to recognize TI VIM interrupt-controller.

@github-actions github-actions bot added the area: UART Universal Asynchronous Receiver-Transmitter label Jul 10, 2025
@github-actions github-actions bot requested a review from dcpleung July 10, 2025 04:49
#define UART_NS16550_IRQ_FLAGS(n) \
COND_CODE_1(DT_INST_IRQ_HAS_CELL(n, sense), \
(DT_INST_IRQ(n, sense)), \
#ifdef CONFIG_DT_HAS_TI_VIM_ENABLED
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not use CONFIG_DT_HAS* in driver code. It maybe so that the UART instance does not have VIM as its parent, and yet, just the presence of VIM in the DT will set this to 1.

Copy link
Contributor Author

@Shreyas-Shankar155 Shreyas-Shankar155 Jul 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i've addressed this comment, but my solution is rather brute-force.
i'm searching if 'flags' exists, then if 'sense' exists.

however, if in the future, what to do if some new name has to be supported?
it wouldn't look too good if we have a chain of macros in this driver.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR intended to make it consistent: #80790. Maybe you can pick it up and rename all "sense" cells to "flags"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i don't think its a good idea to rename all "sense" cells to "flags".

what if there are some drivers make assumptions that their compatible interrupt-controller use "sense"?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The core issue is making the driver care about the details of the interrupt-controller in the first place. What about interrupt-controllers that don't have a "type/sense/flags" cell at all? The interrupt-controller should provide a method to parse out the information it needs in a way that can be passed back to that interrupt-controller as it expects it. Having every end consumer driver do the DT parsing for the IRQ controller is never going to be flexible enough for all IRQ controllers.

@Shreyas-Shankar155 Shreyas-Shankar155 force-pushed the shrey/bugfix/uart_ns16550 branch from 4c880ba to 1dfa0a0 Compare July 10, 2025 06:33
Fix IRQ config to recognize TI VIM interrupt-controller

Signed-off-by: Shreyas Shankar <s-shankar@ti.com>
@Shreyas-Shankar155 Shreyas-Shankar155 force-pushed the shrey/bugfix/uart_ns16550 branch from 1dfa0a0 to 35b0b18 Compare July 10, 2025 06:38
Copy link

@natto1784
Copy link
Contributor

natto1784 commented Jul 15, 2025 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: UART Universal Asynchronous Receiver-Transmitter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants