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: 1699 Return-Path: Delivered-To: unknown Received: from imap.gmail.com (74.125.159.109) by localhost6.localdomain6 with IMAP4-SSL; 08 Jun 2011 14:54:30 -0000 Delivered-To: patches@linaro.org Received: by 10.52.181.10 with SMTP id ds10cs295248vdc; Wed, 1 Jun 2011 01:49:54 -0700 (PDT) Received: by 10.213.15.141 with SMTP id k13mr1760150eba.144.1306918193743; Wed, 01 Jun 2011 01:49:53 -0700 (PDT) Received: from eu1sys200aog115.obsmtp.com (eu1sys200aog115.obsmtp.com [207.126.144.139]) by mx.google.com with SMTP id q55si2338276eef.90.2011.06.01.01.49.44 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 01 Jun 2011 01:49:53 -0700 (PDT) Received-SPF: neutral (google.com: 207.126.144.139 is neither permitted nor denied by best guess record for domain of per.forlin@stericsson.com) client-ip=207.126.144.139; Authentication-Results: mx.google.com; spf=neutral (google.com: 207.126.144.139 is neither permitted nor denied by best guess record for domain of per.forlin@stericsson.com) smtp.mail=per.forlin@stericsson.com 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 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 */