Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp3267002rwb; Mon, 7 Aug 2023 10:36:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEwBQfxaQ5XcuGkgkkMhM3yE9bhKIy4LhVNQ6kX4TbQeMKdSFZVGt7VBiRoSXnlRktW8FSi X-Received: by 2002:a05:6a20:440a:b0:133:38cb:2b93 with SMTP id ce10-20020a056a20440a00b0013338cb2b93mr9834177pzb.9.1691429791150; Mon, 07 Aug 2023 10:36:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691429791; cv=none; d=google.com; s=arc-20160816; b=AvoM0YDmSm0TZE5ZjK2Y/9jZl8fTK1hsfu3M6ebreMQDrm0UZZ66D9ZgKzFT5xKjl5 zXePraSDVPh3hrvx7JFBoAjMS/P2vPnnvIERsiA8vnrBuhDHz2BpZgDB+J8bykuatL7X BGRNM1jngQ5sp1o8bHR0TWf/nGvnOEJY5k3bVKuMTJCsU3XO2lGybw1tiGbNL7NpmLJy V4MMmoP8QLQKVEdyQnGdW0rjEUzFlrc11rwhEPHeweqWqM1FaWnE3vlatFAgLf4mNr69 r3kJYnfJqLtZ344VKPkhIxyY2qaNWqavDb6ZeDFRnKJb0GBgQ+pLMCMzSYhMMDuW6qwe 2KUA== 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=utTEWF5AwPPZdReYUsE9NG9r20uDcNAZQ6ej4+bLC5o=; fh=UEVvRAFK6gmZxZNnJDUC7AmNk/iU78fiWA23OmiDi44=; b=c/jeFr9H6+FaRmOEWI6HEqJTlrln1Iy/jjoCeGA/mOyddYbMkTW5qscVxPTJhQVBTX unPCpwopPwqdewFfkAQloyOY2ujRNp6Nj32M7L93uyrqmChcSNfz+DPtWwpoM333yXd4 mZeQaVnL399oKa5ENiCS0IeSOkY2eOyETLpVlrjj6ve0Yd13YgU7IGnoLV1UDus4KKLL zCMRrKfZOQOkvjeVfS9u/FwaWlEg4Qizdh//lYSoWlpYun5Pp0nzl5UC6yKXB2OuH12y jb7FOTQ63J6ZROk1xrQFpBMPsTt4fEHUtrTEAGlv3xsq/kJE1xGNBwDoDToDqpYEMdKR /tWA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="unOQi/58"; 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 r9-20020a635d09000000b0055c4c9cc010si5590723pgb.481.2023.08.07.10.36.19; Mon, 07 Aug 2023 10:36:31 -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="unOQi/58"; 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 S231975AbjHGQy0 (ORCPT + 99 others); Mon, 7 Aug 2023 12:54:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57202 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230363AbjHGQyY (ORCPT ); Mon, 7 Aug 2023 12:54:24 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0FE11BD0; Mon, 7 Aug 2023 09:53:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 866C961E0A; Mon, 7 Aug 2023 16:53:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09B96C433C8; Mon, 7 Aug 2023 16:53:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691427235; bh=ucsnwmWqR4ajtwvJh+GfJymKYMLxktOm7tZoJmtvJZc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=unOQi/58jran/roL4A+62srL5tGAGlU2R3f/ghuG/muZVv2VIArOIjNCp+hIb6mwA G/UC72SBFHKBrZseylm767aw0RKRDqX08NTfYKYJvDdeKnuesQLyNFwj4/uw76UNAX OGHwV8cVQzAzMxJuAVhoE2hvkxWSVyntfhZN6vBu/5uI/xzS5FFILzy+Wr2UlsU5dP +ZUu3Q1Clu4uKCrLQCINhV2brTAPFbXhjMjdAJK7MG2gRDfD/WOdRDXlbZy7LgNl4i m05RoZN+JlB7baKnNYiE7m/j27r4CuEpth8zVwAXxaCZelX13BgDSUeFbhNVWBtiNW PAkUfCukUkCWA== From: Jisheng Zhang To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH net-next v2 06/10] net: stmmac: xgmac: support per-channel irq Date: Tue, 8 Aug 2023 00:41:47 +0800 Message-Id: <20230807164151.1130-7-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230807164151.1130-1-jszhang@kernel.org> References: <20230807164151.1130-1-jszhang@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,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 The IP supports per channel interrupt, add support for this usage case. Signed-off-by: Jisheng Zhang --- .../net/ethernet/stmicro/stmmac/dwxgmac2.h | 2 ++ .../ethernet/stmicro/stmmac/dwxgmac2_dma.c | 33 +++++++++++-------- 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h index 81cbb13a101d..12e1228ccf2a 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h @@ -327,6 +327,8 @@ /* DMA Registers */ #define XGMAC_DMA_MODE 0x00003000 +#define XGMAC_INTM GENMASK(13, 12) +#define XGMAC_INTM_MODE1 0x1 #define XGMAC_SWR BIT(0) #define XGMAC_DMA_SYSBUS_MODE 0x00003004 #define XGMAC_WR_OSR_LMT GENMASK(29, 24) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c index b5ba4e0cca55..ef25af92d6cc 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c @@ -31,6 +31,13 @@ static void dwxgmac2_dma_init(void __iomem *ioaddr, value |= XGMAC_EAME; writel(value, ioaddr + XGMAC_DMA_SYSBUS_MODE); + + if (dma_cfg->perch_irq_en) { + value = readl(ioaddr + XGMAC_DMA_MODE); + value &= ~XGMAC_INTM; + value |= FIELD_PREP(XGMAC_INTM, XGMAC_INTM_MODE1); + writel(value, ioaddr + XGMAC_DMA_MODE); + } } static void dwxgmac2_dma_init_chan(struct stmmac_priv *priv, @@ -365,20 +372,20 @@ static int dwxgmac2_dma_interrupt(struct stmmac_priv *priv, } /* TX/RX NORMAL interrupts */ - if (likely(intr_status & XGMAC_NIS)) { - if (likely(intr_status & XGMAC_RI)) { - u64_stats_update_begin(&rx_q->rxq_stats.syncp); - rx_q->rxq_stats.rx_normal_irq_n++; - u64_stats_update_end(&rx_q->rxq_stats.syncp); - ret |= handle_rx; - } - if (likely(intr_status & (XGMAC_TI | XGMAC_TBU))) { - u64_stats_update_begin(&tx_q->txq_stats.syncp); - tx_q->txq_stats.tx_normal_irq_n++; - u64_stats_update_end(&tx_q->txq_stats.syncp); - ret |= handle_tx; - } + if (likely(intr_status & XGMAC_RI)) { + u64_stats_update_begin(&rx_q->rxq_stats.syncp); + rx_q->rxq_stats.rx_normal_irq_n++; + u64_stats_update_end(&rx_q->rxq_stats.syncp); + ret |= handle_rx; + } + if (likely(intr_status & XGMAC_TI)) { + u64_stats_update_begin(&tx_q->txq_stats.syncp); + tx_q->txq_stats.tx_normal_irq_n++; + u64_stats_update_end(&tx_q->txq_stats.syncp); + ret |= handle_tx; } + if (unlikely(intr_status & XGMAC_TBU)) + ret |= handle_tx; /* Clear interrupts */ writel(intr_en & intr_status, ioaddr + XGMAC_DMA_CH_STATUS(chan)); -- 2.40.1