From patchwork Mon Feb 21 21:23:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mikko Vinni X-Patchwork-Id: 578481 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 p1LLU8kM020032 for ; Mon, 21 Feb 2011 21:30:10 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751351Ab1BUVaH (ORCPT ); Mon, 21 Feb 2011 16:30:07 -0500 Received: from lo.gmane.org ([80.91.229.12]:59786 "EHLO lo.gmane.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751123Ab1BUVaG (ORCPT ); Mon, 21 Feb 2011 16:30:06 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PrdKW-0004Q6-Bk for linux-mmc@vger.kernel.org; Mon, 21 Feb 2011 22:30:04 +0100 Received: from 85-156-14-70.elisa-mobile.fi ([85.156.14.70]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 21 Feb 2011 22:30:04 +0100 Received: from mmvinni by 85-156-14-70.elisa-mobile.fi with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 21 Feb 2011 22:30:04 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: linux-mmc@vger.kernel.org From: Mikko Vinni Subject: [PATCH] sdhci: work around broken dma boundary behaviour Date: Mon, 21 Feb 2011 21:23:32 +0000 (UTC) Lines: 49 Message-ID: References: <403485.93468.qm@web161809.mail.bf1.yahoo.com> Mime-Version: 1.0 X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: sea.gmane.org User-Agent: Loom/3.14 (http://gmane.org/) X-Loom-IP: 85.156.14.70 (Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.13) Gecko/20110207 Firefox/3.6.13) Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Mon, 21 Feb 2011 21:30:10 +0000 (UTC) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index a25db42..469cf74 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) {