From patchwork Tue May 9 08:27:27 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 98885 Delivered-To: patches@linaro.org Received: by 10.140.96.100 with SMTP id j91csp1708406qge; Tue, 9 May 2017 01:27:39 -0700 (PDT) X-Received: by 10.223.162.158 with SMTP id s30mr40254873wra.34.1494318459795; Tue, 09 May 2017 01:27:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1494318459; cv=none; d=google.com; s=arc-20160816; b=cWD320CGe6L+Mkt4p+xE2A+rIirAdPcLSF+Ddta4LToUJuKXUeNMHTYtpdnWFFJk36 RcTfuFBybIrnH2kQRcMKG4aD3/8kft9zbw839gDc+ht4qje+Tg9ozXzHNmOlv7ieEi19 w8jk3Zj0Q1tO/PgOu51LD2Rm1crAEyNKApa0KIRuVBRO4igCQ3VBd7fdJwyXN3C9wgkN 9WFapuvtaSpnLiEcU/WgoZ4Ax6iJsto3fOe7gFqyPdWU2GkJ7puBkYbNgR7wjz+VE+Tx O3QsrWz966vlJJcdiPYIYg37LXJWdyIX/d0xk5sSKNgJbi6z5MkMpOsrPEtx4ar7Yw89 CDog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=6w9WYksrBqpFRB8uJcO+DrIOPlpmn2f6WoNr7JF6Uuk=; b=O8w6WK+MWUNdoTWQIcQ07LFDXKNojH/kalDQCCfR3NhLs5Uvc144n7G+MzRoo0h4Yn xNpbMpCw8goJKYVxUkPx8dovHfmuESIRdDws1j85rTQ4zpTH0MhDCTAedR3Esk2m9gUT hvJVS5hyil1aMvr4M1uznQ1WEI5Io05jB8D06UJndAJ397xzFvVzxN/lO/7rNmbaoUW6 dZtaI+4WKUrP+kVE1CErFSsWtNwGU1wacJT+5ecFXVwn+Qy9ErDmJD5UkyjKfAMwo+n3 plQwh44khZSchUER/wzPDOdwDmEVbuLi6wrSSN/0rb2rpvZEDjQE877kGS17f7OzZIGA Np0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:400c:c0c::235 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-wr0-x235.google.com (mail-wr0-x235.google.com. [2a00:1450:400c:c0c::235]) by mx.google.com with ESMTPS id z23si17599697wrz.204.2017.05.09.01.27.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 09 May 2017 01:27:39 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 2a00:1450:400c:c0c::235 as permitted sender) client-ip=2a00:1450:400c:c0c::235; 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::235 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-x235.google.com with SMTP id z52so63314150wrc.2 for ; Tue, 09 May 2017 01:27:39 -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=6w9WYksrBqpFRB8uJcO+DrIOPlpmn2f6WoNr7JF6Uuk=; b=JlU3mrd+/AFCiSlve4mMW8v3u2vSiFdplmQw8PcZ1fr2w8SdAn22S43rTJMKjLj8U4 B+gzWwBNbkp46UtLI17PygS1TtOao8hfWEDmawzEF3S7sPgj62vxjErM+dmhlBQXYj/u QDXYCtKHyU4f/AmrvW3f09r2LUufemB4ce4Ng= 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=6w9WYksrBqpFRB8uJcO+DrIOPlpmn2f6WoNr7JF6Uuk=; b=oIJQ2d9DLWFT5FTiFbG5SA1vzJSwltzCOBX3d7fJhJRCImv2EgLdyPZIKoiG/DP7/G tc0Je4t2H+o2nAdbt8I3A1HwV7g59pynwq0Tv2eJnHUZoVDLgpl7a/fWZeN2DmAhZddr 75EoLHpG2zNntk8f7BDGZV/y7dzgjSZQvb5bJcfJcgr1eq1DuBVZC7itNEeFh4sDKEaX 2x58Hc1IhBFru7VLfIZVFMF07BnxcJDYJ/SCumagznhrmnWB4kjwzwL3ZfuahmJmVyxc 6QX4NZM34Wou3e7lxX1atRZAQSqJAKiGrZCDPwxMNcgWm+wdLVl8Pw4yuja+8ngrfuAH TUgg== X-Gm-Message-State: AODbwcC1HJ9ds5gCr6ZkWqf3k22Zi+3mW8+8Co8SjNVR7Hde3aQf4LOq 0sI4FUCVtiTaq5gROOs= X-Received: by 10.46.71.193 with SMTP id u184mr8272450lja.16.1494318459455; Tue, 09 May 2017 01:27:39 -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 o21sm3151108lfo.34.2017.05.09.01.27.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 09 May 2017 01:27:38 -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 v3 3/5] mmc: dw_mmc: Convert to use MMC_CAP2_SDIO_IRQ_NOTHREAD for SDIO IRQs Date: Tue, 9 May 2017 10:27:27 +0200 Message-Id: <1494318449-2591-4-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1494318449-2591-1-git-send-email-ulf.hansson@linaro.org> References: <1494318449-2591-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 and use sdio_signal_irq() instead of mmc_signal_sdio_irq(). - Mask the SDIO IRQ before signaling a new one to be processed. - Implement the ->ack_sdio_irq() callback to unmask the SDIO IRQ. Signed-off-by: Ulf Hansson Tested-by: Douglas Anderson Reviewed-by: Douglas Anderson --- 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;