From patchwork Thu Jan 26 23:37:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gerd Hoffmann X-Patchwork-Id: 9540395 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 9C48260429 for ; Thu, 26 Jan 2017 23:42:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8ED9828305 for ; Thu, 26 Jan 2017 23:42:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7FEA52830A; Thu, 26 Jan 2017 23:42:09 +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=-1.9 required=2.0 tests=BAYES_00 autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 0985228305 for ; Thu, 26 Jan 2017 23:42:09 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cWtg4-0008TI-Ix; Thu, 26 Jan 2017 23:42:04 +0000 Received: from casper.infradead.org ([85.118.1.10]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cWtca-0003sK-Mo for linux-arm-kernel@bombadil.infradead.org; Thu, 26 Jan 2017 23:38:28 +0000 Received: from mx1.redhat.com ([209.132.183.28]) by casper.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1cWtcU-0001h0-CW for linux-arm-kernel@lists.infradead.org; Thu, 26 Jan 2017 23:38:27 +0000 Received: from smtp.corp.redhat.com (int-mx16.intmail.prod.int.phx2.redhat.com [10.5.11.28]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 8CFD3C001698; Thu, 26 Jan 2017 23:37:33 +0000 (UTC) Received: from nilsson.home.kraxel.org (ovpn-116-57.ams2.redhat.com [10.36.116.57]) by smtp.corp.redhat.com (Postfix) with ESMTP id 207492112A6; Thu, 26 Jan 2017 23:37:33 +0000 (UTC) Received: by nilsson.home.kraxel.org (Postfix, from userid 500) id 859FC8164D; Fri, 27 Jan 2017 00:37:30 +0100 (CET) From: Gerd Hoffmann To: linux-rpi-kernel@lists.infradead.org Subject: [PATCH 08/13] mmc: bcm2835: split bcm2835_data_irq Date: Fri, 27 Jan 2017 00:37:21 +0100 Message-Id: <1485473846-24537-9-git-send-email-kraxel@redhat.com> In-Reply-To: <1485473846-24537-1-git-send-email-kraxel@redhat.com> References: <1485473846-24537-1-git-send-email-kraxel@redhat.com> X-Scanned-By: MIMEDefang 2.74 on 10.5.11.28 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.31]); Thu, 26 Jan 2017 23:37:33 +0000 (UTC) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170126_233822_805929_64C5F718 X-CRM114-Status: GOOD ( 18.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Stefan Wahren , Ulf Hansson , Florian Fainelli , Scott Branden , Stephen Warren , Ray Jui , Lee Jones , linux-mmc@vger.kernel.org, open list , Eric Anholt , "maintainer:BROADCOM BCM281XX/BCM11XXX/BCM216XX ARM ARCHITE..." , Gerd Hoffmann , "moderated list:BROADCOM BCM2835 ARM ARCHITECTURE" MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP pio transfers stay in irq handler. handle finished xfers moved to threaded handler. most bcm2835 code runs in thread context now. Signed-off-by: Gerd Hoffmann --- drivers/mmc/host/bcm2835.c | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/drivers/mmc/host/bcm2835.c b/drivers/mmc/host/bcm2835.c index 814812b..2bea4e0 100644 --- a/drivers/mmc/host/bcm2835.c +++ b/drivers/mmc/host/bcm2835.c @@ -171,6 +171,7 @@ struct bcm2835_host { /* for threaded irq handler */ bool irq_block; bool irq_busy; + bool irq_data; /* DMA part */ struct dma_chan *dma_chan_rx; @@ -1025,10 +1026,10 @@ static void bcm2835_data_irq(struct bcm2835_host *host, u32 intmask) return; bcm2835_check_data_error(host, intmask); + if (host->data->error) + goto finished; - if (host->data->error) { - bcm2835_finish_data(host); - } else if (host->data->flags & MMC_DATA_WRITE) { + if (host->data->flags & MMC_DATA_WRITE) { /* Use the block interrupt for writes after the first block */ host->hcfg &= ~(SDHCFG_DATA_IRPT_EN); host->hcfg |= SDHCFG_BLOCK_IRPT_EN; @@ -1038,8 +1039,22 @@ static void bcm2835_data_irq(struct bcm2835_host *host, u32 intmask) bcm2835_transfer_pio(host); host->blocks--; if ((host->blocks == 0) || host->data->error) - bcm2835_finish_data(host); + goto finished; } + return; + +finished: + host->hcfg &= ~(SDHCFG_DATA_IRPT_EN | SDHCFG_BLOCK_IRPT_EN); + writel(host->hcfg, host->ioaddr + SDHCFG); + return; +} + +static void bcm2835_data_threaded_irq(struct bcm2835_host *host) +{ + if (!host->data) + return; + if ((host->blocks == 0) || host->data->error) + bcm2835_finish_data(host); } static void bcm2835_block_irq(struct bcm2835_host *host) @@ -1098,7 +1113,8 @@ static irqreturn_t bcm2835_irq(int irq, void *dev_id) if ((intmask & SDHSTS_DATA_FLAG) && (host->hcfg & SDHCFG_DATA_IRPT_EN)) { bcm2835_data_irq(host, intmask); - result = IRQ_HANDLED; + host->irq_data = true; + result = IRQ_WAKE_THREAD; } spin_unlock(&host->lock); @@ -1110,19 +1126,23 @@ static irqreturn_t bcm2835_threaded_irq(int irq, void *dev_id) { struct bcm2835_host *host = dev_id; unsigned long flags; - bool block, busy; + bool block, busy, data; spin_lock_irqsave(&host->lock, flags); block = host->irq_block; busy = host->irq_busy; + data = host->irq_data; host->irq_block = false; host->irq_busy = false; + host->irq_data = false; if (block) bcm2835_block_irq(host); if (busy) bcm2835_busy_irq(host); + if (data) + bcm2835_data_threaded_irq(host); spin_unlock_irqrestore(&host->lock, flags);