From patchwork Wed Jun 1 08:48:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Per Forlin X-Patchwork-Id: 837252 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p518o4ET027294 for ; Wed, 1 Jun 2011 08:50:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757243Ab1FAIt4 (ORCPT ); Wed, 1 Jun 2011 04:49:56 -0400 Received: from eu1sys200aog115.obsmtp.com ([207.126.144.139]:47334 "EHLO eu1sys200aog115.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758264Ab1FAIty (ORCPT ); Wed, 1 Jun 2011 04:49:54 -0400 Received: from beta.dmz-ap.st.com ([138.198.100.35]) (using TLSv1) by eu1sys200aob115.postini.com ([207.126.147.11]) with SMTP ID DSNKTeX9IsC0rk9d+OUwz8/F72WcQfuvwpmH@postini.com; Wed, 01 Jun 2011 08:49:53 UTC Received: from zeta.dmz-ap.st.com (ns6.st.com [138.198.234.13]) by beta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 32F8BF7; Wed, 1 Jun 2011 08:49:36 +0000 (GMT) Received: from relay1.stm.gmessaging.net (unknown [10.230.100.17]) by zeta.dmz-ap.st.com (STMicroelectronics) with ESMTP id 0998CB59; Wed, 1 Jun 2011 08:49:35 +0000 (GMT) Received: from exdcvycastm003.EQ1STM.local (alteon-source-exch [10.230.100.61]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "exdcvycastm003", Issuer "exdcvycastm003" (not verified)) by relay1.stm.gmessaging.net (Postfix) with ESMTPS id 3DBC824C07C; Wed, 1 Jun 2011 10:49:29 +0200 (CEST) Received: from localhost.localdomain (10.230.100.153) by smtp.stericsson.com (10.230.100.1) with Microsoft SMTP Server (TLS) id 8.3.83.0; Wed, 1 Jun 2011 10:49:34 +0200 From: Per Forlin To: , , Nicolas Pitre , , Daniel Drake , Linus Walleij Cc: Chris Ball , Per Forlin Subject: [PATCH v2 1/2] sdio: add quirk to handle pending IRQ in case of none CCCR_INTx bits Date: Wed, 1 Jun 2011 10:48:32 +0200 Message-ID: <1306918113-23872-2-git-send-email-per.forlin@stericsson.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1306918113-23872-1-git-send-email-per.forlin@stericsson.com> References: <1306918113-23872-1-git-send-email-per.forlin@stericsson.com> MIME-Version: 1.0 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 (demeter2.kernel.org [140.211.167.43]); Wed, 01 Jun 2011 08:50:04 +0000 (UTC) From: Per Forlin Add quirk MMC_QUIRK_SDIO_IRQ_CCCR_INTX_0 to handle SDIO device that may have pending IRQ when none bits are set in CCCR_INTx. This IRQ issue was identified in the libertas sdio driver where the SDIO device seems to raise an interrupt even if there were none function bits in CCCR_INTx set. SDIO single irq feature will call irq handler directly in case of only one interrupt registered. It will not check the CCCR_INTx register and miss if the register is 0 and call the irq handler anyway. This IRQ issue is not defined by the SDIO spec. Use this quirk to work around this SDIO IRQ issue for a specific device. Signed-off-by: Per Forlin --- drivers/mmc/core/sdio_irq.c | 4 ++-- include/linux/mmc/card.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/sdio_irq.c b/drivers/mmc/core/sdio_irq.c index 03ead02..df1e946 100644 --- a/drivers/mmc/core/sdio_irq.c +++ b/drivers/mmc/core/sdio_irq.c @@ -204,7 +204,8 @@ static void sdio_single_irq_set(struct mmc_card *card) int i; card->sdio_single_irq = NULL; - if ((card->host->caps & MMC_CAP_SDIO_IRQ) && + if (!(card->quirks & MMC_QUIRK_SDIO_IRQ_CCCR_INTX_0) && + (card->host->caps & MMC_CAP_SDIO_IRQ) && card->host->sdio_irqs == 1) for (i = 0; i < card->sdio_funcs; i++) { func = card->sdio_func[i]; @@ -301,4 +302,3 @@ int sdio_release_irq(struct sdio_func *func) return 0; } EXPORT_SYMBOL_GPL(sdio_release_irq); - diff --git a/include/linux/mmc/card.h b/include/linux/mmc/card.h index 7b4fd7b..852021c 100644 --- a/include/linux/mmc/card.h +++ b/include/linux/mmc/card.h @@ -175,6 +175,7 @@ struct mmc_card { #define MMC_QUIRK_DISABLE_CD (1<<5) /* disconnect CD/DAT[3] resistor */ #define MMC_QUIRK_INAND_CMD38 (1<<6) /* iNAND devices have broken CMD38 */ #define MMC_QUIRK_BLK_NO_CMD23 (1<<7) /* Avoid CMD23 for regular multiblock */ +#define MMC_QUIRK_SDIO_IRQ_CCCR_INTX_0 (1<<7) /* SDIO card has IRQ even if CCCR_INTx is 0 */ unsigned int erase_size; /* erase size in sectors */ unsigned int erase_shift; /* if erase unit is power 2 */