Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753208AbdDKKiE (ORCPT ); Tue, 11 Apr 2017 06:38:04 -0400 Received: from mga09.intel.com ([134.134.136.24]:43501 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752498AbdDKKhG (ORCPT ); Tue, 11 Apr 2017 06:37:06 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.37,185,1488873600"; d="scan'208";a="1118128657" Subject: Re: [PATCH 2/2] mmc: sdhci: provide isr for card-detect interrupts To: Jisheng Zhang , ulf.hansson@linaro.org References: <20170411102056.2869-1-jszhang@marvell.com> <20170411102056.2869-3-jszhang@marvell.com> Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: <772c085c-beba-cfe8-23ca-0c46a96145fe@intel.com> Date: Tue, 11 Apr 2017 13:31:16 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: <20170411102056.2869-3-jszhang@marvell.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1788 Lines: 54 On 11/04/17 13:20, Jisheng Zhang wrote: > We found one issue on BG4CT platforms with GPIO for sdcar card detect > interrupt: remove sdcard when there's read write access to the sdcard, > sometimes the card remove event can't be handled for a long time, so > the system still think the sdcard is still plugged in. It turns out > that the sdhci_card_event() is missing in common slot gpio's card > detect isr. ->card_event() is called by mmc_rescan(). Why is that too late? > > We fix this issue by providing sdhci's own isr for card-detect > interrupts. In this own isr, we call sdhci_card_event() then process > the change of state. Why doesn't every other host controller have this problem? > > Signed-off-by: Jisheng Zhang > --- > drivers/mmc/host/sdhci.c | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c > index 63bc33a54d0d..b6c5021a5892 100644 > --- a/drivers/mmc/host/sdhci.c > +++ b/drivers/mmc/host/sdhci.c > @@ -2777,6 +2777,16 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id) > return result; > } > > +static irqreturn_t sdhci_cd_irq(int irq, void *dev_id) > +{ > + struct mmc_host *mmc = dev_id; > + struct sdhci_host *host = mmc_priv(mmc); > + > + mmc->ops->card_event(mmc); > + mmc_detect_change(host->mmc, msecs_to_jiffies(200)); > + return IRQ_HANDLED; > +} > + > static irqreturn_t sdhci_thread_irq(int irq, void *dev_id) > { > struct sdhci_host *host = dev_id; > @@ -3617,6 +3627,8 @@ int __sdhci_add_host(struct sdhci_host *host) > > sdhci_init(host, 0); > > + mmc_gpio_set_cd_isr(mmc, sdhci_cd_irq); > + > ret = request_threaded_irq(host->irq, sdhci_irq, sdhci_thread_irq, > IRQF_SHARED, mmc_hostname(mmc), host); > if (ret) { >