Received: from eggs.gnu.org ([2001:4830:134:3::10]:54222) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjYGG-00070F-Lq for qemu-devel@nongnu.org; Mon, 03 Jun 2013 13:09:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UjYG9-0002PP-OW for qemu-devel@nongnu.org; Mon, 03 Jun 2013 13:09:36 -0400 Received: from 1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.d.1.0.0.b.8.0.1.0.0.2.ip6.arpa ([2001:8b0:1d0::1]:57802 helo=mnementh.archaic.org.uk) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UjXeS-0006Zk-Dt for qemu-devel@nongnu.org; Mon, 03 Jun 2013 12:30:32 -0400 From: Peter Maydell Date: Mon, 3 Jun 2013 17:30:13 +0100 Message-Id: <1370277021-26129-17-git-send-email-peter.maydell@linaro.org> In-Reply-To: <1370277021-26129-1-git-send-email-peter.maydell@linaro.org> References: <1370277021-26129-1-git-send-email-peter.maydell@linaro.org> Subject: [Qemu-devel] [PULL 16/24] sd/sdhci.c: Only reset data_count on new commands List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org, Paul Brook From: Peter Crosthwaite The data_count variable was being reset on every transfer, including DMA transfer resumptions. This is incorrect, it should only be set on a new command. Manifests as a bug when using ADMA and there is a timer delay between ADMA frames where the fifo is left in a non empty state. Signed-off-by: Peter Crosthwaite Reviewed-by: Igor Mitsyanko Message-id: 15a98609cc32315211b0963091a8efd67522e160.1369370934.git.peter.crosthwaite@xilinx.com Signed-off-by: Peter Maydell --- hw/sd/sdhci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/sd/sdhci.c b/hw/sd/sdhci.c index 91dc9b0..0a84540 100644 --- a/hw/sd/sdhci.c +++ b/hw/sd/sdhci.c @@ -260,6 +260,7 @@ static void sdhci_send_command(SDHCIState *s) sdhci_update_irq(s); if (s->blksize && (s->cmdreg & SDHC_CMD_DATA_PRESENT)) { + s->data_count = 0; sdhci_do_data_transfer(s); } } @@ -773,7 +774,6 @@ static void sdhci_do_adma(SDHCIState *s) static void sdhci_data_transfer(SDHCIState *s) { SDHCIClass *k = SDHCI_GET_CLASS(s); - s->data_count = 0; if (s->trnmod & SDHC_TRNS_DMA) { switch (SDHC_DMA_TYPE(s->hostctl)) { -- 1.7.9.5