You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by ac...@apache.org on 2024/01/25 14:23:17 UTC
(nuttx) branch master updated: mpfs_corespi: Fix firing of stale interrupt after warm reset
This is an automated email from the ASF dual-hosted git repository.
acassis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/master by this push:
new a188cf3480 mpfs_corespi: Fix firing of stale interrupt after warm reset
a188cf3480 is described below
commit a188cf3480133a041981dcb91a2563888095279e
Author: Ville Juven <vi...@unikie.com>
AuthorDate: Thu Jan 18 14:54:23 2024 +0200
mpfs_corespi: Fix firing of stale interrupt after warm reset
After warm reset the interrupt source in the HW block is not explicitly
cleared, thus once the interrupt source is enabled the old / stale interrupt
fires immediately.
This causes a DEBUGASSERT() failure on line 808 mpfs_spi_unload_rx_fifo:
DEBUGASSERT(nwords > 0);
---
arch/risc-v/src/mpfs/mpfs_corespi.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/arch/risc-v/src/mpfs/mpfs_corespi.c b/arch/risc-v/src/mpfs/mpfs_corespi.c
index f92ed0123c..e4931f86f7 100644
--- a/arch/risc-v/src/mpfs/mpfs_corespi.c
+++ b/arch/risc-v/src/mpfs/mpfs_corespi.c
@@ -1435,6 +1435,22 @@ static void mpfs_spi_init(struct spi_dev_s *dev)
mpfs_spi_set_master_mode(priv, 1);
mpfs_spi_enable(priv, 1);
+ /* Disable all interrupt sources */
+
+ modifyreg32(MPFS_SPI_CONTROL, MPFS_SPI_INTTXTURUN |
+ MPFS_SPI_INTRXOVRFLOW |
+ MPFS_SPI_INTTXDONE,
+ 0);
+
+ /* Clear all interrupt sources */
+
+ putreg32(MPFS_SPI_TXCHUNDRUN |
+ MPFS_SPI_RXCHOVRFLW |
+ MPFS_SPI_DATA_RX |
+ MPFS_SPI_TXDONE, MPFS_SPI_INT_CLEAR);
+
+ /* Then enable the interrupt */
+
up_enable_irq(priv->plic_irq);
}