From patchwork Wed Sep 9 12:00:10 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adrian Hunter X-Patchwork-Id: 46386 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n89C0nSm008774 for ; Wed, 9 Sep 2009 12:00:49 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753240AbZIIMAo (ORCPT ); Wed, 9 Sep 2009 08:00:44 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753235AbZIIMAo (ORCPT ); Wed, 9 Sep 2009 08:00:44 -0400 Received: from smtp.nokia.com ([192.100.122.230]:25410 "EHLO mgw-mx03.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753234AbZIIMAm (ORCPT ); Wed, 9 Sep 2009 08:00:42 -0400 Received: from esebh105.NOE.Nokia.com (esebh105.ntc.nokia.com [172.21.138.211]) by mgw-mx03.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id n89BxjYf026823; Wed, 9 Sep 2009 15:00:00 +0300 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by esebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Wed, 9 Sep 2009 14:59:55 +0300 Received: from mgw-da01.ext.nokia.com ([147.243.128.24]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Wed, 9 Sep 2009 14:59:49 +0300 Received: from [127.0.1.1] (esdhcp041173.research.nokia.com [172.21.41.173]) by mgw-da01.ext.nokia.com (Switch-3.3.3/Switch-3.3.3) with ESMTP id n89Bxei8009782; Wed, 9 Sep 2009 14:59:41 +0300 From: Adrian Hunter To: Andrew Morton Cc: Jarkko Lavinen , Adrian Hunter , Madhusudhan Chikkature , Pierre Ossman , linux-omap Mailing List , linux-mmc Mailing List , Matt Fleming Date: Wed, 09 Sep 2009 15:00:10 +0300 Message-Id: <20090909120010.12833.93446.sendpatchset@ahunter-laptop> In-Reply-To: <20090909115633.12833.39619.sendpatchset@ahunter-laptop> References: <20090909115633.12833.39619.sendpatchset@ahunter-laptop> Subject: [PATCH V3 29/30] omap_hsmmc: set a large data timeout for commands with busy signal X-OriginalArrivalTime: 09 Sep 2009 11:59:49.0537 (UTC) FILETIME=[084ED910:01CA3145] Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From c85a80da2efe181ff256074f7bcd9099428f2572 Mon Sep 17 00:00:00 2001 From: Adrian Hunter Date: Fri, 26 Jun 2009 11:29:20 +0300 Subject: [PATCH] omap_hsmmc: set a large data timeout for commands with busy signal Commands like SWITCH (CMD6) send a response and then signal busy while the operation is completed. These commands are expected to always succeed (otherwise the response would have indicated an error). Set an arbitrarily large data timeout value (100ms) for these commands to ensure that premature timeouts do not occur. Signed-off-by: Adrian Hunter --- drivers/mmc/host/omap_hsmmc.c | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/mmc/host/omap_hsmmc.c b/drivers/mmc/host/omap_hsmmc.c index 64780da..b54f3e3 100644 --- a/drivers/mmc/host/omap_hsmmc.c +++ b/drivers/mmc/host/omap_hsmmc.c @@ -990,7 +990,8 @@ static int omap_hsmmc_start_dma_transfer(struct omap_hsmmc_host *host, } static void set_data_timeout(struct omap_hsmmc_host *host, - struct mmc_request *req) + unsigned int timeout_ns, + unsigned int timeout_clks) { unsigned int timeout, cycle_ns; uint32_t reg, clkd, dto = 0; @@ -1001,8 +1002,8 @@ static void set_data_timeout(struct omap_hsmmc_host *host, clkd = 1; cycle_ns = 1000000000 / (clk_get_rate(host->fclk) / clkd); - timeout = req->data->timeout_ns / cycle_ns; - timeout += req->data->timeout_clks; + timeout = timeout_ns / cycle_ns; + timeout += timeout_clks; if (timeout) { while ((timeout & 0x80000000) == 0) { dto += 1; @@ -1036,12 +1037,18 @@ omap_hsmmc_prepare_data(struct omap_hsmmc_host *host, struct mmc_request *req) if (req->data == NULL) { OMAP_HSMMC_WRITE(host->base, BLK, 0); + /* + * Set an arbitrary 100ms data timeout for commands with + * busy signal. + */ + if (req->cmd->flags & MMC_RSP_BUSY) + set_data_timeout(host, 100000000U, 0); return 0; } OMAP_HSMMC_WRITE(host->base, BLK, (req->data->blksz) | (req->data->blocks << 16)); - set_data_timeout(host, req); + set_data_timeout(host, req->data->timeout_ns, req->data->timeout_clks); if (host->use_dma) { ret = omap_hsmmc_start_dma_transfer(host, req);