Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp2286399rwo; Sun, 23 Jul 2023 11:35:01 -0700 (PDT) X-Google-Smtp-Source: APBJJlFw1al7D7Ym86ArV/DaZljpHthKzM219syBsLKPcuZCNFL/KzqHbzKgBvWifLg5hyRK7+qC X-Received: by 2002:a17:90a:a092:b0:262:fb5d:147b with SMTP id r18-20020a17090aa09200b00262fb5d147bmr7853281pjp.19.1690137301458; Sun, 23 Jul 2023 11:35:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690137301; cv=none; d=google.com; s=arc-20160816; b=xErGEdXTv7lzhLdtqfLyGLwzhahHAO8dsrDxg7H1G15qYJc6kjzUYo0spF486pST5/ 20uFm/QP37gOEdifV18qRg6FyWN4QnF2LOG6MrF0MdKI+FQ9cmYGVy2ixr8rk7qQcUUC 6/Im3Lv6EUJC2iaSryw3z4tVLDI7s8P6LuFt4LobYxmF6OZwiqp/O3w+fTFmwxrj5VoE 1qQSlHleyjtxIe/wDLy1GM4qOYsnR4q2OYq7vMJO+DPKM13jvQMaDfVGsTv0uhJz+j6E IU3Ibx+MQAvg6HVj396y0HueXUlKKaqmPXSEGuYdD5b/s9TA8TnLPN0VirQldTbFXjx9 82Lw== 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=KVOQB+903mozdCAI+QXXeWgBiTZaBRTmj+4AVTTBmbq1OrtkGiqcDZ7g+b8fxPcypU szai/S75cEzPlH6AwWbJlfX/4KZbnOgq88k2D3QTOe7FZrvLZoAl1qU6ZtMNTeOAFYfd Bnd8k8tHp8L0pYPygHbz+c1hxhwlHUAcYzHylCia7gp5lQLAI41s9MZN071ITUEyeioo KUkSHLTN9RnDa4v94SUfNLthADyd8LN1wMVqOM1/PgYkXafy0oNwgOSop3jGH0RlIF2f BvRM0YHE1kqoL/6eSJ4ZaHGi7ILUBswt0SRoOwwWY99I5IZFzobRuxA5Vs/DF61VJeQg 4W4Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=AyDfYmJw; 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 nn16-20020a17090b38d000b0026383536294si8023140pjb.175.2023.07.23.11.34.50; Sun, 23 Jul 2023 11:35:01 -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=AyDfYmJw; 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 S229998AbjGWQXC (ORCPT + 99 others); Sun, 23 Jul 2023 12:23:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44106 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229554AbjGWQW7 (ORCPT ); Sun, 23 Jul 2023 12:22:59 -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 125CE1BFA; Sun, 23 Jul 2023 09:22:37 -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 8AC2360E0B; Sun, 23 Jul 2023 16:22:31 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3181EC433C8; Sun, 23 Jul 2023 16:22:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690129351; bh=ucsnwmWqR4ajtwvJh+GfJymKYMLxktOm7tZoJmtvJZc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AyDfYmJwoGoanHp/xBxMzNwo/cJheiN1a66a5+JT/+JbxfvGeZbhY0WcLEh9sp2xZ iMoHU4LlaESiLdQ4GU548+FHQ1ch6rj47ps7a0E3uW39U6fLpUI8vOQilzLMM9JsMy Ao1UbrGhMqQdh5+1NtBCkLIOSiWAMBqg5YaHNYcaaTYIuylOJwtVP5ybVdA1uFQzJU WNGM9nZUF7W6/aJ1PiwEW56ikB3CqahcjajRukn9f4pPPEsFXWaWLLhb5A+UcgSHyD dxc9+5L0mYd8HXYzekvLkWO9U7MVdU0fXkmC8NXQZq+ESXf4TiKufJj3eOO0/B53zg YeVY7AfuNmLSw== 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 06/10] net: stmmac: xgmac: support per-channel irq Date: Mon, 24 Jul 2023 00:10:25 +0800 Message-Id: <20230723161029.1345-7-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230723161029.1345-1-jszhang@kernel.org> References: <20230723161029.1345-1-jszhang@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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