From patchwork Tue Feb 22 10:13:26 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Zhu X-Patchwork-Id: 580001 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p1MADjnt006495 for ; Tue, 22 Feb 2011 10:13:51 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753590Ab1BVKNv (ORCPT ); Tue, 22 Feb 2011 05:13:51 -0500 Received: from va3ehsobe002.messaging.microsoft.com ([216.32.180.12]:15505 "EHLO VA3EHSOBE002.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753462Ab1BVKNu (ORCPT ); Tue, 22 Feb 2011 05:13:50 -0500 Received: from mail6-va3-R.bigfish.com (10.7.14.237) by VA3EHSOBE002.bigfish.com (10.7.40.22) with Microsoft SMTP Server id 14.1.225.8; Tue, 22 Feb 2011 10:13:49 +0000 Received: from mail6-va3 (localhost.localdomain [127.0.0.1]) by mail6-va3-R.bigfish.com (Postfix) with ESMTP id 9AE4B2A82E8; Tue, 22 Feb 2011 10:13:49 +0000 (UTC) X-SpamScore: -2 X-BigFish: VS-2(zzbb2cKzz1202hzz8275bh1497iz2dh2a8h668h62h) X-Spam-TCS-SCL: 1:0 X-Forefront-Antispam-Report: KIP:(null); UIP:(null); IPVD:NLI; H:az33egw02.freescale.net; RD:az33egw02.freescale.net; EFVD:NLI Received: from mail6-va3 (localhost.localdomain [127.0.0.1]) by mail6-va3 (MessageSwitch) id 1298369629218285_5897; Tue, 22 Feb 2011 10:13:49 +0000 (UTC) Received: from VA3EHSMHS001.bigfish.com (unknown [10.7.14.254]) by mail6-va3.bigfish.com (Postfix) with ESMTP id 3012E142804F; Tue, 22 Feb 2011 10:13:49 +0000 (UTC) Received: from az33egw02.freescale.net (192.88.158.103) by VA3EHSMHS001.bigfish.com (10.7.99.11) with Microsoft SMTP Server (TLS) id 14.1.225.8; Tue, 22 Feb 2011 10:13:48 +0000 Received: from az33smr02.freescale.net (az33smr02.freescale.net [10.64.34.200]) by az33egw02.freescale.net (8.14.3/8.14.3) with ESMTP id p1MADli6023871; Tue, 22 Feb 2011 03:13:47 -0700 (MST) Received: from x-VirtualBox.ap.freescale.net ([10.192.242.62]) by az33smr02.freescale.net (8.13.1/8.13.0) with ESMTP id p1MADR7j029788; Tue, 22 Feb 2011 04:13:43 -0600 (CST) From: Richard Zhu To: CC: , , , , , , , , Richard Zhu Subject: [PATCH v2 5/5] mmc: sdhci-esdhc: enable esdhc on imx53 Date: Tue, 22 Feb 2011 18:13:26 +0800 Message-ID: <1298369606-29972-5-git-send-email-Hong-Xing.Zhu@freescale.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1298369606-29972-1-git-send-email-Hong-Xing.Zhu@freescale.com> References: <1298369606-29972-1-git-send-email-Hong-Xing.Zhu@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.com Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Tue, 22 Feb 2011 10:13:51 +0000 (UTC) diff --git a/drivers/mmc/host/sdhci-esdhc-imx.c b/drivers/mmc/host/sdhci-esdhc-imx.c index 9b82910..a09f786 100644 --- a/drivers/mmc/host/sdhci-esdhc-imx.c +++ b/drivers/mmc/host/sdhci-esdhc-imx.c @@ -17,6 +17,8 @@ #include #include #include +#include +#include #include #include "sdhci.h" #include "sdhci-pltfm.h" @@ -38,6 +40,27 @@ static u16 esdhc_readw_le(struct sdhci_host *host, int reg) return readw(host->ioaddr + reg); } +static void esdhc_writel_le(struct sdhci_host *host, u32 val, int reg) +{ + switch (reg) { + case SDHCI_INT_STATUS: + /* + * Fix no INT bug in SDIO MULTI-BLK read + * clear bit1 of Vendor Spec registor after TC + */ + if (val & SDHCI_INT_DATA_END) { + u32 v; + v = readl(host->ioaddr + SDHCI_VENDOR_SPEC); + if (v & 0x2) { + v &= (~0x2); + writel(v, host->ioaddr + SDHCI_VENDOR_SPEC); + } + } + break; + } + writel(val, host->ioaddr + reg); +} + static void esdhc_writew_le(struct sdhci_host *host, u16 val, int reg) { struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host); @@ -45,12 +68,27 @@ static void esdhc_writew_le(struct sdhci_host *host, u16 val, int reg) switch (reg) { case SDHCI_TRANSFER_MODE: /* + * Fix no INT bug in SDIO MULTI-BLK read + * set bit1 of Vendor Spec registor + */ + if ((host->cmd->opcode == SD_IO_RW_EXTENDED) + && (host->cmd->data->blocks > 1) + && (host->cmd->data->flags & MMC_DATA_READ)) { + u32 v; + v = readl(host->ioaddr + SDHCI_VENDOR_SPEC); + v |= 0x2; + writel(v, host->ioaddr + SDHCI_VENDOR_SPEC); + } + /* * Postpone this write, we must do it together with a * command write that is down below. */ pltfm_host->scratchpad = val; return; case SDHCI_COMMAND: + /*Set the CMD_TYPE of the CMD12, fix no INT in MULTI_BLK IO */ + if (host->cmd->opcode == MMC_STOP_TRANSMISSION) + val |= SDHCI_CMD_ABORTCMD; writel(val << 16 | pltfm_host->scratchpad, host->ioaddr + SDHCI_TRANSFER_MODE); return; @@ -113,7 +151,7 @@ static int esdhc_pltfm_init(struct sdhci_host *host, struct sdhci_pltfm_data *pd clk_enable(clk); pltfm_host->clk = clk; - if (cpu_is_mx35() || cpu_is_mx51()) + if (!cpu_is_mx25()) host->quirks |= SDHCI_QUIRK_BROKEN_TIMEOUT_VAL; /* Fix errata ENGcm07207 which is present on i.MX25 and i.MX35 */ @@ -133,6 +171,7 @@ static void esdhc_pltfm_exit(struct sdhci_host *host) static struct sdhci_ops sdhci_esdhc_ops = { .read_w = esdhc_readw_le, + .write_l = esdhc_writel_le, .write_w = esdhc_writew_le, .write_b = esdhc_writeb_le, .set_clock = esdhc_set_clock, diff --git a/drivers/mmc/host/sdhci-esdhc.h b/drivers/mmc/host/sdhci-esdhc.h index 303cde0..c93168c 100644 --- a/drivers/mmc/host/sdhci-esdhc.h +++ b/drivers/mmc/host/sdhci-esdhc.h @@ -43,6 +43,11 @@ #define ESDHC_HOST_CONTROL_RES 0x05 +/* Abort type definition in the command register */ +#define SDHCI_CMD_ABORTCMD 0xC0 +/* VENDOR SPEC register */ +#define SDHCI_VENDOR_SPEC 0xC0 + static inline void esdhc_set_clock(struct sdhci_host *host, unsigned int clock) { int pre_div = 2;