Skip to content

drivers: ethernet: phy: tja1103: init work before enabling IRQ - #117393

Open
bperseghetti wants to merge 1 commit into
zephyrproject-rtos:mainfrom
CogniPilot:pr-deps-tja1103-init
Open

drivers: ethernet: phy: tja1103: init work before enabling IRQ#117393
bperseghetti wants to merge 1 commit into
zephyrproject-rtos:mainfrom
CogniPilot:pr-deps-tja1103-init

Conversation

@bperseghetti

@bperseghetti bperseghetti commented Aug 26, 2026

Copy link
Copy Markdown
Member

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.

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants