drivers: ethernet: phy: tja1103: init work before enabling IRQ - #117393
Open
bperseghetti wants to merge 1 commit into
Open
drivers: ethernet: phy: tja1103: init work before enabling IRQ#117393bperseghetti wants to merge 1 commit into
bperseghetti wants to merge 1 commit into
Conversation
The delayable phy_work item was initialized only after the link interrupt had already been enabled and armed. On hardware that asserts the PHY interrupt GPIO immediately at configuration time, the ISR (phy_tja1103_handle_irq) could run and call k_work_reschedule() on phy_work before k_work_init_delayable() had ever executed, rescheduling a work item with no valid handler and corrupting the workqueue state (fault or undefined behavior on early link-up, observed on TJA1103-based 100BASE-T1 hardware). Initialize data->timeout and the delayable work at the top of phy_tja1103_cfg_irq_poll(), before the interrupt is enabled, so the handler is always valid when the ISR fires. Replace the direct phy_work_handler() call at the end with a K_NO_WAIT reschedule so the first poll still runs from the workqueue context rather than inline. Signed-off-by: Benjamin Perseghetti <bperseghetti@rudislabs.com>
zephyrbot
requested review from
ClaCodes,
lmajewski,
maass-hamburg,
pdgendt and
tpambor
August 26, 2026 01:23
This was referenced Aug 26, 2026
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.
The delayable phy_work item was initialized only after the link interrupt had been enabled. On hardware that asserts the PHY interrupt GPIO immediately at configuration time, the ISR can run and reschedule phy_work before k_work_init_delayable() has executed, rescheduling a work item with no valid handler and corrupting workqueue state on early link-up.
Initialize the timeout and the delayable work at the top of phy_tja1103_cfg_irq_poll(), before the interrupt is enabled, and replace the direct phy_work_handler() call with a K_NO_WAIT reschedule so the first poll still runs from workqueue context.
Validated on 100BASE-T1 hardware using the TJA1103 with both the NXP MCXN (enet_qos) and i.MX RT (enet) MACs.