From patchwork Fri Feb 24 15:22:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Martin_Povi=C5=A1er?= X-Patchwork-Id: 13151399 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 07CF8C61DA4 for ; Fri, 24 Feb 2023 15:24:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Kjdeq72Ucxpnb8YMzYrvAaDeRC+LVKt8yet9jy9xEAw=; b=rg0b3G2VQesi5d XvL4aT6QRpfccnuADQCugyleiMh4g7NVGztsNMy08Ie6w9OfTtses2t0z0212j1K23mPok0ubu9HO VDse1si/GReaaAWnFTutHKz3dOSQV7/8n7YPKwf8PxNPg2EAru0au494sQ810vA/Iu5kvR6ETnxvu B0/OHWcCXBofu1RieO+y067BKtUHTnKy/865Rk6wTGxbVJJdiNGIUfm1iueIiUhYMf6DX1NtTREDV FcXqNLpwD0V41hnJho3RiNIW21dg45HDCxB5JuOWsq66rFmybmlxYbzwhlLXxENbMSCsjhpYexONf pepsRNLl/eqAdSISZdsA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pVZv3-002wqG-A9; Fri, 24 Feb 2023 15:23:33 +0000 Received: from [2a03:3b40:fe:f0::1] (helo=hutie.ust.cz) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pVZu4-002wUN-TG for linux-arm-kernel@lists.infradead.org; Fri, 24 Feb 2023 15:22:37 +0000 From: =?utf-8?q?Martin_Povi=C5=A1er?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cutebit.org; s=mail; t=1677252145; bh=8I53wAm0Lhx1Y1CRpTsp/SrqowkIL26beK+I0BreeKg=; h=From:To:Cc:Subject:Date; b=KzjvnnBtPMLzkpne5ixV1R5vuvAuRq/riSQMn9JedY18pihL2mEdyY4AVhiv2dpX4 2jOIvqTVWjw8jMAAe4igDy0ErG5dXi8IdYScZWKLs1WURJu6IVVQGM4gAmerF6KtlL uzDbQyJTxoBgbh/cekLbEdEGeCEnorFmhJLgHseg= To: Hector Martin , Sven Peter , Vinod Koul Cc: Alyssa Rosenzweig , =?utf-8?q?Martin_Povi=C5=A1er?= , asahi@lists.linux.dev, linux-arm-kernel@lists.infradead.org, dmaengine@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/3] dmaengine: apple-admac: Handle 'global' interrupt flags Date: Fri, 24 Feb 2023 16:22:20 +0100 Message-Id: <20230224152222.26732-1-povik+lin@cutebit.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230224_072234_006501_06CDC757 X-CRM114-Status: GOOD ( 10.63 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In addition to TX channel and RX channel interrupt flags there's another class of 'global' interrupt flags with unknown semantics. Those weren't being handled up to now, and they are the suspected cause of stuck IRQ states that have been sporadically occurring. Check the global flags and clear them if raised. Fixes: b127315d9a78 ("dmaengine: apple-admac: Add Apple ADMAC driver") Signed-off-by: Martin PoviĊĦer --- drivers/dma/apple-admac.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/drivers/dma/apple-admac.c b/drivers/dma/apple-admac.c index 90f28bda29c8..00cbfafe0ed9 100644 --- a/drivers/dma/apple-admac.c +++ b/drivers/dma/apple-admac.c @@ -75,6 +75,7 @@ #define REG_TX_INTSTATE(idx) (0x0030 + (idx) * 4) #define REG_RX_INTSTATE(idx) (0x0040 + (idx) * 4) +#define REG_GLOBAL_INTSTATE(idx) (0x0050 + (idx) * 4) #define REG_CHAN_INTSTATUS(ch, idx) (0x8010 + (ch) * 0x200 + (idx) * 4) #define REG_CHAN_INTMASK(ch, idx) (0x8020 + (ch) * 0x200 + (idx) * 4) @@ -672,13 +673,14 @@ static void admac_handle_chan_int(struct admac_data *ad, int no) static irqreturn_t admac_interrupt(int irq, void *devid) { struct admac_data *ad = devid; - u32 rx_intstate, tx_intstate; + u32 rx_intstate, tx_intstate, global_intstate; int i; rx_intstate = readl_relaxed(ad->base + REG_RX_INTSTATE(ad->irq_index)); tx_intstate = readl_relaxed(ad->base + REG_TX_INTSTATE(ad->irq_index)); + global_intstate = readl_relaxed(ad->base + REG_GLOBAL_INTSTATE(ad->irq_index)); - if (!tx_intstate && !rx_intstate) + if (!tx_intstate && !rx_intstate && !global_intstate) return IRQ_NONE; for (i = 0; i < ad->nchannels; i += 2) { @@ -693,6 +695,12 @@ static irqreturn_t admac_interrupt(int irq, void *devid) rx_intstate >>= 1; } + if (global_intstate) { + dev_warn(ad->dev, "clearing unknown global interrupt flag: %x\n", + global_intstate); + writel_relaxed(~(u32) 0, ad->base + REG_GLOBAL_INTSTATE(ad->irq_index)); + } + return IRQ_HANDLED; }