From patchwork Wed Aug 9 16:49:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13348221 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 EF863C0015E for ; Wed, 9 Aug 2023 17:02:23 +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:References:In-Reply-To: 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: List-Owner; bh=9kViaS2OU+RZ52hwlppJpnOc2g/7hM+bRqffm/uXp2o=; b=n+PQxsTzT+fgU6 skc3Vvhk1YEfr2B94dbBEM2aIDG9m0s9kUfsP1t/tkxLY0LeALJqkE/2DtDDngwg9SqQx5AGE4QOR oWExZWDu2NEC1qlB0FtcnXn072/E7xRwETifasmgzbFFNhLP5fjKg3BdsSf59u5GTFm1HQOEUwRgc 4y9yKARgbgdPBAQtk6mJ4aXQf8iDum6HY6Ma2pS5whYI9d+sp4EBfC+Dkk2EWF+2aGemkix6NDcFo PsnL9K07v6BUnnppz3ipVOW3UPU22qLqJPLdAjHUccTfrHiTMx/mJyIMe+06tBj2mIYxw85tZ+DDg 7J5aEslNrapZEzpCo6bg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qTmZJ-005T8k-1D; Wed, 09 Aug 2023 17:01:57 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qTmZE-005T72-1e for linux-arm-kernel@lists.infradead.org; Wed, 09 Aug 2023 17:01:53 +0000 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 0BF766415A; Wed, 9 Aug 2023 17:01:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CBCDFC43391; Wed, 9 Aug 2023 17:01:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691600511; bh=d3IEyKFkLTaGuIoiBZGy50KXj/3eibRX6B2ljjyT/mA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mKhnJU9A0/uVkKlzLC7/TVT/iJMx6vCu83QzvMvfZ+jUh/eMgVEu21OM6k5jAU7Di lSK6AFaSnKeHgFA6FY4qlb8Ex3ED0+DG+NJzW0FWIh0D7OhjVwNKu9eKxDOnbFV9Rt mnEm0ZKy/2r2pzub+rRpdypG7GjePu61sG3Pt1QeESKdN51pNwJtRcT9iXBDLJRacu 0umSLX7DLyPozRrkQhT8RIdzNeBs2R7kRUfUFIK98MhZA/gvm2CXSwHwM/7gE2EGIS udlaqpTVMHEBFK+0d4fk9GdoLtMbMQvP3OpdWJKD8zCNNiyUUxNjkZXn0IuJ5QLUvK h9LdQkZaoizPw== 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 v3 01/10] net: stmmac: correct RX COE parsing for xgmac Date: Thu, 10 Aug 2023 00:49:58 +0800 Message-Id: <20230809165007.1439-2-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230809165007.1439-1-jszhang@kernel.org> References: <20230809165007.1439-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230809_100152_591857_A2D273AB X-CRM114-Status: GOOD ( 12.53 ) 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 xgmac can support RX COE, but there's no two kinds of COE, I.E type 1 and type 2 COE. Signed-off-by: Jisheng Zhang Acked-by: Alexandre TORGUE --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index e1f1c034d325..15ed3947361b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -6271,7 +6271,7 @@ static int stmmac_dma_cap_show(struct seq_file *seq, void *v) seq_printf(seq, "\tAV features: %s\n", (priv->dma_cap.av) ? "Y" : "N"); seq_printf(seq, "\tChecksum Offload in TX: %s\n", (priv->dma_cap.tx_coe) ? "Y" : "N"); - if (priv->synopsys_id >= DWMAC_CORE_4_00) { + if (priv->synopsys_id >= DWMAC_CORE_4_00 || priv->plat->has_xgmac) { seq_printf(seq, "\tIP Checksum Offload in RX: %s\n", (priv->dma_cap.rx_coe) ? "Y" : "N"); } else { @@ -7013,7 +7013,7 @@ static int stmmac_hw_init(struct stmmac_priv *priv) if (priv->plat->rx_coe) { priv->hw->rx_csum = priv->plat->rx_coe; dev_info(priv->device, "RX Checksum Offload Engine supported\n"); - if (priv->synopsys_id < DWMAC_CORE_4_00) + if (priv->synopsys_id < DWMAC_CORE_4_00 && !priv->plat->has_xgmac) dev_info(priv->device, "COE Type %d\n", priv->hw->rx_csum); } if (priv->plat->tx_coe) From patchwork Wed Aug 9 16:49:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13348224 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 6519CC001E0 for ; Wed, 9 Aug 2023 17:02:29 +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:References:In-Reply-To: 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: List-Owner; bh=be6WnSwFNW6P7nuxPoO2O3Z5XkX0w6jfSSKvJ1d7m3M=; b=LprLmrCy5AEjU2 KRDvtFs00caHTMscUgnxo1lhpKztcWJ1wXMLG5+yna5eMbXmvCIPgs59ytIPgIUEEn5K7R1rJsC0l 0dzxejSWgjc5sO3Cugv//pna4DCCESuoIujxppnKvxpF4Ps/o1MDRokghkKzNniYTv6TOaOE9jrAg BUPCSiMA1rOkoHjasEVqc0+2GCodAyw8SWDwICbQr9yCTZtaogSDEkRqqzbZvRZwP//I/WAzRMCCq +UEHqVu2NEo5HjOvv1er3d4C9NLlWYWj8rN46iGmli+y95cNSKwOEPY0MkGHjggDWqMtbiiWbMPGf UyG7fzOKR7uh//lbN4nw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qTmZN-005TAK-0K; Wed, 09 Aug 2023 17:02:01 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qTmZI-005T8B-09 for linux-arm-kernel@lists.infradead.org; Wed, 09 Aug 2023 17:01:57 +0000 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 4685C64176; Wed, 9 Aug 2023 17:01:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC994C43395; Wed, 9 Aug 2023 17:01:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691600514; bh=xPpxwJzBLsCaca6qQZWRTcviG5VQc7YuCxtBnfOO0Sc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ftjeWrM2vszKk0pjhd+iTUqKRNmgdY1xZjDlMzt5r946dcWZeTuzXpMXhTWepbwms FEyiMj65e6ZxDlJsDTz6TLJHsZUq/TGnRIy8xcd0VxzDf92xW/rZSjSvAb3scYb/od rzqe5DdkB81Dg+uPVTqCgeOzEoGH1+1J2JDsKgsDhpVf6nLCCbHivao/q9iuIKc1wr EEk77jrxEbC7B5sn6dFiQAGCRNC8XnAhX8hpGw3o0qWlY+3nqumnfRojn4UISfTW9m fOx+ywo9pD1aFXWEc6YK/OnGP/5bslpHQyanjdby3W++CMvpCH3lJVTf8sGOQWpIsx nOcbFtlOD+6IA== 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 v3 02/10] net: stmmac: xgmac: add more feature parsing from hw cap Date: Thu, 10 Aug 2023 00:49:59 +0800 Message-Id: <20230809165007.1439-3-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230809165007.1439-1-jszhang@kernel.org> References: <20230809165007.1439-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230809_100156_171775_84C4C338 X-CRM114-Status: GOOD ( 10.61 ) 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 The XGMAC_HWFEAT_GMIISEL bit also indicates whether support 10/100Mbps or not. The XGMAC_HWFEAT_HDSEL bit indicates whether support half duplex or not. The XGMAC_HWFEAT_ADDMACADRSEL bit indicates whether support Multiple MAC address registers or not. The XGMAC_HWFEAT_SMASEL bit indicates whether support SMA (MDIO) Interface or not. Signed-off-by: Jisheng Zhang Acked-by: Alexandre TORGUE --- drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h | 3 +++ drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h index 153321fe42c3..81cbb13a101d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2.h @@ -111,6 +111,7 @@ #define XGMAC_LPI_TIMER_CTRL 0x000000d4 #define XGMAC_HW_FEATURE0 0x0000011c #define XGMAC_HWFEAT_SAVLANINS BIT(27) +#define XGMAC_HWFEAT_ADDMACADRSEL GENMASK(22, 18) #define XGMAC_HWFEAT_RXCOESEL BIT(16) #define XGMAC_HWFEAT_TXCOESEL BIT(14) #define XGMAC_HWFEAT_EEESEL BIT(13) @@ -121,7 +122,9 @@ #define XGMAC_HWFEAT_MMCSEL BIT(8) #define XGMAC_HWFEAT_MGKSEL BIT(7) #define XGMAC_HWFEAT_RWKSEL BIT(6) +#define XGMAC_HWFEAT_SMASEL BIT(5) #define XGMAC_HWFEAT_VLHASH BIT(4) +#define XGMAC_HWFEAT_HDSEL BIT(3) #define XGMAC_HWFEAT_GMIISEL BIT(1) #define XGMAC_HW_FEATURE1 0x00000120 #define XGMAC_HWFEAT_L3L4FNUM GENMASK(30, 27) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c index b09395f5edcb..b5ba4e0cca55 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c @@ -406,6 +406,10 @@ static int dwxgmac2_get_hw_feature(void __iomem *ioaddr, dma_cap->pmt_remote_wake_up = (hw_cap & XGMAC_HWFEAT_RWKSEL) >> 6; dma_cap->vlhash = (hw_cap & XGMAC_HWFEAT_VLHASH) >> 4; dma_cap->mbps_1000 = (hw_cap & XGMAC_HWFEAT_GMIISEL) >> 1; + dma_cap->mbps_10_100 = (hw_cap & XGMAC_HWFEAT_GMIISEL) >> 1; + dma_cap->half_duplex = (hw_cap & XGMAC_HWFEAT_HDSEL) >> 3; + dma_cap->multi_addr = (hw_cap & XGMAC_HWFEAT_ADDMACADRSEL) >> 18; + dma_cap->sma_mdio = (hw_cap & XGMAC_HWFEAT_SMASEL) >> 5; /* MAC HW feature 1 */ hw_cap = readl(ioaddr + XGMAC_HW_FEATURE1); From patchwork Wed Aug 9 16:50:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13348222 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 5349BC001E0 for ; Wed, 9 Aug 2023 17:02:26 +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:References:In-Reply-To: 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: List-Owner; bh=rtclXvczBGS8vRBokrNR2gQJaZdikzgOacTOGFBUIoE=; b=ovFNVohFE1QD7d PSX5W6FkLa2BpslmJR7pGLVIpcVZS6AChcHEgy/wujyuLVUU3Qkc6Y80N1DfXUHTrRIwPJlchHt6g gJOgejdv4cwgcifcxbzLaytFCbrJjef7q+8t+vDImB5NtVBhHtJEt7kZzgPbhBvyA4sVHqbnq/Vgs 5klhbFgZcS2WuXo36yM2GLs9VdLTy6g6M7I0IN4MgFXLpVf0cBzADABEvoeMiU9F86x13CFzoTfxj bKq59cCTYpbuHWHZbqw9t7cWL71NPVeJMf0wpu8FdxgKiI45Av2+gTGg/1PHt5Mwf5VEH5VD5AN1Z 1HdYK+5TbWY/JrUhrM7w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qTmZN-005TAc-1q; Wed, 09 Aug 2023 17:02:01 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qTmZL-005T9V-0J for linux-arm-kernel@lists.infradead.org; Wed, 09 Aug 2023 17:02:00 +0000 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 90DA6641C9; Wed, 9 Aug 2023 17:01:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1A0FEC433CC; Wed, 9 Aug 2023 17:01:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691600518; bh=+ysItbKZr2r8wDthNuZTqSVce0mf6PlXK4jyZ+ackfA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kSJDgiKIr3wPBI9HdtaTnJjlCWTAXshygqxPj3S4cr7PjCURUYZz7K36JFeM6xEbF BpNU3bNh4yLma8AZnAxYOcZIVAO5nCrGS6bClAVsN3pAxvWajVWYqGx+TM7xGap2HD gE5BiXnxCStgeDB8Y2W5b+rU/P1l+Cihl4G7ELjOHwLbKoj6vnz7FMPR881BMu4q/P 5bdMs3VtMu6/FgGwi/cbBVfQi0UsCpxkTD6dpNu32WACbGHmNy5EXNg2etgty/bcGa wg136JAgiBACQh4iGVfUoKyXEc6s4/3Y8YjMX740JZuKDSfUSHNVdL6THRnvSufpV9 2QkNB9+jdVL/w== 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 v3 03/10] net: stmmac: mdio: enlarge the max XGMAC C22 ADDR to 31 Date: Thu, 10 Aug 2023 00:50:00 +0800 Message-Id: <20230809165007.1439-4-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230809165007.1439-1-jszhang@kernel.org> References: <20230809165007.1439-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230809_100159_181096_4AD3E749 X-CRM114-Status: GOOD ( 11.61 ) 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 The IP can support up to 31 xgmac c22 addresses now. Signed-off-by: Jisheng Zhang Acked-by: Alexandre TORGUE --- drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c index 3db1cb0fd160..e6d8e34fafef 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_mdio.c @@ -40,7 +40,7 @@ #define MII_XGMAC_WRITE (1 << MII_XGMAC_CMD_SHIFT) #define MII_XGMAC_READ (3 << MII_XGMAC_CMD_SHIFT) #define MII_XGMAC_BUSY BIT(22) -#define MII_XGMAC_MAX_C22ADDR 3 +#define MII_XGMAC_MAX_C22ADDR 31 #define MII_XGMAC_C22P_MASK GENMASK(MII_XGMAC_MAX_C22ADDR, 0) #define MII_XGMAC_PA_SHIFT 16 #define MII_XGMAC_DA_SHIFT 21 From patchwork Wed Aug 9 16:50:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13348225 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 81AC2C001E0 for ; Wed, 9 Aug 2023 17:02:37 +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:References:In-Reply-To: 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: List-Owner; bh=XB0wlS1EWNqUSNVK2GTvUKKO29Wd+SmfN591p5qPhx4=; b=nhKl5up6vZrPta 3IV9AoKzDZUypX1U4JzbdP5kImqoOQ9wbuoTpRC9oeoXsNThK1VoYpOYsEDUSgeWGU0CHOct5r/gp DBeAhHyXytgwDRQGGdvDwhz2WLLLFqBI7XsKsgcKcda+fzft1dNZnTBSFg7C7mXJzIfq+mz0LVNI/ /YDB4Boj2xIlbRbSOlkcyKu2RSmPHvxPQxdTuDXnVS0USXO/rIje+XqlvlntqZJpOhcc4ZLR53/Cc Ou8WCa4lOI9t9VKfsFT6SP4WbB9ZINMM0bU0kjCh8vcHTW4rhf+gh1XJ8eyqKh719vaPZXCWJuqnK ROnfkeqiQC8aFxsghl4A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qTmZV-005TEk-1J; Wed, 09 Aug 2023 17:02:09 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qTmZO-005TB2-13 for linux-arm-kernel@lists.infradead.org; Wed, 09 Aug 2023 17:02:03 +0000 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 B6A256417B; Wed, 9 Aug 2023 17:02:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5F458C433CD; Wed, 9 Aug 2023 17:01:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691600520; bh=DE4uo4JK2isjtFObJJyFLlrT5b6CK5kuMo4uw+Jhg2c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JFN6RYl+M59YpWe19hAChu5SWzQB35nUp6hDH8BPSvUnpKx+NF67xEXL973v0+iFA TGP89k4RRXhABdvN2W/azWDTKPMFI8EdXLVK3dM9dpW0tPGHNrrZ9+/JZlbAR4G2Jo ZeZ1O0hxTM4wpzr04uaJaAj1HVdeeVB9UOjW6P6a9aSf72SMMtlE63TtxQLvwdvrg6 FMQSzTEIbp4Aygb5LqkP5LD6HB/89fr7vnxDbBzniKXx9RmhvU31Y0QcQ2jF9m2DgG h7S5q3X4/qYytyNUkhxXsgc/CtiJziehwwDwnqjTeXW28QF7JDPGLuFT3wIIG7O+pS YcsQZk9Y4C4yA== 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 v3 04/10] net: stmmac: enlarge max rx/tx queues and channels to 16 Date: Thu, 10 Aug 2023 00:50:01 +0800 Message-Id: <20230809165007.1439-5-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230809165007.1439-1-jszhang@kernel.org> References: <20230809165007.1439-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230809_100202_403305_570B165F X-CRM114-Status: GOOD ( 12.50 ) 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 xgmac supports up to 16 rx/tx queues and up to 16 channels. Signed-off-by: Jisheng Zhang Acked-by: Alexandre TORGUE --- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c | 5 ++--- include/linux/stmmac.h | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c index a0c2ef8bb0ac..aaae82d3d9dc 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c @@ -202,9 +202,8 @@ static void dwxgmac2_map_mtl_to_dma(struct mac_device_info *hw, u32 queue, void __iomem *ioaddr = hw->pcsr; u32 value, reg; - reg = (queue < 4) ? XGMAC_MTL_RXQ_DMA_MAP0 : XGMAC_MTL_RXQ_DMA_MAP1; - if (queue >= 4) - queue -= 4; + reg = XGMAC_MTL_RXQ_DMA_MAP0 + (queue & ~0x3); + queue &= 0x3; value = readl(ioaddr + reg); value &= ~XGMAC_QxMDMACH(queue); diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index ef67dba775d0..11671fd6adee 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -15,9 +15,9 @@ #include #include -#define MTL_MAX_RX_QUEUES 8 -#define MTL_MAX_TX_QUEUES 8 -#define STMMAC_CH_MAX 8 +#define MTL_MAX_RX_QUEUES 16 +#define MTL_MAX_TX_QUEUES 16 +#define STMMAC_CH_MAX 16 #define STMMAC_RX_COE_NONE 0 #define STMMAC_RX_COE_TYPE1 1 From patchwork Wed Aug 9 16:50:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13348226 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 318E2C41513 for ; Wed, 9 Aug 2023 17:02:41 +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:References:In-Reply-To: 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: List-Owner; bh=hLn9MOw137Ere7ctZZUfF5H1jT0LakKUEqZWhG8UfIA=; b=y9KU2tNq1IUxnP TXYRoHjGf2DlqPA43i7TGmk0aNNreJeUUyA3jXfRdKaFFCJT4MxlOg6bQP6ljOyfbje04lbVAq2/9 ySBRogB0wcTDQ/dbNgCn8x3IA9cAEn62mbHDVtKG52O8iembIFljbhovAqECLQfnySBvPfH1gs6di 4EkyrmOqBgUf0YnJQY9XnW1MOekAMBKj0rFzJ05QvK1wjUCnoegqKK3DlRhQyfq3wheg2l5aI1VcI 1KAe6N8HnmfO9fR4PxDMX++Hv6p3uyldkzkwGt0y7szZd4lBk3jtHNUgp2jF32/A8P17vJoWt+G+y 0k4Az3t2UenP3n5RwTMA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qTmZV-005TFT-38; Wed, 09 Aug 2023 17:02:09 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qTmZQ-005TCM-3D for linux-arm-kernel@lists.infradead.org; Wed, 09 Aug 2023 17:02:07 +0000 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 64903641D3; Wed, 9 Aug 2023 17:02:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4E9D7C433C9; Wed, 9 Aug 2023 17:02:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691600523; bh=WYZtdfxDSNw9B+qNMFLdT206U/oHYajMdyw1mHyU1go=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EIqeT8gR5t01YZTbcT3H/SeM22/g1KthXDkJ+jNZXECi135sPuznPxZ9EKWSOd9Z0 +E1J96k/s8djVqQF3erkve/8XraqBLblki820aI3o/4nblU6Nw2/xwsi5TKYcYDNgi Kvf0XYIqVguz/25Juc+C33TzpNY7MJRmZ3Us5haw8vZe0c+K+JqYLIAxIaucshuU6f aPrVd1v4Nx2tTqYdU/mKGFsJXwppHjAjC8gKP9yILrbu2XSPXYBc/d/yGX5gUWwQzO JvunHlUjT/1R9jhvY2DJv2lRZdESSq2yckgh5QZ1pNaxO0v/rk7nzGxNuqkRL5b4tU cKEVLJe9CuByg== 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 v3 05/10] net: stmmac: reflect multi irqs for tx/rx channels and mac and safety Date: Thu, 10 Aug 2023 00:50:02 +0800 Message-Id: <20230809165007.1439-6-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230809165007.1439-1-jszhang@kernel.org> References: <20230809165007.1439-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230809_100205_141743_26066A17 X-CRM114-Status: GOOD ( 20.79 ) 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 The IP supports per channel interrupt, when intel adds the per channel interrupt support, the per channel irq is from MSI vector, but this feature can also be supported on non-MSI platforms. Do some necessary renaming to reflects this fact. Signed-off-by: Jisheng Zhang --- .../net/ethernet/stmicro/stmmac/dwmac-intel.c | 4 +- .../net/ethernet/stmicro/stmmac/dwmac4_dma.c | 2 +- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 48 +++++++++---------- include/linux/stmmac.h | 4 +- 4 files changed, 29 insertions(+), 29 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c index 0ffae785d8bd..99a072907008 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c @@ -953,7 +953,7 @@ static int stmmac_config_single_msi(struct pci_dev *pdev, res->irq = pci_irq_vector(pdev, 0); res->wol_irq = res->irq; - plat->flags &= ~STMMAC_FLAG_MULTI_MSI_EN; + plat->flags &= ~STMMAC_FLAG_PERCH_IRQ_EN; dev_info(&pdev->dev, "%s: Single IRQ enablement successful\n", __func__); @@ -1005,7 +1005,7 @@ static int stmmac_config_multi_msi(struct pci_dev *pdev, if (plat->msi_sfty_ue_vec < STMMAC_MSI_VEC_MAX) res->sfty_ue_irq = pci_irq_vector(pdev, plat->msi_sfty_ue_vec); - plat->flags |= STMMAC_FLAG_MULTI_MSI_EN; + plat->flags |= STMMAC_FLAG_PERCH_IRQ_EN; dev_info(&pdev->dev, "%s: multi MSI enablement successful\n", __func__); return 0; diff --git a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c index 84d3a8551b03..9bf8adf466a2 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac4_dma.c @@ -175,7 +175,7 @@ static void dwmac4_dma_init(void __iomem *ioaddr, value = readl(ioaddr + DMA_BUS_MODE); - if (dma_cfg->multi_msi_en) { + if (dma_cfg->perch_irq_en) { value &= ~DMA_BUS_MODE_INTM_MASK; value |= (DMA_BUS_MODE_INTM_MODE1 << DMA_BUS_MODE_INTM_SHIFT); } diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 15ed3947361b..4ed5c976c7a3 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -125,11 +125,11 @@ module_param(chain_mode, int, 0444); MODULE_PARM_DESC(chain_mode, "To use chain instead of ring mode"); static irqreturn_t stmmac_interrupt(int irq, void *dev_id); -/* For MSI interrupts handling */ +/* For multi interrupts handling */ static irqreturn_t stmmac_mac_interrupt(int irq, void *dev_id); static irqreturn_t stmmac_safety_interrupt(int irq, void *dev_id); -static irqreturn_t stmmac_msi_intr_tx(int irq, void *data); -static irqreturn_t stmmac_msi_intr_rx(int irq, void *data); +static irqreturn_t stmmac_queue_intr_tx(int irq, void *data); +static irqreturn_t stmmac_queue_intr_rx(int irq, void *data); static void stmmac_reset_rx_queue(struct stmmac_priv *priv, u32 queue); static void stmmac_reset_tx_queue(struct stmmac_priv *priv, u32 queue); static void stmmac_reset_queues_param(struct stmmac_priv *priv); @@ -3513,7 +3513,7 @@ static void stmmac_free_irq(struct net_device *dev, } } -static int stmmac_request_irq_multi_msi(struct net_device *dev) +static int stmmac_request_irq_multi(struct net_device *dev) { struct stmmac_priv *priv = netdev_priv(dev); enum request_irq_err irq_err; @@ -3530,7 +3530,7 @@ static int stmmac_request_irq_multi_msi(struct net_device *dev) 0, int_name, dev); if (unlikely(ret < 0)) { netdev_err(priv->dev, - "%s: alloc mac MSI %d (error: %d)\n", + "%s: alloc mac irq %d (error: %d)\n", __func__, dev->irq, ret); irq_err = REQ_IRQ_ERR_MAC; goto irq_error; @@ -3547,7 +3547,7 @@ static int stmmac_request_irq_multi_msi(struct net_device *dev) 0, int_name, dev); if (unlikely(ret < 0)) { netdev_err(priv->dev, - "%s: alloc wol MSI %d (error: %d)\n", + "%s: alloc wol irq %d (error: %d)\n", __func__, priv->wol_irq, ret); irq_err = REQ_IRQ_ERR_WOL; goto irq_error; @@ -3565,7 +3565,7 @@ static int stmmac_request_irq_multi_msi(struct net_device *dev) 0, int_name, dev); if (unlikely(ret < 0)) { netdev_err(priv->dev, - "%s: alloc lpi MSI %d (error: %d)\n", + "%s: alloc lpi irq %d (error: %d)\n", __func__, priv->lpi_irq, ret); irq_err = REQ_IRQ_ERR_LPI; goto irq_error; @@ -3583,7 +3583,7 @@ static int stmmac_request_irq_multi_msi(struct net_device *dev) 0, int_name, dev); if (unlikely(ret < 0)) { netdev_err(priv->dev, - "%s: alloc sfty ce MSI %d (error: %d)\n", + "%s: alloc sfty ce irq %d (error: %d)\n", __func__, priv->sfty_ce_irq, ret); irq_err = REQ_IRQ_ERR_SFTY_CE; goto irq_error; @@ -3601,14 +3601,14 @@ static int stmmac_request_irq_multi_msi(struct net_device *dev) 0, int_name, dev); if (unlikely(ret < 0)) { netdev_err(priv->dev, - "%s: alloc sfty ue MSI %d (error: %d)\n", + "%s: alloc sfty ue irq %d (error: %d)\n", __func__, priv->sfty_ue_irq, ret); irq_err = REQ_IRQ_ERR_SFTY_UE; goto irq_error; } } - /* Request Rx MSI irq */ + /* Request Rx queue irq */ for (i = 0; i < priv->plat->rx_queues_to_use; i++) { if (i >= MTL_MAX_RX_QUEUES) break; @@ -3618,11 +3618,11 @@ static int stmmac_request_irq_multi_msi(struct net_device *dev) int_name = priv->int_name_rx_irq[i]; sprintf(int_name, "%s:%s-%d", dev->name, "rx", i); ret = request_irq(priv->rx_irq[i], - stmmac_msi_intr_rx, + stmmac_queue_intr_rx, 0, int_name, &priv->dma_conf.rx_queue[i]); if (unlikely(ret < 0)) { netdev_err(priv->dev, - "%s: alloc rx-%d MSI %d (error: %d)\n", + "%s: alloc rx-%d irq %d (error: %d)\n", __func__, i, priv->rx_irq[i], ret); irq_err = REQ_IRQ_ERR_RX; irq_idx = i; @@ -3633,7 +3633,7 @@ static int stmmac_request_irq_multi_msi(struct net_device *dev) irq_set_affinity_hint(priv->rx_irq[i], &cpu_mask); } - /* Request Tx MSI irq */ + /* Request Tx queue irq */ for (i = 0; i < priv->plat->tx_queues_to_use; i++) { if (i >= MTL_MAX_TX_QUEUES) break; @@ -3643,11 +3643,11 @@ static int stmmac_request_irq_multi_msi(struct net_device *dev) int_name = priv->int_name_tx_irq[i]; sprintf(int_name, "%s:%s-%d", dev->name, "tx", i); ret = request_irq(priv->tx_irq[i], - stmmac_msi_intr_tx, + stmmac_queue_intr_tx, 0, int_name, &priv->dma_conf.tx_queue[i]); if (unlikely(ret < 0)) { netdev_err(priv->dev, - "%s: alloc tx-%d MSI %d (error: %d)\n", + "%s: alloc tx-%d irq %d (error: %d)\n", __func__, i, priv->tx_irq[i], ret); irq_err = REQ_IRQ_ERR_TX; irq_idx = i; @@ -3722,8 +3722,8 @@ static int stmmac_request_irq(struct net_device *dev) int ret; /* Request the IRQ lines */ - if (priv->plat->flags & STMMAC_FLAG_MULTI_MSI_EN) - ret = stmmac_request_irq_multi_msi(dev); + if (priv->plat->flags & STMMAC_FLAG_PERCH_IRQ_EN) + ret = stmmac_request_irq_multi(dev); else ret = stmmac_request_irq_single(dev); @@ -5938,7 +5938,7 @@ static irqreturn_t stmmac_safety_interrupt(int irq, void *dev_id) return IRQ_HANDLED; } -static irqreturn_t stmmac_msi_intr_tx(int irq, void *data) +static irqreturn_t stmmac_queue_intr_tx(int irq, void *data) { struct stmmac_tx_queue *tx_q = (struct stmmac_tx_queue *)data; struct stmmac_dma_conf *dma_conf; @@ -5970,7 +5970,7 @@ static irqreturn_t stmmac_msi_intr_tx(int irq, void *data) return IRQ_HANDLED; } -static irqreturn_t stmmac_msi_intr_rx(int irq, void *data) +static irqreturn_t stmmac_queue_intr_rx(int irq, void *data) { struct stmmac_rx_queue *rx_q = (struct stmmac_rx_queue *)data; struct stmmac_dma_conf *dma_conf; @@ -6007,12 +6007,12 @@ static void stmmac_poll_controller(struct net_device *dev) if (test_bit(STMMAC_DOWN, &priv->state)) return; - if (priv->plat->flags & STMMAC_FLAG_MULTI_MSI_EN) { + if (priv->plat->flags & STMMAC_FLAG_PERCH_IRQ_EN) { for (i = 0; i < priv->plat->rx_queues_to_use; i++) - stmmac_msi_intr_rx(0, &priv->dma_conf.rx_queue[i]); + stmmac_queue_intr_rx(0, &priv->dma_conf.rx_queue[i]); for (i = 0; i < priv->plat->tx_queues_to_use; i++) - stmmac_msi_intr_tx(0, &priv->dma_conf.tx_queue[i]); + stmmac_queue_intr_tx(0, &priv->dma_conf.tx_queue[i]); } else { disable_irq(dev->irq); stmmac_interrupt(dev->irq, dev); @@ -7278,8 +7278,8 @@ int stmmac_dvr_probe(struct device *device, priv->plat = plat_dat; priv->ioaddr = res->addr; priv->dev->base_addr = (unsigned long)res->addr; - priv->plat->dma_cfg->multi_msi_en = - (priv->plat->flags & STMMAC_FLAG_MULTI_MSI_EN); + priv->plat->dma_cfg->perch_irq_en = + (priv->plat->flags & STMMAC_FLAG_PERCH_IRQ_EN); priv->dev->irq = res->irq; priv->wol_irq = res->wol_irq; diff --git a/include/linux/stmmac.h b/include/linux/stmmac.h index 11671fd6adee..76249117c0ff 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -96,7 +96,7 @@ struct stmmac_dma_cfg { int mixed_burst; bool aal; bool eame; - bool multi_msi_en; + bool perch_irq_en; bool dche; }; @@ -211,7 +211,7 @@ struct dwmac4_addrs { #define STMMAC_FLAG_TSO_EN BIT(4) #define STMMAC_FLAG_SERDES_UP_AFTER_PHY_LINKUP BIT(5) #define STMMAC_FLAG_VLAN_FAIL_Q_EN BIT(6) -#define STMMAC_FLAG_MULTI_MSI_EN BIT(7) +#define STMMAC_FLAG_PERCH_IRQ_EN BIT(7) #define STMMAC_FLAG_EXT_SNAPSHOT_EN BIT(8) #define STMMAC_FLAG_INT_SNAPSHOT_EN BIT(9) #define STMMAC_FLAG_RX_CLK_RUNS_IN_LPI BIT(10) From patchwork Wed Aug 9 16:50:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13348228 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 4D88EC04A94 for ; Wed, 9 Aug 2023 17:02:46 +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:References:In-Reply-To: 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: List-Owner; bh=AoF4rb6JJ0HvhlmQSMydJa6fVKA8tM1WDxORJSZaKpA=; b=tkBE+lpcTDiL1Q dRl9hQs6zowpTH+HAxnBFdJvYkAdvqVZG0TVbdXZnUXh5M/khMo3bXVWWL0MEbddwNiQUIvZ/G/uC sc3DNetmAYxIm1GeMTULnCEk0R/ilHoA+WMMJaQd1y0VTCPn59Nzgap5ZnMA0WE5ydiA32VapKyGP JVMz8RszXO9HGDd7JSqnqFN72fGL8PPqmL5QX830Hq0zeD9ZR+NaZK1tupj6iVO6ctcPKpsiiplQo AuFmCG1EWYnRx+U/CBkd7GTx32lQHd8Yx6EORGudTnq7RT2sn38W2bxCQBkqII9qyKf4/HEqp9v17 WSV36O+CMG/mVmfR5pRg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qTmZd-005TKR-1A; Wed, 09 Aug 2023 17:02:17 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qTmZT-005TDr-2n for linux-arm-kernel@lists.infradead.org; Wed, 09 Aug 2023 17:02:09 +0000 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 621866417B; Wed, 9 Aug 2023 17:02:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37D95C43395; Wed, 9 Aug 2023 17:02:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691600526; bh=ucsnwmWqR4ajtwvJh+GfJymKYMLxktOm7tZoJmtvJZc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LUSMVXRRg2tQ3f42c6Dng7Hbnj0dxTrNxeuqwtKoqLiiWrNEKVjs60WZnXAGsaCrj o0vz7iTNu6P/jfcgylqQDOX5qDxj/HnsNAXtd92WufwOcCIIdBrmS0sVQ1JbOnHuNg Csqx2bbaMMyg2a3Q6lqsRb03HMlnjfD0zZIU/Zxgu0jjYcdnOAssbXH91X1dwDjpJO YgS6t5qN4It8GYVV/zJHdFMj6o5N9Ye7mrxFRsPj+eLo/y3yRN1Q4gKM9O2HQUdJk7 dLzmfZnobGEZY2F63isE6oDU6pZ6CS66pgU1nlX69LkYdDHfPD6UipvkVMzCGiMP9D SIRupHLJahZaQ== 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 v3 06/10] net: stmmac: xgmac: support per-channel irq Date: Thu, 10 Aug 2023 00:50:03 +0800 Message-Id: <20230809165007.1439-7-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230809165007.1439-1-jszhang@kernel.org> References: <20230809165007.1439-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230809_100207_986931_DCD9FE75 X-CRM114-Status: GOOD ( 13.01 ) 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 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)); From patchwork Wed Aug 9 16:50:04 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13348227 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 57CE3C0015E for ; Wed, 9 Aug 2023 17:02:44 +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:References:In-Reply-To: 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: List-Owner; bh=X824vFexoRYA0qpdNumZuhSxWOdk9Nq4lWn5jOtCdbo=; b=vHYyoty+LY3Ubt 6mT7zOQUDB3JfS1wCsOyX5zXJ+Rg3ZIoWm5ogF0saFCb4tHXNhbtZYI1qbepNFvOGUHDvrqZJ60Ai JBHycsuK4W48BULn+DPgk5rqZdWy6s5VKbY3e8nVcScKIW60Z0mgmC/l9ScT/pw9J13GopvT4uXMp VQ9tUbRzqUrSnKTGyNSD9CVOoH5zpwkxMZiXcyzfVfadDTMNoNazYCPjvSJljPaxo0O6+bKkAEJeK UhdvsjpzFi3/5OZB7m8Y4YAubTPR3py3UBSYu0wRmqlDYn+hxQfTyLghsqkobHtPD8l+pQdlke/Wn Q7UlHlw8eiJ53gyZqDBA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qTmZe-005TLP-0W; Wed, 09 Aug 2023 17:02:18 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qTmZW-005TFz-1u for linux-arm-kernel@lists.infradead.org; Wed, 09 Aug 2023 17:02:11 +0000 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 F15656417B; Wed, 9 Aug 2023 17:02:09 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 24935C433CA; Wed, 9 Aug 2023 17:02:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691600529; bh=DbCsnFuIRCDw4RClbgLWL7mrfxpciKVOySkovPw9qFo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Xl4PJ9ZwiSDgL82Q6u5+9jGBcBpVFwZX1fzaQqnb2Voy0lE9UgqIs4Habkmk+a6tG CKWlECVyKR9MozeH7HHnHAI2O32KO0AEEGrXGoUIfE9h+ME/MSac6G/gz7eyjdevam Q5v2iDKA6/x9O28fgQTh/90SGLo2xwRz46LoPb8/L2nKFU/TCvXaEqtCltiq+ovOs2 +U/gPUMk1AZXQ/KoN4+prZY62WnpFfUTvG2Ggn0h3yLsybzQIFKaEdMQ6aYmZQ/mxt O5X52I4i9nBQ1l2pUlyLq46UOKsWYdfJyY81vNVjIrVz0AjIA1ObkyHaNeop7toe/k 9IJ8c9MEBGbgg== 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 v3 07/10] dt-bindings: net: snps,dwmac: add safety irq support Date: Thu, 10 Aug 2023 00:50:04 +0800 Message-Id: <20230809165007.1439-8-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230809165007.1439-1-jszhang@kernel.org> References: <20230809165007.1439-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230809_100210_685271_836321E8 X-CRM114-Status: UNSURE ( 9.51 ) X-CRM114-Notice: Please train this message. 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 The snps dwmac IP support safety features, and those Safety Feature Correctible Error and Uncorrectible Error irqs may be separate irqs. Signed-off-by: Jisheng Zhang --- Documentation/devicetree/bindings/net/snps,dwmac.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml index ddf9522a5dc2..5d81042f5634 100644 --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml @@ -107,6 +107,8 @@ properties: - description: Combined signal for various interrupt events - description: The interrupt to manage the remote wake-up packet detection - description: The interrupt that occurs when Rx exits the LPI state + - description: The interrupt that occurs when Safety Feature Correctible Errors happen + - description: The interrupt that occurs when Safety Feature Uncorrectible Errors happen interrupt-names: minItems: 1 @@ -114,6 +116,8 @@ properties: - const: macirq - enum: [eth_wake_irq, eth_lpi] - const: eth_lpi + - const: sfty_ce + - const: sfty_ue clocks: minItems: 1 From patchwork Wed Aug 9 16:50:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13348229 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 D6E7FC0015E for ; Wed, 9 Aug 2023 17:02:49 +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:References:In-Reply-To: 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: List-Owner; bh=XYpYrgnMgKRbxsCGFouKKIz5zJXC1fDvHtPE/Gvlvhc=; b=JxB5zsr5pLesOy wKnQaGwa/GTiyp+CuIkLzfxSAxF5m0NLovQgBn68HA1nbNvy9PbSwbpL8jG3ysEwoH2vNmx7BOJLN /iKz18ySAMVyyBJ3oSLaF6tQLsuvkNZv63mifxD3Q111nokflgdUvg9aIOVnirluJ9B1HAS/fyw/P dHkjzQh0xNERY71Amn8XvejqWsTTj6SMYnSdo+D81Tz67sTbM+xUqjO3QU6AHYduKXBpF6JJDtC9M s846fcT4oT8manOMP0gO6MpsITRAsGnUZC28jIViw0zHUOrqAkvpqlTuYw8cB7j6o5narkC2XXs03 x65+vlPznk+yzCZAT37w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qTmZf-005TMI-14; Wed, 09 Aug 2023 17:02:19 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qTmZa-005TI9-0g for linux-arm-kernel@lists.infradead.org; Wed, 09 Aug 2023 17:02:15 +0000 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 A29A56415A; Wed, 9 Aug 2023 17:02:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2E6C6C433CC; Wed, 9 Aug 2023 17:02:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691600533; bh=2GxVXefyNbdQErExbmg0/pws/HcbyG4JyeKhzXvRnBE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=L4FQ928xApvJhFE7Tj8KKEoOwWeAcsCs7IVHfjo54UzZhuYT+1/itilrbXbRAkTot aygKFrqatHRVmboBFOzHoObEJlmsElo6lDTz74RBj6An9R/fnCu2HlOwl2+RB6C1Tf +FLLxeQp+C5lGV8MtsdKsRV5EoxRSLGnzH8SGey+kA1k2KlB2z5OZRmvJg1260d3hR KJAWgfmAq2wIgT0c47FDz0u20m2QnpPLoqsa9KeRBLAyemWGdPr+b+RSi3plJ6z+Ke j1BtCa/bbeGCxRgRp0pyJZunGA1HUrosCZQPLTZJzOg/Hid0gOD1reZKA8wQ3ZDcNS 0Y4oJ9Gsm6AXQ== 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 v3 08/10] net: stmmac: platform: support parsing safety irqs from DT Date: Thu, 10 Aug 2023 00:50:05 +0800 Message-Id: <20230809165007.1439-9-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230809165007.1439-1-jszhang@kernel.org> References: <20230809165007.1439-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230809_100214_292503_C6FC3C16 X-CRM114-Status: GOOD ( 11.11 ) 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 The snps dwmac IP may support safety features, and those Safety Feature Correctible Error and Uncorrectible Error irqs may be separate irqs. Add support to parse the safety irqs from DT. Signed-off-by: Jisheng Zhang Acked-by: Alexandre TORGUE --- .../net/ethernet/stmicro/stmmac/stmmac_platform.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 23d53ea04b24..29145682b57b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -738,6 +738,18 @@ int stmmac_get_platform_resources(struct platform_device *pdev, dev_info(&pdev->dev, "IRQ eth_lpi not found\n"); } + stmmac_res->sfty_ce_irq = platform_get_irq_byname_optional(pdev, "sfty_ce"); + if (stmmac_res->sfty_ce_irq < 0) { + if (stmmac_res->sfty_ce_irq == -EPROBE_DEFER) + return -EPROBE_DEFER; + } + + stmmac_res->sfty_ue_irq = platform_get_irq_byname_optional(pdev, "sfty_ue"); + if (stmmac_res->sfty_ue_irq < 0) { + if (stmmac_res->sfty_ue_irq == -EPROBE_DEFER) + return -EPROBE_DEFER; + } + stmmac_res->addr = devm_platform_ioremap_resource(pdev, 0); return PTR_ERR_OR_ZERO(stmmac_res->addr); From patchwork Wed Aug 9 16:50:06 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13348230 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 D2DBEC04A94 for ; Wed, 9 Aug 2023 17:02:57 +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:References:In-Reply-To: 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: List-Owner; bh=FbkWDNROpVD9Z3BNrtthPdVA5c5p3ExLf1EPLS/9xbQ=; b=v8S5diKKa1k9Iv fc22kfFxLrJN8mxZHx51Z5YU2Jv/OVKY8gJgkxbgF+NLX8s8WVGtjngS43VPuo0EOV/EKLrZEkc4C znF7wV8BFoHxeUvVcHROV4HEzjB3Pz3BN4AvNCD4EnQcJbEsRi2KSdKzzQL2N+HkP6lglOe1c/bt+ FmWAW0fZVR/qp5F6P4GhFja/tMsN7az0uQncfM7lnpHZoVencqIHrljJanaPhn/pHRASPvwbH4iaa pSz7vlMDur1QfaGLbabyhSxoa7FTAxoBugr9r4wYX9apx+mFTL5kflx1HByAXiHFaVBoc1POfd9bf VF2VwaLjNy9wKSGi0mhA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qTmZp-005TTw-0R; Wed, 09 Aug 2023 17:02:29 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qTmZd-005TK4-0d for linux-arm-kernel@lists.infradead.org; Wed, 09 Aug 2023 17:02:18 +0000 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 B681D64205; Wed, 9 Aug 2023 17:02:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 656F6C433C8; Wed, 9 Aug 2023 17:02:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691600536; bh=+gV2OwgbEESWlTBw1vccjy1Lziej65rySDz1k5zLKn4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=niUMi23cuW63S1k46u9PkZlkcaUSZok42j5k2gcuTvEtlUpzFZt2xQz+it9W81a2e 5J1x8dqycYRIOpb/XWG1KMiG45wbJqJGNVUIMEng6vKmrNoDV9EuxkdTy25t+CvSdk hzaAJT9UH7CpGMUZd696Suf2pySmDe9uNYjkdO8IqVopyMiXMNWJIH7M1yH7j3ZRtw vdoQ2TCpoGAaddKyP9fcWxQ/5oxCEqFz7GI4+Jk1tltCNwTLodTaPleSec9DNZYx2m egZCVPR2nEyN6kKnphiKNIzaG7rn4Ko26Ac0U0U6n/T5REhgGkn9khLyg+ziPFw6hB j7PJ+1A6XR16g== 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 v3 09/10] dt-bindings: net: snps,dwmac: add per channel irq support Date: Thu, 10 Aug 2023 00:50:06 +0800 Message-Id: <20230809165007.1439-10-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230809165007.1439-1-jszhang@kernel.org> References: <20230809165007.1439-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230809_100217_285123_E12CD5D9 X-CRM114-Status: UNSURE ( 8.96 ) X-CRM114-Notice: Please train this message. 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 The IP supports per channel interrupt, add support for this usage case. Signed-off-by: Jisheng Zhang --- .../devicetree/bindings/net/snps,dwmac.yaml | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml index 5d81042f5634..5a63302ad200 100644 --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml @@ -109,6 +109,7 @@ properties: - description: The interrupt that occurs when Rx exits the LPI state - description: The interrupt that occurs when Safety Feature Correctible Errors happen - description: The interrupt that occurs when Safety Feature Uncorrectible Errors happen + - description: All of the rx/tx per-channel interrupts interrupt-names: minItems: 1 @@ -118,6 +119,38 @@ properties: - const: eth_lpi - const: sfty_ce - const: sfty_ue + - const: rx0 + - const: rx1 + - const: rx2 + - const: rx3 + - const: rx4 + - const: rx5 + - const: rx6 + - const: rx7 + - const: rx8 + - const: rx9 + - const: rx10 + - const: rx11 + - const: rx12 + - const: rx13 + - const: rx14 + - const: rx15 + - const: tx0 + - const: tx1 + - const: tx2 + - const: tx3 + - const: tx4 + - const: tx5 + - const: tx6 + - const: tx7 + - const: tx8 + - const: tx9 + - const: tx10 + - const: tx11 + - const: tx12 + - const: tx13 + - const: tx14 + - const: tx15 clocks: minItems: 1 From patchwork Wed Aug 9 16:50:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13348231 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 71CA6C0015E for ; Wed, 9 Aug 2023 17:02:57 +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:References:In-Reply-To: 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: List-Owner; bh=YkD7UrCLPI+u4LKleLc6m7k+8wOEvShbZ/bQ/PVtfTs=; b=BJE3l6Gla1zKkH 8luo6PFt+wCFzjouqPj9RvULwhOG17u2Jacc1Xckg+l9n27VBjHcDidrBekkiOGPM3C/fpUI58yq/ d5iJrLTu3d5gnntvA5xFn0YlcYJcAcaYFbJ+ZVnaU0G/0WIYY/r4VJxZVeHbG7ZhpF9/KKScxPcYe /bmKCInZDqLwAdNupI/dkKfbpgpTVsHebe/ew/glLcT79sdOspFx/Z08Ra2DiOSYWbMS4pIW4USkk 7mMVJgFReHi10pieiIJzZpiVmj/EbzYJbTrjHTGOuqya81qguSHtGTHT9jDas7qJFx9J9/P8vfcPo NeVYCjYPbt702G6btzlA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qTmZp-005TUk-2o; Wed, 09 Aug 2023 17:02:29 +0000 Received: from dfw.source.kernel.org ([2604:1380:4641:c500::1]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qTmZg-005TNZ-2g for linux-arm-kernel@lists.infradead.org; Wed, 09 Aug 2023 17:02:22 +0000 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 5B15964209; Wed, 9 Aug 2023 17:02:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 79766C433C9; Wed, 9 Aug 2023 17:02:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691600539; bh=V902vE1qSD2W3x2PVyeCERNpVhnCPf/lW+x8V8GU3+c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WMhObEz5TS7bF/kYtzmy4aPzQwZnwrQiIUPdi+fZLiNzwNXpknALfGhoph6tHbTiG BZMzORKMJsl/ZkjiBKT1hrT9wLy0SxIuNk8kyuQZHCaYuBQaM+QPIwX9RrrcKs1MT4 3ZbDQqBlAV9u9UxQD/3W/uRN/mvfPIBKWPZ2etvp5VozRvGepNB4tCXX5aA71VNXDv 6hd7C2M/s9dOrNPRciF6y+GRo6sTTkCulpdXObeNmR8ZN9p+eC28ayEkVpnOTJajS8 COXV4YcfTMFVTsZr9bXWXU1cVs9ydrLcLPrgJCT9TmuYXD7FviPsaNwwNjnQIi2iQy GHGT5DXoFKqsg== 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 v3 10/10] net: stmmac: platform: support parsing per channel irq from DT Date: Thu, 10 Aug 2023 00:50:07 +0800 Message-Id: <20230809165007.1439-11-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230809165007.1439-1-jszhang@kernel.org> References: <20230809165007.1439-1-jszhang@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230809_100220_958189_482E2308 X-CRM114-Status: GOOD ( 16.40 ) 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 The snps dwmac IP may support per channel interrupt. Add support to parse the per channel irq from DT. Signed-off-by: Jisheng Zhang --- .../net/ethernet/stmicro/stmmac/stmmac_main.c | 10 ++++---- .../ethernet/stmicro/stmmac/stmmac_platform.c | 23 +++++++++++++++++++ 2 files changed, 29 insertions(+), 4 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 4ed5c976c7a3..245eeb7d3e83 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3612,7 +3612,7 @@ static int stmmac_request_irq_multi(struct net_device *dev) for (i = 0; i < priv->plat->rx_queues_to_use; i++) { if (i >= MTL_MAX_RX_QUEUES) break; - if (priv->rx_irq[i] == 0) + if (priv->rx_irq[i] <= 0) continue; int_name = priv->int_name_rx_irq[i]; @@ -3637,7 +3637,7 @@ static int stmmac_request_irq_multi(struct net_device *dev) for (i = 0; i < priv->plat->tx_queues_to_use; i++) { if (i >= MTL_MAX_TX_QUEUES) break; - if (priv->tx_irq[i] == 0) + if (priv->tx_irq[i] <= 0) continue; int_name = priv->int_name_tx_irq[i]; @@ -7278,8 +7278,10 @@ int stmmac_dvr_probe(struct device *device, priv->plat = plat_dat; priv->ioaddr = res->addr; priv->dev->base_addr = (unsigned long)res->addr; - priv->plat->dma_cfg->perch_irq_en = - (priv->plat->flags & STMMAC_FLAG_PERCH_IRQ_EN); + if (res->rx_irq[0] > 0 && res->tx_irq[0] > 0) { + priv->plat->flags |= STMMAC_FLAG_PERCH_IRQ_EN; + priv->plat->dma_cfg->perch_irq_en = true; + } priv->dev->irq = res->irq; priv->wol_irq = res->wol_irq; diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index 29145682b57b..9b46775b41ab 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -705,6 +705,9 @@ EXPORT_SYMBOL_GPL(stmmac_remove_config_dt); int stmmac_get_platform_resources(struct platform_device *pdev, struct stmmac_resources *stmmac_res) { + char irq_name[8]; + int i; + memset(stmmac_res, 0, sizeof(*stmmac_res)); /* Get IRQ information early to have an ability to ask for deferred @@ -738,6 +741,26 @@ int stmmac_get_platform_resources(struct platform_device *pdev, dev_info(&pdev->dev, "IRQ eth_lpi not found\n"); } + for (i = 0; i < MTL_MAX_RX_QUEUES; i++) { + snprintf(irq_name, sizeof(irq_name), "rx%i", i); + stmmac_res->rx_irq[i] = platform_get_irq_byname_optional(pdev, irq_name); + if (stmmac_res->rx_irq[i] < 0) { + if (stmmac_res->rx_irq[i] == -EPROBE_DEFER) + return -EPROBE_DEFER; + break; + } + } + + for (i = 0; i < MTL_MAX_TX_QUEUES; i++) { + snprintf(irq_name, sizeof(irq_name), "tx%i", i); + stmmac_res->tx_irq[i] = platform_get_irq_byname_optional(pdev, irq_name); + if (stmmac_res->tx_irq[i] < 0) { + if (stmmac_res->tx_irq[i] == -EPROBE_DEFER) + return -EPROBE_DEFER; + break; + } + } + stmmac_res->sfty_ce_irq = platform_get_irq_byname_optional(pdev, "sfty_ce"); if (stmmac_res->sfty_ce_irq < 0) { if (stmmac_res->sfty_ce_irq == -EPROBE_DEFER)