From patchwork Sat Oct 12 09:50:53 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Haijun.Zhang" X-Patchwork-Id: 283002 X-Patchwork-Delegate: panto@antoniou-consulting.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 458462C00C6 for ; Sat, 12 Oct 2013 21:14:07 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 85F534A066; Sat, 12 Oct 2013 12:14:03 +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 7x1D8UvSRHF4; Sat, 12 Oct 2013 12:14:03 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 0054C4A07A; Sat, 12 Oct 2013 12:13:58 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id ADAF94A07A for ; Sat, 12 Oct 2013 12:13:52 +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 Ntvy9b7xjxpP for ; Sat, 12 Oct 2013 12:13:47 +0200 (CEST) X-Greylist: delayed 910 seconds by postgrey-1.27 at theia; Sat, 12 Oct 2013 12:13:40 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 db8outboundpool.messaging.microsoft.com (mail-db8lp0184.outbound.messaging.microsoft.com [213.199.154.184]) by theia.denx.de (Postfix) with ESMTPS id 0F5744A066 for ; Sat, 12 Oct 2013 12:13:40 +0200 (CEST) Received: from mail210-db8-R.bigfish.com (10.174.8.249) by DB8EHSOBE008.bigfish.com (10.174.4.71) with Microsoft SMTP Server id 14.1.225.22; Sat, 12 Oct 2013 09:58:29 +0000 Received: from mail210-db8 (localhost [127.0.0.1]) by mail210-db8-R.bigfish.com (Postfix) with ESMTP id 51E933800B6 for ; Sat, 12 Oct 2013 09:58:29 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 0 X-BigFish: VS0(zzzz1f42h208ch1ee6h1de0h1fdah2073h1202h1e76h1d1ah1d2ah1fc6hzz1de098h1de097h8275bhz2dh2a8h839he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1b2fh1fb3h1d0ch1d2eh1d3fh1dc1h1dfeh1dffh1e23h1fe8h1ff5h1155h) Received: from mail210-db8 (localhost.localdomain [127.0.0.1]) by mail210-db8 (MessageSwitch) id 1381571907834464_19276; Sat, 12 Oct 2013 09:58:27 +0000 (UTC) Received: from DB8EHSMHS008.bigfish.com (unknown [10.174.8.235]) by mail210-db8.bigfish.com (Postfix) with ESMTP id C7B013000EF for ; Sat, 12 Oct 2013 09:58:27 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by DB8EHSMHS008.bigfish.com (10.174.4.18) with Microsoft SMTP Server (TLS) id 14.16.227.3; Sat, 12 Oct 2013 09:58:27 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-002.039d.mgd.msft.net (10.84.1.15) with Microsoft SMTP Server (TLS) id 14.3.158.2; Sat, 12 Oct 2013 09:58:25 +0000 Received: from rock.am.freescale.net (rock.ap.freescale.net [10.193.20.106]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id r9C9wM1P030333; Sat, 12 Oct 2013 02:58:23 -0700 From: Haijun Zhang To: Date: Sat, 12 Oct 2013 17:50:53 +0800 Message-ID: <1381571453-7814-1-git-send-email-Haijun.Zhang@freescale.com> X-Mailer: git-send-email 1.8.0 MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% Cc: scottwood@freescale.com, yorksun@freescale.com, X.Xie@freescale.com, Haijun Zhang Subject: [U-Boot] [PATCH] fsl_esdhc: Add Auto command 12 interrupt bit detecting 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: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de When Auto-CMD12 is used, the corresponding interrupt and error bit should be enabled and set to reflect auto cmd 12 error. Also add other command error detecting, like command index error, CRC error etc. Without this command error bit set system will hang due to the while loop. Signed-off-by: Haijun Zhang --- drivers/mmc/fsl_esdhc.c | 10 +++++----- include/fsl_esdhc.h | 3 ++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/mmc/fsl_esdhc.c b/drivers/mmc/fsl_esdhc.c index dc1d002..5aa592b 100644 --- a/drivers/mmc/fsl_esdhc.c +++ b/drivers/mmc/fsl_esdhc.c @@ -342,13 +342,13 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data) #endif /* Wait for the command to complete */ - while (!(esdhc_read32(®s->irqstat) & (IRQSTAT_CC | IRQSTAT_CTOE))) + while (!(esdhc_read32(®s->irqstat) & (IRQSTAT_CC | CMD_ERR))) ; irqstat = esdhc_read32(®s->irqstat); /* Reset CMD and DATA portions on error */ - if (irqstat & (CMD_ERR | IRQSTAT_CTOE)) { + if (irqstat & CMD_ERR) { esdhc_write32(®s->sysctl, esdhc_read32(®s->sysctl) | SYSCTL_RSTC); while (esdhc_read32(®s->sysctl) & SYSCTL_RSTC) @@ -363,12 +363,12 @@ esdhc_send_cmd(struct mmc *mmc, struct mmc_cmd *cmd, struct mmc_data *data) } } - if (irqstat & CMD_ERR) - return COMM_ERR; - if (irqstat & IRQSTAT_CTOE) return TIMEOUT; + if (irqstat & CMD_ERR) + return COMM_ERR; + /* Workaround for ESDHC errata ENGcm03648 */ if (!data && (cmd->resp_type & MMC_RSP_BUSY)) { int timeout = 2500; diff --git a/include/fsl_esdhc.h b/include/fsl_esdhc.h index 67d6057..37dbe27 100644 --- a/include/fsl_esdhc.h +++ b/include/fsl_esdhc.h @@ -62,7 +62,8 @@ #define IRQSTAT_TC (0x00000002) #define IRQSTAT_CC (0x00000001) -#define CMD_ERR (IRQSTAT_CIE | IRQSTAT_CEBE | IRQSTAT_CCE) +#define CMD_ERR (IRQSTAT_CIE | IRQSTAT_CEBE | IRQSTAT_CCE | \ + IRQSTAT_CTOE | IRQSTAT_AC12E) #define DATA_ERR (IRQSTAT_DEBE | IRQSTAT_DCE | IRQSTAT_DTOE | \ IRQSTAT_DMAE) #define DATA_COMPLETE (IRQSTAT_TC | IRQSTAT_DINT)