From patchwork Tue Apr 26 03:34:20 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Barry Song <21cnbao@gmail.com> X-Patchwork-Id: 731322 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 p3Q3YfOd003903 for ; Tue, 26 Apr 2011 03:34:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757979Ab1DZDel (ORCPT ); Mon, 25 Apr 2011 23:34:41 -0400 Received: from mail-qw0-f46.google.com ([209.85.216.46]:56247 "EHLO mail-qw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757935Ab1DZDek convert rfc822-to-8bit (ORCPT ); Mon, 25 Apr 2011 23:34:40 -0400 Received: by qwk3 with SMTP id 3so97675qwk.19 for ; Mon, 25 Apr 2011 20:34:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type:content-transfer-encoding; bh=K1wOkiUNIci4D8q1aCct5faryf0YPzWvoqj3SoX6+XU=; b=udefcHSLly+nKqKuuWu1sAonVIiTfSCXkJsqm42eoqKDn12V9EdIVJpjRD/QVOrKC7 /dbwk7RkoF8GVIPC/EqzgYZWFt+ViwOu9Zr8dNngB9AUsyVkw4WrzN+W1oRCcY4O4gaf 6YMhVhHngD9q7XjHr9EUkzUlo72FIrRYdT2+Y= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=KKOxv4qt4RvoSIUikt/Ezljz658cWQ1f2NVry/w5+/bQ8qVoQSftbHyS6Z9zkJi52W e8+3kgVSDQNNqeGU/KW7+/hrTWySnSzEK7bj9BGzX1mg4JWn0HHmo3NUnXH8yAB6i03k X2jAdPxYGf3VI6pHv1Jg6ohubblYYN3X9BFcg= Received: by 10.229.137.149 with SMTP id w21mr180255qct.59.1303788880124; Mon, 25 Apr 2011 20:34:40 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.184.12 with HTTP; Mon, 25 Apr 2011 20:34:20 -0700 (PDT) In-Reply-To: <5EB3BFCD089AD643B9BB63439F5FD5E9A127@SHAASIEXM01.ASIA.ROOT.PRI> References: <5EB3BFCD089AD643B9BB63439F5FD5E9A127@SHAASIEXM01.ASIA.ROOT.PRI> From: Barry Song <21cnbao@gmail.com> Date: Tue, 26 Apr 2011 11:34:20 +0800 Message-ID: Subject: [PATCH] mmc:sdhci:add support to request/free pins for controllers sharing hardware bus To: cjb@laptop.org, linux-mmc@vger.kernel.org Cc: Binghua.Duan@csr.com, andreiw@motorola.com, prakity@marvell.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, 26 Apr 2011 03:35:09 +0000 (UTC) From: Bin Shi some controllers share data bus or other pins between multi-controllers and need to switch the functions of shared pins runtime. this patch requested those shared pins before actual hardware access and release them after access Signed-off-by: Bin Shi Cc: Binghua Duan Cc: Andrei Warkentin Cc: Philip Rakity Signed-off-by: Barry Song <21cnbao@gmail.com> ---  drivers/mmc/host/sdhci.c |   13 +++++++++++++  drivers/mmc/host/sdhci.h |    2 ++  2 files changed, 15 insertions(+), 0 deletions(-) -- 1.7.1 -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index f70e21e..92ae9f7 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1143,6 +1143,13 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)        host = mmc_priv(mmc); +       /* +        * some controllers share data bus or other pins between multi-controller +        * and need to switch the function of pins runtime +        */ +       if (host->ops->get_shared_pins) +               host->ops->get_shared_pins(host); +        spin_lock_irqsave(&host->lock, flags);        WARN_ON(host->mrq != NULL); @@ -1417,6 +1424,12 @@ static void sdhci_tasklet_finish(unsigned long param)        spin_unlock_irqrestore(&host->lock, flags);        mmc_request_done(host->mmc, mrq); + +       /* +        * release shared pins so that other controllers can use them +        */ +       if (host->ops->put_shared_pins) +               host->ops->put_shared_pins(host);  }  static void sdhci_timeout_timer(unsigned long data) diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index c6e25a7..5a26cfe 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -231,6 +231,8 @@ struct sdhci_ops {        unsigned int    (*get_ro)(struct sdhci_host *host);        void    (*platform_reset_enter)(struct sdhci_host *host, u8 mask);        void    (*platform_reset_exit)(struct sdhci_host *host, u8 mask); +       unsigned int    (*get_shared_pins)(struct sdhci_host *host); +       unsigned int    (*put_shared_pins)(struct sdhci_host *host);  };  #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS