Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp1703379rwe; Sat, 15 Apr 2023 04:38:06 -0700 (PDT) X-Google-Smtp-Source: AKy350aCjFy4Qfxbdhz7v+eQeeDcaKK41ylPlquMrHoT/JkdySSXS18JTlUSxcx1cTSeQKgHpZC4 X-Received: by 2002:a17:902:e550:b0:1a1:7da3:ef5b with SMTP id n16-20020a170902e55000b001a17da3ef5bmr6566143plf.7.1681558686212; Sat, 15 Apr 2023 04:38:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681558686; cv=none; d=google.com; s=arc-20160816; b=j4c9lHhf6Aa1R2d1QoJMWoJnkXjajjlBQnybH/XbnMpTlu8rUUbZvVw9zu+cZZsLd0 HYdmugdR32zeCuM717t6HC0wkKyWyd3LN7GK1PrFQG/ZMYHFrYDKSB/IaDw2kRiU128z lskYSg9cjojvajpKuMm50uIt3AgSCJvLiVZ7nLcYivZDnlsamp9ukdctaaSGN9V7KykP 5/B8UHD5Ik0UGvDkM16kg8RXJ/Ke0NZcu1FSApGjplY1Hm+7yqVn0P9ay0aepHrn5Oxa zInvjL5RJPvLnLH6heDm93DEXmnTffCge7MJort30bJHTJuEuPHnMhoP6BKMzApu32VQ S3CQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=2N30BO8E/sEv8J9wMMsKNdzIawVaSq8X5am7iM3XXPM=; b=bna4/5nztl4QFKp8SxDOwdiiJBjOArURIeImAHYvNKnMhMk/FEHDO/ZlEbYVGqeTzJ +Au+B1r7xzjy/+nn7y3i3zf73o7sNyzokmNaPeQsnYypewG5Z+GBJE0KytVvGxNGSqct rYQK1lzSZeBBcnRGjF3DhZLrm2bxwQX7KAJz2qZNtli60Rb0xUbWHEQjeq6s1AnfCaOO Wx73OPMpViAReCUju8OxlqCeV2Pod7oUyUx5LoRHcT1aseCkhS2Hn5nAMjtXZNbv3ZHq zMInlg3M7DzxDykPDE6PQUe07vSxr2y3AzXaUhf8/jPWbNYJWjxqMP9PmKjEVp2ciIWm 8STg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=T6CMvl6i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y16-20020a170902b49000b001a68ebc3e50si5429811plr.511.2023.04.15.04.37.52; Sat, 15 Apr 2023 04:38:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=T6CMvl6i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230364AbjDOKta (ORCPT + 99 others); Sat, 15 Apr 2023 06:49:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230467AbjDOKtI (ORCPT ); Sat, 15 Apr 2023 06:49:08 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01D421A5; Sat, 15 Apr 2023 03:48:41 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 83881617DC; Sat, 15 Apr 2023 10:47:05 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EFA98C4339B; Sat, 15 Apr 2023 10:47:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681555624; bh=X0v6md0ShrzygWDpZi0pa8rfM30TOG9ETPBgqjPAHbo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T6CMvl6ic67rJ9fk5P7QINVFIWza30v0pJhTUJ776WxC4ymOf25G00vG9xBTW1n5I G0tisLndvMwCOVMi/6bzCJW633NGY3pKfl4hhmkQqg4ReNYyqbvggVbtYuHqEf3f9d g8qilRRTGR5nJ3dglEguHUEbUHXP/WFd8JeyPQBvAol0FkQnOJSUnAWG4fVQtjlYm5 vQ/0XhI1VDR7i3eP8wUpTAjQXt5GPW276iKky9X1hn0j4sjCw5JgW2dtZ53Jr6cqXb uEY5rEDs20DVK/2LGQWckSxxXp8s0a20C/nP1UrfpGV1wIwPpMbGNfUrsRvcGpEILS VBO/lFMFPxeUg== From: Jisheng Zhang To: Eugeniy Paltsev , Vinod Koul Cc: dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 06/11] dmaengine: dw-axi-dmac: move ch irq handling into common routine Date: Sat, 15 Apr 2023 18:35:56 +0800 Message-Id: <20230415103601.2979-7-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230415103601.2979-1-jszhang@kernel.org> References: <20230415103601.2979-1-jszhang@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In next patch, we will add per-channel irq support, we will use the common routine in per-channel irq handler. Signed-off-by: Jisheng Zhang --- .../dma/dw-axi-dmac/dw-axi-dmac-platform.c | 30 ++++++++++++------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c index 6087fb7d567a..796fd0136781 100644 --- a/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c +++ b/drivers/dma/dw-axi-dmac/dw-axi-dmac-platform.c @@ -1101,13 +1101,30 @@ static void axi_chan_block_xfer_complete(struct axi_dma_chan *chan) spin_unlock_irqrestore(&chan->vc.lock, flags); } +static void dw_axi_dma_handle_ch(struct axi_dma_chan *chan) +{ + u32 status; + + /* Poll, clear and process this channel interrupt status */ + status = axi_chan_irq_read(chan); + axi_chan_irq_clear(chan, status); + + dev_vdbg(chan->chip->dev, "%s IRQ status: 0x%08x\n", axi_chan_name(chan), status); + + if (status & DWAXIDMAC_IRQ_ALL_ERR) + axi_chan_handle_err(chan, status); + else if (status & DWAXIDMAC_IRQ_DMA_TRF) + axi_chan_block_xfer_complete(chan); + +} + static irqreturn_t dw_axi_dma_interrupt(int irq, void *dev_id) { struct axi_dma_chip *chip = dev_id; struct dw_axi_dma *dw = chip->dw; struct axi_dma_chan *chan; - u32 status, i; + u32 i; /* Disable DMAC interrupts. We'll enable them after processing channels */ axi_dma_irq_disable(chip); @@ -1115,16 +1132,7 @@ static irqreturn_t dw_axi_dma_interrupt(int irq, void *dev_id) /* Poll, clear and process every channel interrupt status */ for (i = 0; i < dw->hdata->nr_channels; i++) { chan = &dw->chan[i]; - status = axi_chan_irq_read(chan); - axi_chan_irq_clear(chan, status); - - dev_vdbg(chip->dev, "%s %u IRQ status: 0x%08x\n", - axi_chan_name(chan), i, status); - - if (status & DWAXIDMAC_IRQ_ALL_ERR) - axi_chan_handle_err(chan, status); - else if (status & DWAXIDMAC_IRQ_DMA_TRF) - axi_chan_block_xfer_complete(chan); + dw_axi_dma_handle_ch(chan); } /* Re-enable interrupts */ -- 2.39.2