Patchwork [arm-devs,v1,3/5] sd/sdhci: Fix Buffer Write Ready interrupt

login
register
mail settings
Submitter Igor Mitsyanko
Date May 22, 2013, 1:37 p.m.
Message ID <CA+x0pt64C4KTgvwFde=XxcpaUyc2+X0oytLJhT5SopqHVvsEZg@mail.gmail.com>
Download mbox | patch
Permalink /patch/245620/
State New
Headers show

Comments

Igor Mitsyanko - May 22, 2013, 1:37 p.m.
On 05/21/2013 10:51 AM, peter.crosthwaite@xilinx.com wrote:

From: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
<peter.crosthwaite@xilinx.com>

This interrupt is not risen after the last block is written to sd. It
is mutually exclusive with the end of transfer conditions. Fix.

Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
<peter.crosthwaite@xilinx.com>
---

 hw/sd/sdhci.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)




Reviewed-by: Igor Mitsyanko <i.mitsyanko@gmail.com> <i.mitsyanko@gmail.com>

 --
Best wishes,
Igor Mitsyanko
email: i.mitsyanko@gmail.com

Patch

diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c
index 0a84540..ea510b5 100644
--- a/hw/sd/sdhci.c
+++ b/hw/sd/sdhci.c
@@ -405,15 +405,14 @@  static void sdhci_write_block_to_card(SDHCIState *s)

     /* Next data can be written through BUFFER DATORT register */
     s->prnsts |= SDHC_SPACE_AVAILABLE;
-    if (s->norintstsen & SDHC_NISEN_WBUFRDY) {
-        s->norintsts |= SDHC_NIS_WBUFRDY;
-    }

     /* Finish transfer if that was the last block of data */
     if ((s->trnmod & SDHC_TRNS_MULTI) == 0 ||
             ((s->trnmod & SDHC_TRNS_MULTI) &&
             (s->trnmod & SDHC_TRNS_BLK_CNT_EN) && (s->blkcnt == 0))) {
         SDHCI_GET_CLASS(s)->end_data_transfer(s);
+    } else if (s->norintstsen & SDHC_NISEN_WBUFRDY) {
+        s->norintsts |= SDHC_NIS_WBUFRDY;
     }

     /* Generate Block Gap Event if requested and if not the last block */