From patchwork Tue Sep 4 11:37:32 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tushar Behera X-Patchwork-Id: 181542 X-Patchwork-Delegate: afleming@freescale.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 45E372C0093 for ; Tue, 4 Sep 2012 21:40:26 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 49C39280AB; Tue, 4 Sep 2012 13:40:23 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zzO6shfuDQU5; Tue, 4 Sep 2012 13:40:23 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EEEAC280A4; Tue, 4 Sep 2012 13:40:20 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id EC2CB280A4 for ; Tue, 4 Sep 2012 13:40:18 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id i5pYx9awxIZ3 for ; Tue, 4 Sep 2012 13:40:18 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pz0-f44.google.com (mail-pz0-f44.google.com [209.85.210.44]) by theia.denx.de (Postfix) with ESMTPS id 8E3B0280A2 for ; Tue, 4 Sep 2012 13:40:15 +0200 (CEST) Received: by dadf8 with SMTP id f8so4144815dad.3 for ; Tue, 04 Sep 2012 04:40:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=BcNvzhGTVjAZGfz4t2ga1nJjLPvijsK6llWzcv0w004=; b=l8pdt+OLiAUs4fxzPztdNGXlrrz51YmYsaVTUctGPIWuTVPaVIO0dFchpmHJAAaEYt bhW7oS9r8s/vMSuSlwWUDXK9mdjF4koBUKRj8oRnu2Qepl9OXFLpHhvYrgG5Q3ZCxUJn kwarSdM0nCOUp2RiA/1k3R9/uqYj+f2egQT2oQ1Uo8sYR5U7dGaTHu4evF0yNNkyPyI6 GoLQ9oMHJ33p/eF0ypUeF22xpJ/kp7QRXZyQWqVIzPlRaVVb51xVW5lI7w4Hp/SUIgfl Jg4XECHeSkQHahbag3oRJK1/QJKd1Om9j6FqtYtPp8OsgxBrCebSM5R2uN84XAMdi2jl R9hw== Received: by 10.66.87.2 with SMTP id t2mr40680928paz.6.1346758813784; Tue, 04 Sep 2012 04:40:13 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id sv8sm5989930pbc.7.2012.09.04.04.40.11 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 04 Sep 2012 04:40:12 -0700 (PDT) From: Tushar Behera To: u-boot@lists.denx.de Date: Tue, 4 Sep 2012 17:07:32 +0530 Message-Id: <1346758652-13942-1-git-send-email-tushar.behera@linaro.org> X-Mailer: git-send-email 1.7.4.1 X-Gm-Message-State: ALoCoQkMLtxaa4eiajSTk/Hp+3eXXqU/AJO2jFg9lBlrriI51uxo2iebshYvnBWZkUiUERKXWRyr Cc: Jaehoon Chung , Andy Fleming Subject: [U-Boot] [PATCH] mmc: Add a quirk to add delay during completion of sdhci_send_cmd X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de MMC host controller requires a delay between every sdhci_send_cmd() execution. In s5p_mmc driver (s5p_sdhci replaces this driver), a delay of 1000us was provided after every mmc_send_cmd() call. Adding a quirk in current sdhci driver to replicate the behaviour. Without this delay, MMC initialization on Origen board fails with following error messages. Timeout for status update! mmc fail to send stop cmd CC: Jaehoon Chung CC: Andy Fleming Signed-off-by: Tushar Behera --- This patch is applied on v2012.07 and Jaehoon Chung's following patchset. [PATCH v2 0/4] mmc: sdhci: fixed some problems for Exynos drivers/mmc/s5p_sdhci.c | 3 ++- drivers/mmc/sdhci.c | 4 ++++ include/sdhci.h | 1 + 3 files changed, 7 insertions(+), 1 deletions(-) diff --git a/drivers/mmc/s5p_sdhci.c b/drivers/mmc/s5p_sdhci.c index b978236..dc49d37 100644 --- a/drivers/mmc/s5p_sdhci.c +++ b/drivers/mmc/s5p_sdhci.c @@ -83,7 +83,8 @@ int s5p_sdhci_init(u32 regbase, int index, int bus_width) host->ioaddr = (void *)regbase; host->quirks = SDHCI_QUIRK_NO_HISPD_BIT | SDHCI_QUIRK_BROKEN_VOLTAGE | - SDHCI_QUIRK_BROKEN_R1B | SDHCI_QUIRK_32BIT_DMA_ADDR; + SDHCI_QUIRK_BROKEN_R1B | SDHCI_QUIRK_32BIT_DMA_ADDR | + SDHCI_QUIRK_WAIT_SEND_CMD; host->voltages = MMC_VDD_32_33 | MMC_VDD_33_34 | MMC_VDD_165_195; host->version = sdhci_readw(host, SDHCI_HOST_VERSION); diff --git a/drivers/mmc/sdhci.c b/drivers/mmc/sdhci.c index d0b8d24..823b1af 100644 --- a/drivers/mmc/sdhci.c +++ b/drivers/mmc/sdhci.c @@ -233,12 +233,16 @@ int sdhci_send_command(struct mmc *mmc, struct mmc_cmd *cmd, if (!ret && data) ret = sdhci_transfer_data(host, data, start_addr); + if (host->quirks & SDHCI_QUIRK_WAIT_SEND_CMD) + udelay(1000); + stat = sdhci_readl(host, SDHCI_INT_STATUS); sdhci_writel(host, SDHCI_INT_ALL_MASK, SDHCI_INT_STATUS); if (!ret) { if ((host->quirks & SDHCI_QUIRK_32BIT_DMA_ADDR) && !is_aligned && (data->flags == MMC_DATA_READ)) memcpy(data->dest, aligned_buffer, trans_bytes); + return 0; } diff --git a/include/sdhci.h b/include/sdhci.h index 4351a62..d38cfd4 100644 --- a/include/sdhci.h +++ b/include/sdhci.h @@ -219,6 +219,7 @@ #define SDHCI_QUIRK_BROKEN_R1B (1 << 2) #define SDHCI_QUIRK_NO_HISPD_BIT (1 << 3) #define SDHCI_QUIRK_BROKEN_VOLTAGE (1 << 4) +#define SDHCI_QUIRK_WAIT_SEND_CMD (1 << 5) /* to make gcc happy */ struct sdhci_host;