From patchwork Fri Sep 21 03:07:47 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kevin Liu X-Patchwork-Id: 1489131 Return-Path: X-Original-To: patchwork-linux-mmc@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id C9C78DF28C for ; Fri, 21 Sep 2012 03:12:48 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932641Ab2IUDMs (ORCPT ); Thu, 20 Sep 2012 23:12:48 -0400 Received: from na3sys009aog104.obsmtp.com ([74.125.149.73]:60561 "EHLO na3sys009aog104.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932102Ab2IUDMr (ORCPT ); Thu, 20 Sep 2012 23:12:47 -0400 Received: from MSI-MTA.marvell.com ([65.219.4.132]) (using TLSv1) by na3sys009aob104.postini.com ([74.125.148.12]) with SMTP ID DSNKUFvbK68v2LgHZFsVbqzb0hfps6L9qbVQ@postini.com; Thu, 20 Sep 2012 20:12:47 PDT Received: from maili.marvell.com ([10.68.76.210]) by MSI-MTA.marvell.com with Microsoft SMTPSVC(6.0.3790.3959); Thu, 20 Sep 2012 20:12:28 -0700 Received: from localhost.localdomain (unknown [10.38.36.240]) by maili.marvell.com (Postfix) with ESMTP id 3971D4E510; Thu, 20 Sep 2012 20:12:27 -0700 (PDT) From: Kevin Liu To: linux-mmc@vger.kernel.org, cjb@laptop.org, pierre@ossman.eu, ulf.hansson@linaro.org Cc: hzhuang1@marvell.com, cxie4@marvell.com, prakity@marvell.com, kliu5@marvell.com Subject: [RFC/PATCH v2 3/3] mmc: sdhci: add asynchronous interrupt support Date: Fri, 21 Sep 2012 11:07:47 +0800 Message-Id: <1348196867-15145-4-git-send-email-keyuan.liu@gmail.com> X-Mailer: git-send-email 1.7.0.4 In-Reply-To: <1348196867-15145-1-git-send-email-keyuan.liu@gmail.com> References: <1348196867-15145-1-git-send-email-keyuan.liu@gmail.com> X-OriginalArrivalTime: 21 Sep 2012 03:12:28.0501 (UTC) FILETIME=[EE7AE850:01CD97A6] Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org From: Kevin Liu If host support asynchronous interrupt and sdio device has enabled it, then enable/disable asynchronous interrupt on host when enable/disable sdio irq. Signed-off-by: Kevin Liu Reviewed-by: Ulf Hansson --- drivers/mmc/host/sdhci.c | 15 +++++++++++++++ drivers/mmc/host/sdhci.h | 2 ++ 2 files changed, 17 insertions(+), 0 deletions(-) diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index e01536a..cd74009 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -1634,6 +1634,8 @@ static int sdhci_get_ro(struct mmc_host *mmc) static void sdhci_enable_sdio_irq_nolock(struct sdhci_host *host, int enable) { + u16 ctrl; + if (host->flags & SDHCI_DEVICE_DEAD) goto out; @@ -1642,6 +1644,15 @@ static void sdhci_enable_sdio_irq_nolock(struct sdhci_host *host, int enable) else host->flags &= ~SDHCI_SDIO_IRQ_ENABLED; + if (mmc_card_async_int(host->mmc->card)) { + ctrl = sdhci_readw(host, SDHCI_HOST_CONTROL2); + if (enable) + ctrl |= SDHCI_CTRL_ASYNC_INT_ENABLE; + else + ctrl &= ~SDHCI_CTRL_ASYNC_INT_ENABLE; + sdhci_writew(host, ctrl, SDHCI_HOST_CONTROL2); + } + /* SDIO IRQ will be enabled as appropriate in runtime resume */ if (host->runtime_suspended) goto out; @@ -2952,6 +2963,10 @@ int sdhci_add_host(struct sdhci_host *host) else mmc->power_notify_type = MMC_HOST_PW_NOTIFY_NONE; + /* Does the host support async int? */ + if (caps[0] & SDHCI_CAN_ASYNC_INT) + mmc->caps2 |= MMC_CAP2_ASYNC_INT; + /* Initial value for re-tuning timer count */ host->tuning_count = (caps[1] & SDHCI_RETUNING_TIMER_COUNT_MASK) >> SDHCI_RETUNING_TIMER_COUNT_SHIFT; diff --git a/drivers/mmc/host/sdhci.h b/drivers/mmc/host/sdhci.h index 5eb27bf..f9de65e 100644 --- a/drivers/mmc/host/sdhci.h +++ b/drivers/mmc/host/sdhci.h @@ -167,6 +167,7 @@ #define SDHCI_CTRL_DRV_TYPE_D 0x0030 #define SDHCI_CTRL_EXEC_TUNING 0x0040 #define SDHCI_CTRL_TUNED_CLK 0x0080 +#define SDHCI_CTRL_ASYNC_INT_ENABLE 0x4000 #define SDHCI_CTRL_PRESET_VAL_ENABLE 0x8000 #define SDHCI_CAPABILITIES 0x40 @@ -187,6 +188,7 @@ #define SDHCI_CAN_VDD_300 0x02000000 #define SDHCI_CAN_VDD_180 0x04000000 #define SDHCI_CAN_64BIT 0x10000000 +#define SDHCI_CAN_ASYNC_INT 0x20000000 #define SDHCI_SUPPORT_SDR50 0x00000001 #define SDHCI_SUPPORT_SDR104 0x00000002