Received: by 2002:a05:7412:bb8d:b0:d7:7d3a:4fe2 with SMTP id js13csp1777321rdb; Thu, 17 Aug 2023 01:31:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IExMPJ6fUndLMlGYqaagTChl66HFnj7rDq0Ame5LBYiT6xCE0wGh2xSYvIIWisu2B4egydp X-Received: by 2002:a17:906:4999:b0:999:26d3:b815 with SMTP id p25-20020a170906499900b0099926d3b815mr4513943eju.64.1692261059894; Thu, 17 Aug 2023 01:30:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692261059; cv=none; d=google.com; s=arc-20160816; b=UdAyZoNN51MUMaLEsY6PPCYF2n4lvGSYadwvzXT77JnxQRV5TUDA8M2HN7h/gza5BL 3xFeCaQRDfVzzSW0VJP8wVg1SiTVYtsWGubj/Y59ZnGBRS9uh2xMBmyTLVEhGv6b8ZIA BzkuzYsnelpQeetwaSMw6DcVqyFiskZ8fZfIq5RSNUqsJ/vTBFHCiYUqaZNsxaQYVJq+ 9Krhsi/jxdQuRNOOb5kxrcdyV2G2Z2uNf+3iCN/Mhcai+JxPZbdE12wyil1sqtIldhhR mIBa78CUM025gv+Rbmud27xyuCaozbID3k4jThRqJTAwDwVNwHGUQfA7GdCFjGnX5KpT NdQQ== 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=lYOTOlFRdOvI1Qa3ZjGmOm2wvaDkXlSmNuFNrye/rx4=; fh=UEVvRAFK6gmZxZNnJDUC7AmNk/iU78fiWA23OmiDi44=; b=KcSeCuQxUphK8cAOIW5KHEs/N84yjrZG7rO79+fh+AiXd54OGVURWKGe1eK6crSmzX tghT20O059zc7/SRk48aOFaZA2tUw5KunLV8yr+egHoj6TGxVBylolYtKJN0t6fsOh1K M9JKyaxSumlmhOpOImyyjtCa4A7OxmTl2QAt+RLK+TuElV9kINBe2Z9E6Om7G3T7DwP6 u+N3480che5ce0d9Vn3C87X+zpbKCnatyyxKM+O5ennazbbSb30tq95jCXGBISIMEJs+ HuzXznvhMGGXoQ5wIYNt1pN+OxeQb0LCudszcbDOrwn4blQbvo55HRgDYf/0dddfrbaU T6QA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=HYmwtffM; 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 i9-20020a170906a28900b00992c5cf17f9si13379870ejz.43.2023.08.17.01.30.34; Thu, 17 Aug 2023 01:30:59 -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=HYmwtffM; 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 S1344274AbjHPPlr (ORCPT + 99 others); Wed, 16 Aug 2023 11:41:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344239AbjHPPlf (ORCPT ); Wed, 16 Aug 2023 11:41:35 -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 7A65E26A6; Wed, 16 Aug 2023 08:41:34 -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 0DBCD647BB; Wed, 16 Aug 2023 15:41:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8A5C9C433C8; Wed, 16 Aug 2023 15:41:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692200493; bh=H6r17igTApBMtumIbML4/Pv00+k0irJssUyt+I4FyfE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HYmwtffMatnPnocbWJxD0WanE0n4nt2psNqEqbaW7U0oRvWY5AvmE+j3mLM+kjMTY 5+2zAY+PnA0edjGw+9nR9lMPmUOubqiA8n2Fnm0UL5Boltq/5QmBEEgPmBsuGys6wx LEMI2syqgB6BwygNksYMc85LvKfXK3qK7TLuu443voQ+cas1rAohgzqGBsYetRFluO 4kOTbZK0XNgWVYbnSb4O15wPBreio1l2+4hwvBPKj1/ey2tbjt0REtg1g4zAn9G7vA 9KAuy7LJ7b06h/kU/v1itA78ExYdGQfyp/adnQmh4/qxKKkfcAaHUulOFJgqVDZjV0 +88VGiAzoB8RA== 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 v4 5/9] net: stmmac: xgmac: support per-channel irq Date: Wed, 16 Aug 2023 23:29:22 +0800 Message-Id: <20230816152926.4093-6-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230816152926.4093-1-jszhang@kernel.org> References: <20230816152926.4093-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 7f68bef456b7..18a042834d75 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h @@ -340,6 +340,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 1ef8fc132c2d..ce228c362403 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