From patchwork Mon Jan 21 11:02:26 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shawn Guo X-Patchwork-Id: 2010641 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id B983DDF23A for ; Mon, 21 Jan 2013 10:34:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752499Ab3AUKeg (ORCPT ); Mon, 21 Jan 2013 05:34:36 -0500 Received: from co9ehsobe002.messaging.microsoft.com ([207.46.163.25]:17048 "EHLO co9outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752403Ab3AUKef (ORCPT ); Mon, 21 Jan 2013 05:34:35 -0500 Received: from mail216-co9-R.bigfish.com (10.236.132.252) by CO9EHSOBE030.bigfish.com (10.236.130.93) with Microsoft SMTP Server id 14.1.225.23; Mon, 21 Jan 2013 10:34:35 +0000 Received: from mail216-co9 (localhost [127.0.0.1]) by mail216-co9-R.bigfish.com (Postfix) with ESMTP id 0D7833A0430; Mon, 21 Jan 2013 10:34:35 +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(zzzz1ee6h1de0h1202h1e76h1d1ah1d2ahzz8275dhz2dh87h2a8h668h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h1155h) X-FB-DOMAIN-IP-MATCH: fail Received: from mail216-co9 (localhost.localdomain [127.0.0.1]) by mail216-co9 (MessageSwitch) id 1358764438703578_14380; Mon, 21 Jan 2013 10:33:58 +0000 (UTC) Received: from CO9EHSMHS029.bigfish.com (unknown [10.236.132.228]) by mail216-co9.bigfish.com (Postfix) with ESMTP id A9F9F34004A; Mon, 21 Jan 2013 10:33:58 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by CO9EHSMHS029.bigfish.com (10.236.130.39) with Microsoft SMTP Server (TLS) id 14.1.225.23; Mon, 21 Jan 2013 10:33:57 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-001.039d.mgd.msft.net (10.84.1.13) with Microsoft SMTP Server (TLS) id 14.2.318.3; Mon, 21 Jan 2013 10:33:56 +0000 Received: from S2100-06.ap.freescale.net (S2100-06.ap.freescale.net [10.192.242.65]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id r0LAXi20009268; Mon, 21 Jan 2013 03:33:54 -0700 From: Shawn Guo To: CC: Sascha Hauer , Chris Ball , Shawn Guo Subject: [PATCH 3/6] mmc: sdhci-esdhc-imx: Auto CMD23 support for usdhc Date: Mon, 21 Jan 2013 19:02:26 +0800 Message-ID: <1358766149-9534-4-git-send-email-shawn.guo@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1358766149-9534-1-git-send-email-shawn.guo@linaro.org> References: <1358766149-9534-1-git-send-email-shawn.guo@linaro.org> MIME-Version: 1.0 X-OriginatorOrg: sigmatel.com Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org SDHCI core will try to use Auto CMD23 for mmc card. Currently, we will see the following message with mmc card on usdhc due to the lacking of Auto CMD23 support in the driver. $ mmc0: new high speed MMC card at address 0001 mmcblk1: mmc0:0001 MMC02G 1.87 GiB mmcblk1: error -84 transferring data, sector 0, nr 8, cmd response 0x900, card status 0xb00 mmcblk1: retrying using single block read mmcblk1: Enable Auto CMD23 support for usdhc so that mmc card can work in multiple block mode. Signed-off-by: Shawn Guo --- drivers/mmc/host/sdhci-esdhc-imx.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 968a70f..24daaf4 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -36,6 +36,9 @@ #define ESDHC_VENDOR_SPEC_SDIO_QUIRK (1 << 1) #define ESDHC_WTMK_LVL 0x44 #define ESDHC_MIX_CTRL 0x48 +#define ESDHC_MIX_CTRL_AC23EN (1 << 7) +/* Bits 3 and 6 are not SDHCI standard definitions */ +#define ESDHC_MIX_CTRL_SDHCI_MASK 0xb7 /* * There is an INT DMA ERR mis-match between eSDHC and STD SDHC SPEC: @@ -251,7 +254,12 @@ static void esdhc_writew_le(struct sdhci_host *host, u16 val, int reg) if (is_imx6q_usdhc(imx_data)) { u32 m = readl(host->ioaddr + ESDHC_MIX_CTRL); - m = val | (m & 0xffff0000); + /* Swap AC23 bit */ + if (val & SDHCI_TRNS_AUTO_CMD23) { + val &= ~SDHCI_TRNS_AUTO_CMD23; + val |= ESDHC_MIX_CTRL_AC23EN; + } + m = val | (m & ~ESDHC_MIX_CTRL_SDHCI_MASK); writel(m, host->ioaddr + ESDHC_MIX_CTRL); } else { /*