From patchwork Tue Aug 3 03:11:10 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zang Roy-R61911 X-Patchwork-Id: 60717 X-Patchwork-Delegate: galak@kernel.crashing.org Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from bilbo.ozlabs.org (localhost [127.0.0.1]) by ozlabs.org (Postfix) with ESMTP id E3B7110083D for ; Tue, 3 Aug 2010 13:42:18 +1000 (EST) Received: by ozlabs.org (Postfix) id D5B1D1007D3; Tue, 3 Aug 2010 13:41:50 +1000 (EST) Delivered-To: linuxppc-dev@ozlabs.org Received: from DB3EHSOBE004.bigfish.com (db3ehsobe004.messaging.microsoft.com [213.199.154.142]) by ozlabs.org (Postfix) with ESMTP id 3EA9E1007D4 for ; Tue, 3 Aug 2010 13:41:50 +1000 (EST) Received: from mail6-db3-R.bigfish.com (10.3.81.244) by DB3EHSOBE004.bigfish.com (10.3.84.24) with Microsoft SMTP Server id 8.1.436.0; Tue, 3 Aug 2010 03:26:37 +0000 Received: from mail6-db3 (localhost.localdomain [127.0.0.1]) by mail6-db3-R.bigfish.com (Postfix) with ESMTP id 7DC4512980DB; Tue, 3 Aug 2010 03:26:37 +0000 (UTC) X-SpamScore: 1 X-BigFish: VS1(zzzz1202hzz1497iz2dh2a8h62h) X-Spam-TCS-SCL: 1:0 Received: from mail6-db3 (localhost.localdomain [127.0.0.1]) by mail6-db3 (MessageSwitch) id 12808059974482_2955; Tue, 3 Aug 2010 03:26:37 +0000 (UTC) Received: from DB3EHSMHS001.bigfish.com (unknown [10.3.81.243]) by mail6-db3.bigfish.com (Postfix) with ESMTP id F296B15C004E; Tue, 3 Aug 2010 03:26:36 +0000 (UTC) Received: from az33egw02.freescale.net (192.88.158.103) by DB3EHSMHS001.bigfish.com (10.3.87.101) with Microsoft SMTP Server (TLS) id 14.0.482.44; Tue, 3 Aug 2010 03:26:36 +0000 Received: from az33smr01.freescale.net (az33smr01.freescale.net [10.64.34.199]) by az33egw02.freescale.net (8.14.3/8.14.3) with ESMTP id o733QOqD029674; Mon, 2 Aug 2010 20:26:24 -0700 (MST) Received: from localhost.localdomain (rock.ap.freescale.net [10.193.20.106]) by az33smr01.freescale.net (8.13.1/8.13.0) with ESMTP id o733bdZZ013858; Mon, 2 Aug 2010 22:37:40 -0500 (CDT) From: Roy Zang To: linux-mmc@vger.kernel.org Subject: [PATCH 1/3 v2] sdhci: Add auto CMD12 support for eSDHC driver Date: Tue, 3 Aug 2010 11:11:10 +0800 Message-ID: <1280805072-26112-1-git-send-email-tie-fei.zang@freescale.com> X-Mailer: git-send-email 1.5.6.5 MIME-Version: 1.0 X-Reverse-DNS: az33egw02.freescale.net Cc: linuxppc-dev@ozlabs.org, akpm@linux-foundation.org X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org From: Jerry Huang Add auto CMD12 command support for eSDHC driver. This is needed by P4080 and P1022 for block read/write. Manual asynchronous CMD12 abort operation causes protocol violations on these silicons. Signed-off-by: Jerry Huang Signed-off-by: Roy Zang --- drivers/mmc/host/sdhci-of-core.c | 4 ++++ drivers/mmc/host/sdhci.c | 14 ++++++++++++-- drivers/mmc/host/sdhci.h | 2 ++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/sdhci-of-core.c b/drivers/mmc/host/sdhci-of-core.c index a2e9820..dd1bdd1 100644 --- a/drivers/mmc/host/sdhci-of-core.c +++ b/drivers/mmc/host/sdhci-of-core.c @@ -154,6 +154,10 @@ static int __devinit sdhci_of_probe(struct of_device *ofdev, host->ops = &sdhci_of_data->ops; } + if (of_get_property(np, "sdhci,auto-cmd12", NULL)) + host->quirks |= SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12; + + if (of_get_property(np, "sdhci,1-bit-only", NULL)) host->quirks |= SDHCI_QUIRK_FORCE_1_BIT_DATA; diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index c6d1bd8..a92566e 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -817,8 +817,12 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host, WARN_ON(!host->data); mode = SDHCI_TRNS_BLK_CNT_EN; - if (data->blocks > 1) - mode |= SDHCI_TRNS_MULTI; + if (data->blocks > 1) { + if (host->quirks & SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12) + mode |= SDHCI_TRNS_MULTI | SDHCI_TRNS_ACMD12; + else + mode |= SDHCI_TRNS_MULTI; + } if (data->flags & MMC_DATA_READ) mode |= SDHCI_TRNS_READ; if (host->flags & SDHCI_REQ_USE_DMA) @@ -1108,6 +1112,12 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq) #ifndef SDHCI_USE_LEDS_CLASS sdhci_activate_led(host); #endif + if (host->quirks & SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12) { + if (mrq->stop) { + mrq->data->stop = NULL; + mrq->stop = NULL; + } + } host->mrq = mrq; diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index c846813..8fb088c 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -240,6 +240,8 @@ struct sdhci_host { #define SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN (1<<25) /* Controller cannot support End Attribute in NOP ADMA descriptor */ #define SDHCI_QUIRK_NO_ENDATTR_IN_NOPDESC (1<<26) +/* Controller uses Auto CMD12 command to stop the transfer */ +#define SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 (1<<27) int irq; /* Device IRQ */ void __iomem * ioaddr; /* Mapped address */