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: 9685463 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A237560375 for ; Tue, 18 Apr 2017 12:32:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 93E402097A for ; Tue, 18 Apr 2017 12:32:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 88C21209D8; Tue, 18 Apr 2017 12:32:13 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2A00623F88 for ; Tue, 18 Apr 2017 12:32:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755941AbdDRMcM (ORCPT ); Tue, 18 Apr 2017 08:32:12 -0400 Received: from mail-wr0-f173.google.com ([209.85.128.173]:34065 "EHLO mail-wr0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753110AbdDRMcL (ORCPT ); Tue, 18 Apr 2017 08:32:11 -0400 Received: by mail-wr0-f173.google.com with SMTP id z109so101438901wrb.1 for ; Tue, 18 Apr 2017 05:32:10 -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=hVBEBSMV5vGjLdIds9i2fqy4SXG0Hfq6vS2k5rp0nHQvsBYkvpsBYPhLV3DnY+JJLm 7EL9G8mhN/6YBh0DW7+VlcxHkbS70dB95IOKAT4yPnQTe0Rn7TKje+KCc3Yrws8Qlw2P JhPkqe5Y7638Rs9GT3igoK5lhTyOPG1fXhKWqTApyE1OGKWOQlmQKc6vKhJRbJsmL308 b+U1gvhALCSBF+ioilTdSc9j7un/1gNoKF8m9wRTKIXdoal+/u+OLAqdRCav8Zmdv5ls l7tmS9WcbuVm6uwplG4bAU62BD8SVETFWX9S4iu94uYcXboS/Crx9Qy/mA+y9b0YBHeb qnpQ== X-Gm-Message-State: AN3rC/5KAF9UVw+Rlnjk7tH8KgEtzcomEcXlICbBMviJzOt97uXmnY7V ydcMZmhHG8OWN7E0Js2jwQ== X-Received: by 10.223.134.118 with SMTP id 51mr6720883wrw.75.1492518729477; Tue, 18 Apr 2017 05:32:09 -0700 (PDT) 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> Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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(-) 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;