提交 5592cd03 编写于 作者: S Stephane Grosjean 提交者: Marc Kleine-Budde

can: peak_canfd: rearrange the way resources are released

This patch improves the sequence the resources are released by, first,

- disabling the IRQ in the controller, then by
- resetting the DMA logic, and finally, by
- adding a read cycle to ensure that the above commands have been received

before freeing the system interrupt.
Signed-off-by: NStephane Grosjean <s.grosjean@peak-system.com>
Signed-off-by: NMarc Kleine-Budde <mkl@pengutronix.de>
上级 d31f8513
...@@ -488,13 +488,16 @@ static int pciefd_post_cmd(struct peak_canfd_priv *ucan) ...@@ -488,13 +488,16 @@ static int pciefd_post_cmd(struct peak_canfd_priv *ucan)
/* controller now in reset mode: */ /* controller now in reset mode: */
/* disable IRQ for this CAN */
pciefd_can_writereg(priv, CANFD_CTL_IEN_BIT,
PCIEFD_REG_CAN_RX_CTL_CLR);
/* stop and reset DMA addresses in Tx/Rx engines */ /* stop and reset DMA addresses in Tx/Rx engines */
pciefd_can_clear_tx_dma(priv); pciefd_can_clear_tx_dma(priv);
pciefd_can_clear_rx_dma(priv); pciefd_can_clear_rx_dma(priv);
/* disable IRQ for this CAN */ /* wait for above commands to complete (read cycle) */
pciefd_can_writereg(priv, CANFD_CTL_IEN_BIT, (void)pciefd_sys_readreg(priv->board, PCIEFD_REG_SYS_VER1);
PCIEFD_REG_CAN_RX_CTL_CLR);
free_irq(priv->ucan.ndev->irq, priv); free_irq(priv->ucan.ndev->irq, priv);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册