From patchwork Thu Apr 21 08:51:03 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Barry Song <21cnbao@gmail.com> X-Patchwork-Id: 724231 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 p3L8pPrI011578 for ; Thu, 21 Apr 2011 08:51:25 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750935Ab1DUIvY (ORCPT ); Thu, 21 Apr 2011 04:51:24 -0400 Received: from mail-qw0-f46.google.com ([209.85.216.46]:35662 "EHLO mail-qw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750784Ab1DUIvX (ORCPT ); Thu, 21 Apr 2011 04:51:23 -0400 Received: by qwk3 with SMTP id 3so742499qwk.19 for ; Thu, 21 Apr 2011 01:51:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:from:date:message-id:subject:to:cc :content-type; bh=1hseo+adwLzUzr3MfpHiVXOQL5SYp6e2gmXsQmwLdEA=; b=Gl/NYoQGtGWWVSuts387D/zgARuvYIN+ZEzLCFQLbgwfDSdKLKgBz1c+MFO3uxqer6 //+dCsZOMCAfZsWYBh8KEA9GDBeus/c4xjTeBggRuMdqDLij4foAAlo84cwPTcCLUlgn lPqxsNBz6RvaMq5TbohitngsKOnXYqLUHNl+M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:from:date:message-id:subject:to:cc:content-type; b=Cc+rC4YNjDM4U6AXByx6C1ZIBZPzq5BDo5raeOpBcNYFPfO1wDNvSYoUI0PXYBb2sR Tpwb7xIzr4CTOlQiZnbUQGwtEFfGR7YNMEhBmScEDpgibHxqH3uylU3DeWYPhpn/v9yN UAvWORG5RwrvS6Z8tZEmeVLHP92kzU1WaUCfY= Received: by 10.229.18.67 with SMTP id v3mr345743qca.100.1303375883112; Thu, 21 Apr 2011 01:51:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.229.222.85 with HTTP; Thu, 21 Apr 2011 01:51:03 -0700 (PDT) From: Barry Song <21cnbao@gmail.com> Date: Thu, 21 Apr 2011 01:51:03 -0700 Message-ID: Subject: [PATCH] sdhci: add quirk to support shared bus controller To: cjb@laptop.org, linux-mmc@vger.kernel.org Cc: bin.shi@csr.com, Binghua.Duan@csr.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]); Thu, 21 Apr 2011 08:51:25 +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 Signed-off-by: Barry Song <21cnbao@gmail.com> --- drivers/mmc/host/sdhci.c | 13 +++++++++++++ drivers/mmc/host/sdhci.h | 2 ++ include/linux/mmc/sdhci.h | 2 ++ 3 files changed, 17 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index f31077d..7b07152 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1379,6 +1379,13 @@ static void sdhci_tasklet_finish(unsigned long param) sdhci_reset(host, SDHCI_RESET_DATA); } + /* + * some controllers share data bus or other pins between multi-controller + * and need to switch the function of pins runtime + */ + if (host->quirks & SDHCI_QUIRK_SHARED_PINS) + host->ops->get_shared_pins(host); + host->mrq = NULL; host->cmd = NULL; host->data = NULL; @@ -1391,6 +1398,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->quirks & SDHCI_QUIRK_SHARED_PINS) + host->ops->get_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 85750a9..9d918a5 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -229,6 +229,8 @@ struct sdhci_ops { void (*platform_send_init_74_clocks)(struct sdhci_host *host, u8 power_mode); unsigned int (*get_ro)(struct sdhci_host *host); + unsigned int (*get_shared_pins)(struct sdhci_host *host); + unsigned int (*put_shared_pins)(struct sdhci_host *host); }; #ifdef CONFIG_MMC_SDHCI_IO_ACCESSORS diff --git a/include/linux/mmc/sdhci.h b/include/linux/mmc/sdhci.h index 83bd9f7..32ab422 100644 --- a/include/linux/mmc/sdhci.h +++ b/include/linux/mmc/sdhci.h @@ -85,6 +85,8 @@ struct sdhci_host { #define SDHCI_QUIRK_NO_HISPD_BIT (1<<29) /* Controller treats ADMA descriptors with length 0000h incorrectly */ #define SDHCI_QUIRK_BROKEN_ADMA_ZEROLEN_DESC (1<<30) +/* Controller shared data bus or other pins with other controllers */ +#define SDHCI_QUIRK_SHARED_PINS (1<<31) int irq; /* Device IRQ */ void __iomem *ioaddr; /* Mapped address */