From patchwork Wed Sep 1 09:47:47 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Zhu X-Patchwork-Id: 177732 Return-path: X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on void.printf.net X-Spam-Level: X-Spam-Status: No, score=-1.0 required=2.9 tests=RCVD_IN_DNSWL_LOW autolearn=disabled version=3.2.5 Envelope-to: chris@printf.net Delivery-date: Wed, 01 Sep 2010 11:01:13 +0100 Received: from lists.laptop.org ([18.85.2.145] helo=mail.laptop.org) by void.printf.net with esmtp (Exim 4.69) (envelope-from ) id 1Oqk80-00073J-Q9 for chris@printf.net; Wed, 01 Sep 2010 11:01:13 +0100 Received: by mail.laptop.org (Postfix) id A066824562; Wed, 1 Sep 2010 06:00:39 -0400 (EDT) Delivered-To: cjb@laptop.org Received: from spam.laptop.org (spam.laptop.org [18.85.46.23]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.laptop.org (Postfix) with ESMTPS id 2EFA024591 for ; Wed, 1 Sep 2010 06:00:09 -0400 (EDT) X-ASG-Debug-ID: 1283335222-0b74ca210001-zHW3sV Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by spam.laptop.org with ESMTP id vHeuGbKHTD9O0RSu for ; Wed, 01 Sep 2010 06:00:23 -0400 (EDT) X-Barracuda-Envelope-From: linux-mmc-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752379Ab0IAKAW (ORCPT ); Wed, 1 Sep 2010 06:00:22 -0400 Received: from db3ehsobe006.messaging.microsoft.com ([213.199.154.144]:52857 "EHLO DB3EHSOBE006.bigfish.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752155Ab0IAKAV (ORCPT ); Wed, 1 Sep 2010 06:00:21 -0400 Received: from mail26-db3-R.bigfish.com (10.3.81.249) by DB3EHSOBE006.bigfish.com (10.3.84.26) with Microsoft SMTP Server id 8.1.436.0; Wed, 1 Sep 2010 09:45:16 +0000 Received: from mail26-db3 (localhost.localdomain [127.0.0.1]) by mail26-db3-R.bigfish.com (Postfix) with ESMTP id E226A18006E6 for ; Wed, 1 Sep 2010 09:53:37 +0000 (UTC) X-SpamScore: -2 X-BigFish: VS-2(zzbb2cKzz1202hzz8275bh1497iz2dh87h2a8h62h) X-FB-DOMAIN-IP-MATCH: fail Received: from mail26-db3 (localhost.localdomain [127.0.0.1]) by mail26-db3 (MessageSwitch) id 1283334817206715_20413; Wed, 1 Sep 2010 09:53:37 +0000 (UTC) Received: from DB3EHSMHS005.bigfish.com (unknown [10.3.81.246]) by mail26-db3.bigfish.com (Postfix) with ESMTP id 231B45E004C for ; Wed, 1 Sep 2010 09:53:37 +0000 (UTC) Received: from az33egw02.freescale.net (192.88.158.103) by DB3EHSMHS005.bigfish.com (10.3.87.105) with Microsoft SMTP Server (TLS) id 14.0.482.44; Wed, 1 Sep 2010 09:45:13 +0000 Received: from de01smr01.freescale.net (de01smr01.freescale.net [10.208.0.31]) by az33egw02.freescale.net (8.14.3/8.14.3) with ESMTP id o819jBd8002353 for ; Wed, 1 Sep 2010 02:45:11 -0700 (MST) Received: from shlinux1.ap.freescale.net ([10.192.225.216]) by de01smr01.freescale.net (8.13.1/8.13.0) with ESMTP id o819wtvr024263 for ; Wed, 1 Sep 2010 04:58:55 -0500 (CDT) Received: by shlinux1.ap.freescale.net (Postfix, from userid 1003) id E34554D6001; Wed, 1 Sep 2010 17:47:48 +0800 (CST) From: Richard Zhu To: linux-mmc@vger.kernel.org CC: kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org, Richard Zhu X-ASG-Orig-Subj: [PATCH 3/9] sdhci-3:add the NONSTANDARD_HOST_CTL quirk to support FSl eSDHC Subject: [PATCH 3/9] sdhci-3:add the NONSTANDARD_HOST_CTL quirk to support FSl eSDHC Date: Wed, 1 Sep 2010 17:47:47 +0800 Message-ID: <1283334467-12602-1-git-send-email-r65037@freescale.com> X-Mailer: git-send-email 1.6.3.3 MIME-Version: 1.0 X-Reverse-DNS: az33egw02.freescale.net Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Barracuda-Connect: vger.kernel.org[209.132.180.67] X-Barracuda-Start-Time: 1283335222 X-Barracuda-URL: http://18.85.46.23:8000/cgi-mod/mark.cgi X-Virus-Scanned: by bsmtpd at laptop.org X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=3.5 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=5.5 tests=MAILTO_TO_SPAM_ADDR X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.2.39600 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- 0.00 MAILTO_TO_SPAM_ADDR URI: Includes a link to a likely spammer email diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index e7e2611..2bfe738 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -777,7 +777,13 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data) * (e.g. JMicron) can't do PIO properly when the selection * is ADMA. */ - if (host->version >= SDHCI_SPEC_200) { + if (host->quirks & SDHCI_QUIRK_NONSTANDARD_HOST_CTL) { + if (host->ops->enable_dma) + host->ops->enable_dma(host); + else + printk(KERN_ERR "%s: Failed to enable DMA!\n", + mmc_hostname(host->mmc)); + } else if (host->version >= SDHCI_SPEC_200) { ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL); ctrl &= ~SDHCI_CTRL_DMA_MASK; if ((host->flags & SDHCI_REQ_USE_DMA) && @@ -1173,24 +1179,33 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) else sdhci_set_power(host, ios->vdd); - ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL); - if (ios->bus_width == MMC_BUS_WIDTH_8) - ctrl |= SDHCI_CTRL_8BITBUS; - else - ctrl &= ~SDHCI_CTRL_8BITBUS; + if (host->quirks & SDHCI_QUIRK_NONSTANDARD_HOST_CTL) { - if (ios->bus_width == MMC_BUS_WIDTH_4) - ctrl |= SDHCI_CTRL_4BITBUS; - else - ctrl &= ~SDHCI_CTRL_4BITBUS; + if (host->ops->set_bus) + host->ops->set_bus(host, ios->bus_width); + else + printk(KERN_ERR "Invalided BUS configurations!\n"); + } else { + ctrl = sdhci_readb(host, SDHCI_HOST_CONTROL); - if (ios->timing == MMC_TIMING_SD_HS) - ctrl |= SDHCI_CTRL_HISPD; - else - ctrl &= ~SDHCI_CTRL_HISPD; + if (ios->bus_width == MMC_BUS_WIDTH_8) + ctrl |= SDHCI_CTRL_8BITBUS; + else + ctrl &= ~SDHCI_CTRL_8BITBUS; - sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL); + if (ios->bus_width == MMC_BUS_WIDTH_4) + ctrl |= SDHCI_CTRL_4BITBUS; + else + ctrl &= ~SDHCI_CTRL_4BITBUS; + + if (ios->timing == MMC_TIMING_SD_HS) + ctrl |= SDHCI_CTRL_HISPD; + else + ctrl &= ~SDHCI_CTRL_HISPD; + + sdhci_writeb(host, ctrl, SDHCI_HOST_CONTROL); + } /* * Some (ENE) controllers go apeshit on some ios operation, diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index a4db2cc..029ab0e 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -245,6 +245,8 @@ struct sdhci_host { #define SDHCI_QUIRK_MISSING_CAPS (1<<27) /* Controller uses Auto CMD12 command to stop the transfer */ #define SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12 (1<<28) +/* Controller doesn't have the standard Host Control registor */ +#define SDHCI_QUIRK_NONSTANDARD_HOST_CTL (1<<29) int irq; /* Device IRQ */ void __iomem * ioaddr; /* Mapped address */ @@ -317,6 +319,7 @@ struct sdhci_ops { void (*set_clock)(struct sdhci_host *host, unsigned int clock); void (*set_power)(struct sdhci_host *host, unsigned int power); + void (*set_bus)(struct sdhci_host *host, unsigned int bus); int (*enable_dma)(struct sdhci_host *host); unsigned int (*get_max_clock)(struct sdhci_host *host);