From patchwork Tue Apr 18 12:32:03 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 97538 Delivered-To: patches@linaro.org Received: by 10.140.109.52 with SMTP id k49csp1781723qgf; Tue, 18 Apr 2017 05:32:09 -0700 (PDT) X-Received: by 10.28.181.69 with SMTP id e66mr12765426wmf.33.1492518729802; Tue, 18 Apr 2017 05:32:09 -0700 (PDT) Return-Path: Received: from mail-wr0-x22c.google.com (mail-wr0-x22c.google.com. [2a00:1450:400c:c0c::22c]) by mx.google.com with ESMTPS id j11si20424531wre.322.2017.04.18.05.32.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 18 Apr 2017 05:32:09 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:400c:c0c::22c as permitted sender) client-ip=2a00:1450:400c:c0c::22c; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:400c:c0c::22c as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-wr0-x22c.google.com with SMTP id z109so101438836wrb.1 for ; Tue, 18 Apr 2017 05:32:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=AGT0Aakzo+3yGNoY2GynhnXyMMNm1Vw7P3ymfGQq6Nw=; b=KrDrLVRnbxSoELh4tqL3gcyGtkQ68adoO4KfqjOG8taRKEtg5pBtrsivzQvZqSwJDF 7BkNcIcoQAB9NKrq4BUK5u4JpQc82IwUF3Ya97cwEgHLm2g8XAJMHu6khqFeeTnPFnHl qur8LWAnKyItvT/dH6Dgp6uP8rFbxtuPXdcLs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=AGT0Aakzo+3yGNoY2GynhnXyMMNm1Vw7P3ymfGQq6Nw=; b=By0E6iYn1UEHj2EUiWvUCxwTUTgcF90h+2gH63fmF2GQvPQVjsr4b9C8IARsvwCqxX c4OeL+yFU2e00uDmfxwzJycmgQMY2YAhwVgxwiTB7i7UeECgktCj55JUyv8xPrYBk4XP cOuKemRjb7i6lJ6ZUM8i4pnEO5MVtrZAjceqnJCKr2osKCr/CkZoYJz2ebn1cXeYm3R+ dFHl73VMjkXjyMTfokv8Y0BhzDm74dA1V8Z1qVOf2R7nYWWN/tYKubf6IJxvoy8YiVGi xUfnel0N6xFQPuyj/9NCQpBLHYsGOl3fvLNZoT5bTJaWPMBUp/GuX++602mPKEcfPRMv p7KA== X-Gm-Message-State: AN3rC/5ZaYWE+2tLLwW4W/cMpmsq7qk3BJV+3F3eNW8ztMqnSRIIwi5/ KDsx4WGYtkK7ebyIJkU= X-Received: by 10.223.134.118 with SMTP id 51mr6720883wrw.75.1492518729477; Tue, 18 Apr 2017 05:32:09 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-155-4-221-67.na.cust.bahnhof.se. [155.4.221.67]) by smtp.gmail.com with ESMTPSA id 135sm2528372wmi.1.2017.04.18.05.32.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 18 Apr 2017 05:32:08 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Jaehoon Chung , Adrian Hunter , Brian Norris , Shawn Lin , Doug Anderson Subject: [PATCH 2/3] mmc: dw_mmc: Convert to use MMC_CAP2_SDIO_IRQ_NOTHREAD for SDIO IRQs Date: Tue, 18 Apr 2017 14:32:03 +0200 Message-Id: <1492518724-30511-3-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1492518724-30511-1-git-send-email-ulf.hansson@linaro.org> References: <1492518724-30511-1-git-send-email-ulf.hansson@linaro.org> Convert to use the more lightweight method for processing SDIO IRQs, which involves the following changes: - Enable MMC_CAP2_SDIO_IRQ_NOTHREAD when SDIO IRQ is supported. - Mask SDIO IRQ when signaling it for processing. - Re-enable (unmask) the SDIO IRQ from the ->ack_sdio_irq() callback. Signed-off-by: Ulf Hansson --- drivers/mmc/host/dw_mmc.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index 249ded6..f086791 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -1635,9 +1635,8 @@ static void dw_mci_init_card(struct mmc_host *mmc, struct mmc_card *card) } } -static void dw_mci_enable_sdio_irq(struct mmc_host *mmc, int enb) +static void __dw_mci_enable_sdio_irq(struct dw_mci_slot *slot, int enb) { - struct dw_mci_slot *slot = mmc_priv(mmc); struct dw_mci *host = slot->host; unsigned long irqflags; u32 int_mask; @@ -1655,6 +1654,20 @@ static void dw_mci_enable_sdio_irq(struct mmc_host *mmc, int enb) spin_unlock_irqrestore(&host->irq_lock, irqflags); } +static void dw_mci_enable_sdio_irq(struct mmc_host *mmc, int enb) +{ + struct dw_mci_slot *slot = mmc_priv(mmc); + + __dw_mci_enable_sdio_irq(slot, enb); +} + +static void dw_mci_ack_sdio_irq(struct mmc_host *mmc) +{ + struct dw_mci_slot *slot = mmc_priv(mmc); + + __dw_mci_enable_sdio_irq(slot, 1); +} + static int dw_mci_execute_tuning(struct mmc_host *mmc, u32 opcode) { struct dw_mci_slot *slot = mmc_priv(mmc); @@ -1756,6 +1769,7 @@ static const struct mmc_host_ops dw_mci_ops = { .get_cd = dw_mci_get_cd, .hw_reset = dw_mci_hw_reset, .enable_sdio_irq = dw_mci_enable_sdio_irq, + .ack_sdio_irq = dw_mci_ack_sdio_irq, .execute_tuning = dw_mci_execute_tuning, .card_busy = dw_mci_card_busy, .start_signal_voltage_switch = dw_mci_switch_voltage, @@ -2645,9 +2659,14 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id) continue; if (pending & SDMMC_INT_SDIO(slot->sdio_id)) { + u32 int_mask; + mci_writel(host, RINTSTS, SDMMC_INT_SDIO(slot->sdio_id)); - mmc_signal_sdio_irq(slot->mmc); + int_mask = mci_readl(host, INTMASK); + int_mask &= ~SDMMC_INT_SDIO(slot->sdio_id); + mci_writel(host, INTMASK, int_mask); + sdio_signal_irq(slot->mmc); } } @@ -2748,6 +2767,10 @@ static int dw_mci_init_slot(struct dw_mci *host, unsigned int id) if (ret) goto err_host_allocated; + /* Process SDIO IRQs through the sdio_irq_work. */ + if (mmc->caps & MMC_CAP_SDIO_IRQ) + mmc->caps2 |= MMC_CAP2_SDIO_IRQ_NOTHREAD; + /* Useful defaults if platform data is unset. */ if (host->use_dma == TRANS_MODE_IDMAC) { mmc->max_segs = host->ring_size;