From patchwork Wed Apr 19 21:17:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 97682 Delivered-To: patches@linaro.org Received: by 10.182.246.10 with SMTP id xs10csp447951obc; Wed, 19 Apr 2017 14:17:23 -0700 (PDT) X-Received: by 10.223.178.225 with SMTP id g88mr4385210wrd.126.1492636643459; Wed, 19 Apr 2017 14:17:23 -0700 (PDT) Return-Path: Received: from mail-wm0-x22d.google.com (mail-wm0-x22d.google.com. [2a00:1450:400c:c09::22d]) by mx.google.com with ESMTPS id 33si5572849wrp.148.2017.04.19.14.17.23 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Apr 2017 14:17:23 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:400c:c09::22d as permitted sender) client-ip=2a00:1450:400c:c09::22d; 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:c09::22d as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: by mail-wm0-x22d.google.com with SMTP id m123so22019500wma.0 for ; Wed, 19 Apr 2017 14:17:23 -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=gySLns3vLVf/aJbNIac7vXTxSoqPQkXp2l2GYkzRHqM=; b=ITjd0rNTTgDhzHAQ8I9YKD3wUgvsUh1UDtLbqsVcV047ilXh0070X+XPDUAnPgauc+ wv2qsgHM5ReQIV62EY+8qTlWndqRIr7eIKjbo/IcOfg+foibDKAD7aAw58+HYj4eS/v8 EM9HBY+Q69/MnJQBSjGzOeBsVdgW8OEVaOVEE= 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=gySLns3vLVf/aJbNIac7vXTxSoqPQkXp2l2GYkzRHqM=; b=nVxguJKar3QJwX73HLQdG1XJ2zd+xwwrkb/PEt0xRiGnj4+rat3sWSm23bC6cse1hw gPxttcIjpfKiYvR1mL3V3wO4srumeM8usMvCHrMngoqfEFkgmUNbFsG3aFC8ZnGj0TBf 8xzPlLmVg+JNHFTi9ovcgY5NC1RBUwQ3eF3X4p+TjMos/Ao4DGdRLG6oyWF7XdVIcq3E UakZYF+LJnl4D7VWpkY30949YzuCQcM7dtJRLT5cefPfGeBgUmDQxymp8UxyNwMsH6z0 zp5+1ObjB/gd034ENkRvat3rsfihFEu7YOYW1EruKHfL1/Z0phyU7ZjHuOctQGqZPMCK 5fCA== X-Gm-Message-State: AN3rC/6yY9my44jhbDXqwx26tQWSzECxZQbrjUCvTbSJPwhkysctGGmn pwgQS7HLRJaaH3Xtz0E= X-Received: by 10.28.60.6 with SMTP id j6mr20536wma.19.1492636643006; Wed, 19 Apr 2017 14:17:23 -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 g53sm4837747wrg.22.2017.04.19.14.17.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 19 Apr 2017 14:17:22 -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 v2 3/5] mmc: dw_mmc: Convert to use MMC_CAP2_SDIO_IRQ_NOTHREAD for SDIO IRQs Date: Wed, 19 Apr 2017 23:17:09 +0200 Message-Id: <1492636631-28254-4-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1492636631-28254-1-git-send-email-ulf.hansson@linaro.org> References: <1492636631-28254-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 | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) -- 2.7.4 diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index e45129f..635d76c 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -1642,9 +1642,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; @@ -1662,6 +1661,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); @@ -1763,6 +1776,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, @@ -2654,7 +2668,8 @@ static irqreturn_t dw_mci_interrupt(int irq, void *dev_id) if (pending & SDMMC_INT_SDIO(slot->sdio_id)) { mci_writel(host, RINTSTS, SDMMC_INT_SDIO(slot->sdio_id)); - mmc_signal_sdio_irq(slot->mmc); + __dw_mci_enable_sdio_irq(slot, 0); + sdio_signal_irq(slot->mmc); } } @@ -2755,6 +2770,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;