stm32_eth: Added error handling for abnormal interrupts.

This commit is contained in:
Fotis Panagiotopoulos 2023-04-01 18:20:43 +03:00 committed by Xiang Xiao
parent 4d6a8663fa
commit 873abcb9ab

View File

@ -2027,17 +2027,13 @@ static void stm32_interrupt_work(void *arg)
stm32_putreg(ETH_DMAINT_NIS, STM32_ETH_DMASR);
}
/* Handle error interrupt only if CONFIG_DEBUG_NET is eanbled */
#ifdef CONFIG_DEBUG_NET
/* Check if there are pending "anormal" interrupts */
/* Check if there are pending "abnormal" interrupts */
if ((dmasr & ETH_DMAINT_AIS) != 0)
{
/* Just let the user know what happened */
nerr("ERROR: Abormal event(s): %08x\n", dmasr);
nerr("ERROR: Abnormal event(s): %08" PRIx32 "\n", dmasr);
/* Clear all pending abnormal events */
@ -2046,8 +2042,23 @@ static void stm32_interrupt_work(void *arg)
/* Clear the pending abnormal summary interrupt */
stm32_putreg(ETH_DMAINT_AIS, STM32_ETH_DMASR);
/* As per the datasheet's recommendation, the MAC
* needs to be reset for all abnormal events. The
* scheduled job will take the interface down and
* up again.
*/
work_queue(ETHWORK, &priv->irqwork, stm32_txtimeout_work, priv, 0);
/* Interrupts need to remain disabled, no other
* processing will take place. After reset
* everything will be restored.
*/
net_unlock();
return;
}
#endif
net_unlock();