Skip to content

Commit

Permalink
emmc interrupt blackout issue fix
Browse files Browse the repository at this point in the history
sendfifo() function need enable BWR_IE before checking if BWE is enabled
to avoid BWE to be activated between the BWE check and BWR interrupt
enabling, which causes the interrupt to be missed and Data Timeout error.
  • Loading branch information
jnippula authored and jlaitine committed Apr 21, 2023
1 parent c9e0d25 commit e9c87b2
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions arch/risc-v/src/mpfs/mpfs_emmcsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -782,12 +782,22 @@ static void mpfs_sendfifo(struct mpfs_dev_s *priv)
* come back when we're good to write again.
*/

if (priv->remaining && (!(getreg32(MPFS_EMMCSD_SRS09) &
MPFS_EMMCSD_SRS09_BWE)))
if (priv->remaining)
{
modifyreg32(MPFS_EMMCSD_SRS14, 0, MPFS_EMMCSD_SRS14_BWR_IE);
/* Enable BWR before checking BWE bit */

putreg32(MPFS_EMMCSD_SRS12_BWR, MPFS_EMMCSD_SRS12);
return;
modifyreg32(MPFS_EMMCSD_SRS14, 0, MPFS_EMMCSD_SRS14_BWR_IE);
if (!(getreg32(MPFS_EMMCSD_SRS09) & MPFS_EMMCSD_SRS09_BWE))
{
return;
}

/* There is still room for writing to buffer,
* disable BWR and continue.
*/

modifyreg32(MPFS_EMMCSD_SRS14, MPFS_EMMCSD_SRS14_BWR_IE, 0);
}
}

Expand Down

0 comments on commit e9c87b2

Please sign in to comment.