From patchwork Wed Jul 17 10:11:30 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Haijun.Zhang@freescale.com X-Patchwork-Id: 2828529 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E30E5C0AB2 for ; Wed, 17 Jul 2013 11:02:44 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7AD6220182 for ; Wed, 17 Jul 2013 11:02:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B9B0220181 for ; Wed, 17 Jul 2013 11:02:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753412Ab3GQLCi (ORCPT ); Wed, 17 Jul 2013 07:02:38 -0400 Received: from mail-db9lp0253.outbound.messaging.microsoft.com ([213.199.154.253]:1041 "EHLO db9outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753249Ab3GQLCh (ORCPT ); Wed, 17 Jul 2013 07:02:37 -0400 Received: from mail122-db9-R.bigfish.com (10.174.16.229) by DB9EHSOBE033.bigfish.com (10.174.14.96) with Microsoft SMTP Server id 14.1.225.22; Wed, 17 Jul 2013 11:02:36 +0000 Received: from mail122-db9 (localhost [127.0.0.1]) by mail122-db9-R.bigfish.com (Postfix) with ESMTP id EDCAE300156; Wed, 17 Jul 2013 11:02: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: 1 X-BigFish: VS1(zzzz1f42h1ee6h1de0h1fdah2073h1202h1e76h1d1ah1d2ah1fc6hzd2iz8275bhz2dh2a8h668h839he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1d0ch1d2eh1d3fh1dfeh1dffh1e23h1155h) Received: from mail122-db9 (localhost.localdomain [127.0.0.1]) by mail122-db9 (MessageSwitch) id 1374058953872427_16495; Wed, 17 Jul 2013 11:02:33 +0000 (UTC) Received: from DB9EHSMHS013.bigfish.com (unknown [10.174.16.240]) by mail122-db9.bigfish.com (Postfix) with ESMTP id C6EFE420047; Wed, 17 Jul 2013 11:02:33 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by DB9EHSMHS013.bigfish.com (10.174.14.23) with Microsoft SMTP Server (TLS) id 14.16.227.3; Wed, 17 Jul 2013 11:02:32 +0000 Received: from az84smr01.freescale.net (10.64.34.197) by 039-SN1MMR1-005.039d.mgd.msft.net (10.84.1.17) with Microsoft SMTP Server (TLS) id 14.3.136.1; Wed, 17 Jul 2013 11:02:28 +0000 Received: from rock.am.freescale.net (rock.ap.freescale.net [10.193.20.106]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id r6HB2LTR021877; Wed, 17 Jul 2013 04:02:25 -0700 From: Haijun Zhang To: , CC: , , , , Haijun Zhang , Haijun Zhang Subject: [PATCH 3/4 V2] mmc: esdhc: Correct host version of T4240-R1.0 Date: Wed, 17 Jul 2013 18:11:30 +0800 Message-ID: <1374055891-20703-2-git-send-email-Haijun.Zhang@freescale.com> X-Mailer: git-send-email 1.8.0 In-Reply-To: <1374055891-20703-1-git-send-email-Haijun.Zhang@freescale.com> References: <1374055891-20703-1-git-send-email-Haijun.Zhang@freescale.com> MIME-Version: 1.0 X-OriginatorOrg: freescale.com X-FOPE-CONNECTOR: Id%0$Dn%*$RO%0$TLS%0$FQDN%$TlsDn% Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Vender version and sdhc spec version of T4240-R1.0 is incorrect. The right value should be VVN=0x13, SVN = 0x1. The wrong version number will break down the ADMA data transfer. This defect only exist in T4240-R1.0. Will be fixed in T4240-R2.0. Also share vvn and svr for public use. Signed-off-by: Haijun Zhang --- changes for V2: - Remove broken ADMA quirk. - Rebuild patch of Add quirks to support T4240 board drivers/mmc/host/sdhci-of-esdhc.c | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/drivers/mmc/host/sdhci-of-esdhc.c b/drivers/mmc/host/sdhci-of-esdhc.c index adfaadd..570bca8 100644 --- a/drivers/mmc/host/sdhci-of-esdhc.c +++ b/drivers/mmc/host/sdhci-of-esdhc.c @@ -26,7 +26,7 @@ #define VENDOR_V_22 0x12 #define VENDOR_V_23 0x13 -static u32 svr; +static u32 svr, vvn; static u32 esdhc_readl(struct sdhci_host *host, int reg) { @@ -43,11 +43,9 @@ static u32 esdhc_readl(struct sdhci_host *host, int reg) * For FSL eSDHC, must aligned 4-byte, so use 0xFC to read the * the verdor version number, oxFE is SDHCI_HOST_VERSION. */ - if ((reg == SDHCI_CAPABILITIES) && (ret & SDHCI_CAN_DO_ADMA1)) { - u32 tmp = in_be32(host->ioaddr + SDHCI_SLOT_INT_STATUS); - tmp = (tmp & SDHCI_VENDOR_VER_MASK) >> SDHCI_VENDOR_VER_SHIFT; - if (tmp > VENDOR_V_22) - ret |= SDHCI_CAN_DO_ADMA2; + if ((reg == SDHCI_CAPABILITIES) && (ret & SDHCI_CAN_DO_ADMA1) && + (vvn > VENDOR_V_22)) { + ret |= SDHCI_CAN_DO_ADMA2; } return ret; @@ -63,6 +61,12 @@ static u16 esdhc_readw(struct sdhci_host *host, int reg) ret = in_be32(host->ioaddr + base) & 0xffff; else ret = (in_be32(host->ioaddr + base) >> shift) & 0xffff; + + /* T4240-R1.0 had a incorrect vendor version and spec version */ + if ((reg == SDHCI_HOST_VERSION) && + ((SVR_SOC_VER(svr) == SVR_T4240) && (SVR_REV(svr) == 0x10))) + ret = (VENDOR_V_23 << SDHCI_VENDOR_VER_SHIFT) | SDHCI_SPEC_200; + return ret; } @@ -175,17 +179,12 @@ static void esdhc_reset(struct sdhci_host *host, u8 mask) */ static void esdhci_of_adma_workaround(struct sdhci_host *host, u32 intmask) { - u32 tmp; bool applicable; dma_addr_t dmastart; dma_addr_t dmanow; - tmp = esdhc_readl(host, SDHCI_SLOT_INT_STATUS); - tmp = (tmp & SDHCI_VENDOR_VER_MASK) >> SDHCI_VENDOR_VER_SHIFT; - applicable = (intmask & SDHCI_INT_DATA_END) && - (intmask & SDHCI_INT_BLK_GAP) && - (tmp == VENDOR_V_23); + (intmask & SDHCI_INT_BLK_GAP) && (vvn == VENDOR_V_23); if (applicable) { esdhc_reset(host, SDHCI_RESET_DATA); @@ -318,10 +317,9 @@ static void esdhc_of_resume(struct sdhci_host *host) static void esdhc_of_platform_init(struct sdhci_host *host) { - u32 vvn; + svr = mfspr(SPRN_SVR); + vvn = esdhc_readw(host, SDHCI_HOST_VERSION); - vvn = in_be32(host->ioaddr + SDHCI_SLOT_INT_STATUS); - vvn = (vvn & SDHCI_VENDOR_VER_MASK) >> SDHCI_VENDOR_VER_SHIFT; if (vvn == VENDOR_V_22) host->quirks2 |= SDHCI_QUIRK2_HOST_NO_CMD23; @@ -390,7 +388,6 @@ static int sdhci_esdhc_probe(struct platform_device *pdev) struct device_node *np; int ret; - svr = mfspr(SPRN_SVR); host = sdhci_pltfm_init(pdev, &sdhci_esdhc_pdata, 0); if (IS_ERR(host)) return PTR_ERR(host);