From patchwork Mon Mar 7 20:40:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikko Vinni X-Patchwork-Id: 616601 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p27KsYLV001876 for ; Mon, 7 Mar 2011 20:54:35 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756159Ab1CGUy0 (ORCPT ); Mon, 7 Mar 2011 15:54:26 -0500 Received: from mail1.shellit.org ([81.22.255.73]:45516 "EHLO mail.shellit.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756140Ab1CGUyZ (ORCPT ); Mon, 7 Mar 2011 15:54:25 -0500 X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 07 Mar 2011 20:54:42 +0000 (UTC) X-Greylist: delayed 354 seconds by postgrey-1.27 at vger.kernel.org; Mon, 07 Mar 2011 15:54:24 EST Received: from localhost (localhost.localdomain [127.0.0.1]) by mail.shellit.org (Postfix) with ESMTP id 4BBA47BA017; Mon, 7 Mar 2011 22:48:28 +0200 (EET) X-Virus-Scanned: Debian amavisd-new at !change-mydomain-variable!.example.com X-Spam-Flag: NO X-Spam-Score: -0.613 X-Spam-Level: X-Spam-Status: No, score=-0.613 required=4.5 tests=[ALL_TRUSTED=-1.8, BAYES_05=-1.11, FORGED_YAHOO_RCVD=2.297] Received: from mail.shellit.org ([127.0.0.1]) by localhost (mail1.shellit.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id jA10iRPbLuwX; Mon, 7 Mar 2011 22:48:28 +0200 (EET) Received: from localhost.localdomain (h-62-142-174-134.joensuunelli.fi [62.142.174.134]) by mail.shellit.org (Postfix) with ESMTPSA id 956583948C4; Mon, 7 Mar 2011 22:48:27 +0200 (EET) From: Mikko Vinni To: linux-mmc@vger.kernel.org Cc: Mikko Vinni Subject: [PATCH resend] sdhci: work around broken dma boundary behaviour Date: Mon, 7 Mar 2011 22:40:57 +0200 Message-Id: <1299530457-19904-1-git-send-email-mmvinni@yahoo.com> X-Mailer: git-send-email 1.7.4.1 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index a25db42..8651731 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1537,9 +1537,27 @@ static void sdhci_data_irq(struct sdhci_host *host, u32 intmask) * boundaries, but as we can't disable the feature * we need to at least restart the transfer. */ - if (intmask & SDHCI_INT_DMA_END) - sdhci_writel(host, sdhci_readl(host, SDHCI_DMA_ADDRESS), - SDHCI_DMA_ADDRESS); + if (intmask & SDHCI_INT_DMA_END) { + u32 dmastart, dmanow; + dmastart = sg_dma_address(host->data->sg); + dmanow = sdhci_readl(host, SDHCI_DMA_ADDRESS); + if (dmanow == dmastart) { + /* + * HW failed to increase the address. + * Update to the next 512KB block boundary. + */ + dmanow = (dmanow & ~0x7ffff) + 0x80000; + if (dmanow > dmastart + host->data->blksz * + host->data->blocks) { + WARN_ON(1); + dmanow = dmastart; + } + DBG("%s: next DMA address forced " + "from 0x%08x to 0x%08x\n", + mmc_hostname(host->mmc), dmastart, dmanow); + } + sdhci_writel(host, dmanow, SDHCI_DMA_ADDRESS); + } if (intmask & SDHCI_INT_DATA_END) { if (host->cmd) {