From patchwork Wed Aug 16 15:29:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13355423 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 4E811C001B0 for ; Wed, 16 Aug 2023 15:41:52 +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=gKeOHoPMyxe6llY6BHx/KrlQPxHOvL/Mujlel5p6Eto=; b=dlybg6Skig15sa 5ejDCIpHx+Fhocwg0a/PTweHyHXEzBV6I0hBAyDAqvqncmCPUaoAumWvGs6Jx63mmS1S+woPF4MAo PzH+M2aYvhZEGaboyClxR7SEs0rbpgCc5muMAmbfJAHI39wNcLRU73ieCe+t5z2FE398Y5XUfuNw9 fD4h1p8wx0IzI4n5gY/NXDIa23ZY4Z0mQz1hiN8H2TDPdSH883h6czLr6J2Wq2lzVVavvKMTd7HjW KUOZJ4o6uid2x745DbdgC1O111r2xH4W+6+C2F02m0Hj3VS6pOZ6g/8SBYaoR9xAzbng7xhG9NsxH St+DYMKKWjtpmhxABloQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWIeA-004ViV-0j; Wed, 16 Aug 2023 15:41:22 +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 1qWIe4-004VhZ-2i for linux-arm-kernel@lists.infradead.org; Wed, 16 Aug 2023 15:41: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 42BC264577; Wed, 16 Aug 2023 15:41:16 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB568C433C7; Wed, 16 Aug 2023 15:41:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692200475; bh=4IGcaQBS31O4UxIqmGLC17t6CNsWT5osrD81dv+HBug=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MJi+oaJLG9ba5/GuiSKgGyWL+dRQ7bHYA7rHBjBP1ePi2/EMO71ISETipO7+lEoZW BFvRXLMi620qFyPQmDdnm7XfEsf0D9uqvf0FvvXCM9J5bdR6DtfWJlHhFunWrUpOAU qSxejfllsPVqftTRc+UOpTNblfUL0ih7uubFefBwyfy4yaPS7lsFBWWW3IIUXKMpo4 D+mYOi+/BprmczD09P/FAxJPjCI8BAcDXbWK8/V62mKbKti8zR1YALhkr6z6HJMaAB gg5ojG+XkO39+wFI5wm54Vmj7tn/qx6HWdT2mrDvI6bcELgJDKKpBLqflFZFbRS+CG Mh7LyOcvyRCnQ== 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 1/9] net: stmmac: correct RX COE parsing for xgmac Date: Wed, 16 Aug 2023 23:29:18 +0800 Message-Id: <20230816152926.4093-2-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230816_084116_920264_2A2BE255 X-CRM114-Status: GOOD ( 11.95 ) 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 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 733b5e900817..3d90ca983389 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -7035,7 +7035,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 16 15:29:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13355424 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 EC041C001B0 for ; Wed, 16 Aug 2023 15:41:56 +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=DgKV3nhyv8vFgbHRVYBSl7d1XTRLhicJcL0/gutIQCk=; b=A+eAEZJg4BwZmn EBpo9SvaLQdACn9tZjcx79CCTizOBvDpcEar7HIwAbgSNXChFgidpFWGrIft4xGgXbIV7WqLETt2U bDCj+n8e4iwxGM3QS8nGHBufZ+15diCrNMNTHyh4voWRhTAieq/6IMylKVPNVBXW16HxTDLz8JL6v Fi6Ea4GzZFOrPbbPCVdCvdVrz7Qq9I3vaQk7o00U91Whj+smpaHF12YO79/AJ7KZex9FaCclqCuFD f3onj4BvuZB3tyO8EJYPBcVdin/8XY/gLTbqO/Iv3UcH8R+6t2KpToKUmstAMd0AwxD5XO9xAZZDy VcYEx1slVUx7zdSeb0JA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWIeH-004VkW-30; Wed, 16 Aug 2023 15:41: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 1qWIe8-004Vi7-1e for linux-arm-kernel@lists.infradead.org; Wed, 16 Aug 2023 15:41:21 +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 0F37564768; Wed, 16 Aug 2023 15:41:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 6EDDAC433C8; Wed, 16 Aug 2023 15:41:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692200479; bh=nrZBBHIvwoY7+NGVTUVo+wQxGv/rQfcOhG+8CHuUfbw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C9DDETRHcmDn3/sjpx52V0ObTTzXJ88g3duA+PD4y0N2+ENXQpaqYfP1KCUg6CsQF cd8lPDX80SN4yQo5cc/HQ7ZK+j4MTYNyGi66qcc2R/WLTn7oIgUGEMGOF3EB4ZFBNd hTYzpuggcWcvg6SUX8PL2M8sMTDpciHjTHKn1WtclbXgkaavZ2E3lF/6pJIZWD+Zfi WBpgcapVp6pEypxnImqKGbudMs8zBd2UuFuLmW5vSLBtK6x/VNjxzNhhOvJ8AsF7ha G9VE0inA/4S1/mB+/Df5yxPCtXI1iD9jPQ61ur3FKetxVOCRUaeXtS7kWWRncwj/MV NuImxW7m1C9RA== 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 2/9] net: stmmac: xgmac: add more feature parsing from hw cap Date: Wed, 16 Aug 2023 23:29:19 +0800 Message-Id: <20230816152926.4093-3-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230816_084120_589595_34D53061 X-CRM114-Status: UNSURE ( 9.57 ) 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 XGMAC_HWFEAT_GMIISEL bit also indicates whether support 10/100Mbps or not. Signed-off-by: Jisheng Zhang Acked-by: Alexandre TORGUE --- drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c index 3aacf791efeb..1ef8fc132c2d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_dma.c @@ -410,6 +410,7 @@ static int dwxgmac2_get_hw_feature(void __iomem *ioaddr, dma_cap->vlhash = (hw_cap & XGMAC_HWFEAT_VLHASH) >> 4; dma_cap->half_duplex = (hw_cap & XGMAC_HWFEAT_HDSEL) >> 3; dma_cap->mbps_1000 = (hw_cap & XGMAC_HWFEAT_GMIISEL) >> 1; + dma_cap->mbps_10_100 = (hw_cap & XGMAC_HWFEAT_GMIISEL) >> 1; /* MAC HW feature 1 */ hw_cap = readl(ioaddr + XGMAC_HW_FEATURE1); From patchwork Wed Aug 16 15:29:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13355425 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 89672C04A6A for ; Wed, 16 Aug 2023 15:41: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=TZl949jRjog9sBBDQ33Uwddk63BSf7HkvwsFxelCyWg=; b=hPu29Xw4h5ig9q 8S3wbxqb1Z/wlSjem3T3wSoavsZsMkQ9nwuiNiV/8UORYCRavKvL4vcL+HC/Rx0VUNqS6zG4plFSN BTABOSIUL30CAs/V6mZqhSSbG5DhsTuB7KbQHpjHsvnta9u6quhbOVIERdtyzsqLj+jcSAJ5HamAM x+Q9IobHewzH/PxHbIrGgM1rISVxQwFN+0Bl4znMnUS7buZToUPoHI6ea3R30tNkqxf40FEyejpHU 9uHtQbq+8D/iH57O8y7wxRxZ4+gQyMiEM6PYg0T9fzhRaLQapR+svpP6CMpQgxVQTuSgBiDu52dYR hnn3NcrD02uJb+4/U7/Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWIeI-004Vkv-1Q; Wed, 16 Aug 2023 15:41:30 +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 1qWIeE-004VjL-09 for linux-arm-kernel@lists.infradead.org; Wed, 16 Aug 2023 15:41:27 +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 83A7E647BB; Wed, 16 Aug 2023 15:41:25 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3FB9FC433C7; Wed, 16 Aug 2023 15:41:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692200484; bh=txwgc7mnnsmcD2eGCJ5tky3C5uEWpaD5DMyct9tbf5w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Idw8nBH3ufcz1hDSmcG2WbpHUhGAiI6pvqX38a6xog1CwntcfQ4+AP2a4zOb2zcCP 1rHM36XZKHDVUgIlBSg9vf+mdcESOAZZWmISsMwod+8P0pzhOT24Vk0Ej6lxcM3Msn cbRAVSEVnkpu5kkvSwxsZjJ+YR1Jm6+c7N20mluxk/wYtYykE9H5HmrBt3QfuujV8r 3yO31F7chLeFdiLRBEw33l3zXwrDDjr021rqqJ5TyhhaBjSEbcNncvHWVNdW6K16T7 j4LkUEZx4+OTRlFyL5KDRsCVwX8qnuJozRRhbiKjFMvy//XUzOENWUbLPM7jyKKzBn VZf3TybluMATA== 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 3/9] net: stmmac: enlarge max rx/tx queues and channels to 16 Date: Wed, 16 Aug 2023 23:29:20 +0800 Message-Id: <20230816152926.4093-4-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230816_084126_125304_3E394A73 X-CRM114-Status: GOOD ( 12.17 ) 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 38782662ff98..8ac994553bc1 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c @@ -232,9 +232,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 784277d666eb..9c90e2e295d4 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 16 15:29:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13355428 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 7826AC07E8D for ; Wed, 16 Aug 2023 15:42:12 +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=Km1AZdIWMyv1zBV8kduFtY0UGqUcZr06fXFxAnkcLFA=; b=dZHSTE+5xMrZ7w 3sxU5BjrkU0HQApUX/0iv1ujrd6QwOHttxfIlAIdHP8A/VOAZwHP/eVtAkzfskShnzukXdd2aasny suvaisrC1XU7p6/WiPoOMV9+oOa/HHOefmT5p7IS6eKeXL8Whbq1+wolAWKl2olEUai4bNRuwZhah dn0ueiih6fu0XUDo0NFBpqRRT53FbJfCGHWogfqWOsmdPe4RgyaSVOSHgFNAJ0Hur60pMog7CDz8e teQEtrpE8NTSCEr7FIrSEVtsxF8QwzerQfaXWVQY7DCRo+SJBCFjMbpo68KTORL4pmXSqUAvcygi4 LwGkCUrztw38hUfKuYbQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWIeT-004VoL-0t; Wed, 16 Aug 2023 15:41:41 +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 1qWIeJ-004VlK-0Z for linux-arm-kernel@lists.infradead.org; Wed, 16 Aug 2023 15:41:33 +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 5536F64768; Wed, 16 Aug 2023 15:41:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 57E4DC433CC; Wed, 16 Aug 2023 15:41:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692200489; bh=VhGYQm/v6CCPb8FZ2A5lzNUx1w/ato3kcEAVi501AEE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ICKHeDjSPBPwClUV3I0zhWQzgPJ0oKNldBMv1hsz9nFlXzeKZaio2ODKe4emaQk5W IhlgY3YQi3047p6gZve44x6RAyqfan3cLZ2Ef/NnTCnb0ilVKuTu9N/qN/ZTnEfNF4 t4UnCsm0CsCWlpg2exFtkcSvuuvsMlToc52wjiWnq7sScrydVBfAjPQXUa3HGZUHnf /EnD5keuAwV+JPQDRIIcUtr3tCI0Zhxi9TeQiHwxThQv59wGpzP4hjAANgnhqDc0On 23BESRpoGKBdORIfgVWK7BqKSBwVle4YdvAAdN8yN//b+vs2wWWx4R9F0xxW8fT21W rl5a3dEIdbIrg== 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 4/9] net: stmmac: reflect multi irqs for tx/rx channels and mac and safety Date: Wed, 16 Aug 2023 23:29:21 +0800 Message-Id: <20230816152926.4093-5-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230816_084131_299528_06217629 X-CRM114-Status: GOOD ( 20.85 ) 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 979c755964b1..9050de31ed76 100644 --- a/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c +++ b/drivers/net/ethernet/stmicro/stmmac/dwmac-intel.c @@ -952,7 +952,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__); @@ -1004,7 +1004,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 3d90ca983389..64c55024d69d 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -126,11 +126,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 channel 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); @@ -3520,7 +3520,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_channel(struct net_device *dev) { struct stmmac_priv *priv = netdev_priv(dev); enum request_irq_err irq_err; @@ -3537,7 +3537,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; @@ -3554,7 +3554,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; @@ -3572,7 +3572,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; @@ -3590,7 +3590,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; @@ -3608,14 +3608,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; @@ -3625,11 +3625,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; @@ -3640,7 +3640,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; @@ -3650,11 +3650,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; @@ -3729,8 +3729,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_channel(dev); else ret = stmmac_request_irq_single(dev); @@ -5945,7 +5945,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; @@ -5977,7 +5977,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; @@ -6014,12 +6014,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); @@ -7300,8 +7300,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 9c90e2e295d4..c052c222fa3e 100644 --- a/include/linux/stmmac.h +++ b/include/linux/stmmac.h @@ -98,7 +98,7 @@ struct stmmac_dma_cfg { int mixed_burst; bool aal; bool eame; - bool multi_msi_en; + bool perch_irq_en; bool dche; }; @@ -213,7 +213,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 16 15:29:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13355426 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 D0874C001E0 for ; Wed, 16 Aug 2023 15:42:03 +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=Dh7o1taxMtR7X4WGjkZAp5AA2wqvK7QOv8iwQNUujDo=; b=KIhlXATBKm6mvg ouAK6pbvuJAgpAmqiKx8BCLdCnji/KCuIgkVqyV5LICaZqg8R1nnvxHHEvX+1qCX2w7p3lgVx8zQa qvNXXAIGtYRBf5CttDMO30oo9PsPZex2+TOT0NfEtA5FbDKE4r7QV/RU8Bb2dTkaUstBdpJzblCQW UVdllQ/b2DNqTFvPaH6iV74R+1b5k+I9cOJ7FwureM3FN0E/H8UvZ/LxfGsKPdLkcNH5SGnWuAggH R6dxHHdnRL90xoR43Ww+RscYsmt5ceW2UrhKaHhXL+YvmEXT2IaD9dpN6/Y/s7y0CuG3EdPfEeCMS 7yDY6AJk76O/R2WiTfTQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWIeT-004Vob-2W; Wed, 16 Aug 2023 15:41:41 +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 1qWIeM-004VmH-1k for linux-arm-kernel@lists.infradead.org; Wed, 16 Aug 2023 15:41:35 +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 039A262399; 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230816_084134_663570_296CD4C0 X-CRM114-Status: GOOD ( 12.98 ) 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 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)); From patchwork Wed Aug 16 15:29:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13355436 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 55142C001B0 for ; Wed, 16 Aug 2023 15:42:20 +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=mNNUOeGp7EkVmlG/j760xZLbWq+TxBUJW4Ta0l2zmdk=; b=Flc8D4mS+GQReQ vFXGmT0ZO7Hf97ZmQpMUNBmpoWTrGkL6ChlQWOBZFx2H9ladpeaRqU26p5dDn/TXDngM1DV2neTIs GUx3kqD4XQtAENNB3AJ8RTG/IXYl/hO23Egc0xPNxHbag541msv/L/6RiGW0EabaSEUkrKDS6BQI4 RhxxPguldMypTGZgFCk5MH819MVgBaB9QT8TFw/BzZp99dIS6ZdYBRC+/826Ybop2I/+Wr3Ou0Sa2 jI5zRu0axv45FG9QsZn6HTYKK9nRAePMEd/P5deXYaljMAs48aUzi/kdzA9oyksGx8yo3RxuRPAPO lYNEGeNTSvOmfdGqXGbw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWIef-004Vux-11; Wed, 16 Aug 2023 15:41:53 +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 1qWIeR-004Vnh-1h for linux-arm-kernel@lists.infradead.org; Wed, 16 Aug 2023 15:41:40 +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 15F7964B41; Wed, 16 Aug 2023 15:41:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D3590C433C9; Wed, 16 Aug 2023 15:41:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692200498; bh=W7ECQIQKfvKMVwcR9VbSxLGQ7/jrBCtA74xsM15z9nY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=us4YEJrIjLgKQxbwGjwCLfE6bE3pafzZjx4+B1IVzGtfxbATVImmtgqswUEx7AX0s nBevXHzge5vCXJOGA2h/yJR7uiWdyIxu1iiqE0OA04Dfm29ViYnQcnFMYOTEVCkw5h 4iERHf0xu2KiQGHt6LCFqt5ngziHzveSCCCNIjmKYA0cLmWf+UTxoY0uhj2ObRYLZ0 PK2KYD426Fczi8sfmCgrTZ0kTvoua4ijGULP5KMQHI57jJP4FsEqCsEvwtdkl/Pm3f IQ+FIn8cJuYd6MC3DRtQnbye3Blvp/dE7PsloZ/xSgDj0rqRRfjXoeoLvGgr3mOWLJ MboC8CXUc7GJg== 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 6/9] dt-bindings: net: snps,dwmac: add safety irq support Date: Wed, 16 Aug 2023 23:29:23 +0800 Message-Id: <20230816152926.4093-7-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230816_084139_602476_48730D03 X-CRM114-Status: UNSURE ( 9.71 ) 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 | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml index ddf9522a5dc2..b8d01bba6e1a 100644 --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml @@ -107,13 +107,18 @@ 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 items: - const: macirq - - enum: [eth_wake_irq, eth_lpi] - - const: eth_lpi + - enum: + - eth_wake_irq + - eth_lpi + - sfty_ce + - sfty_ue clocks: minItems: 1 From patchwork Wed Aug 16 15:29:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13355427 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 025A6C001B0 for ; Wed, 16 Aug 2023 15:42:16 +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=kgO22o7sRPlYmP+BiEBJ5l1vVMhZJMfT/bnbt4/RV20=; b=WOz8aL9WZwgRmb YxLkAFNQ6epuHpMQsX9CIUvVd2QjC4Uowj0jR1MaiKOq+2choyJ0furMKni3a5cfxHSb7lVzsCEyF KA2VYvamgK+hedLNOb1fMwb6FAM3vUAxWf8cB/uYrr03oo2SRMKSFZEkGTWBt75g2muNNtLqXqi9M q5W5Rdk9txcDkR/II72qi1Krr1UCnICjw0XpWLA6Uhw9iS2LyAySmg+kjSw++Tew9vclbOz4vIUBZ 2XxZcRg1mD2CIVVxclcWMUgGgfarBSd8NgVASnrynTSDFG7Sxs7JvBZEfrYtSZKgTI3qQwe6jZ+rK 4ni2fUmJluRYjGbgDhTA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWIeg-004Vvc-1d; Wed, 16 Aug 2023 15:41:54 +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 1qWIeV-004VpW-0B for linux-arm-kernel@lists.infradead.org; Wed, 16 Aug 2023 15:41:44 +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 8A44A651EC; Wed, 16 Aug 2023 15:41:42 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DFA46C433C7; Wed, 16 Aug 2023 15:41:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692200502; bh=kv75d6y4CuM21MoxPELNwCryPzdrLaz2U6/TZ1c2g/I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V8sQgisoo15AHP3j6yHL9E3pgXFlue0Sq+NgZp1L8JyIfxnDSEteT6T+ROFOvk367 W6XX6TcGdPRX3GSu0ZlqjSwl8IBhmyd5f8TqJrHx/r+WaWuUoQHTY1/8Ag6I2LdUvB 6oTGcLA8h6UbSwMQJ03n+Mxfr4yHUiLKPxwKvADu48ifLdYwBam5eJPgZ64KuqhbT9 5tgtmhn7bRElDi+VvdpdHNyAY7kaCP9gHDSM5SX/wrILVJ2lSklRMGIWu5VG0CIWND 15C/PXB8sbhNotlqujxMS/y/HYYbQdp/He0lXm/NzSS5aogoaJimyfONRYRXkvIRDT gKsMlJoD2pIaA== 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 7/9] net: stmmac: platform: support parsing safety irqs from DT Date: Wed, 16 Aug 2023 23:29:24 +0800 Message-Id: <20230816152926.4093-8-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230816_084143_137076_CA9C9725 X-CRM114-Status: GOOD ( 10.97 ) 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 be8e79c7aa34..4a2002eea870 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -737,6 +737,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 16 15:29:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13355437 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 8D41DC001B0 for ; Wed, 16 Aug 2023 15:42: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=NwJBVuuJcsvPVOM8de+HDcL1Ee3X+GjqexVr9+d+bWM=; b=EcMTm95M4J3HiB nBqEbhwas/EnphA3yeYEUtk5GxLhKM8AtgV+b8edZpYDsLa7i8OgStgiuEYaP9mRrC20YbhstFuTK yri4qVJQTCRH9mK/wfEA2i29J2xAlrmuligUTlkdlJn7ritGyAv7FWo96ZwTTngoAvLaTWfZf7uam Z4qF8nF4+DHkN9hK31TA7aCFpWgO976BP2j/7yAV/i2QI8eLCG4PL23WWQRZq9BRJbuto54+GdRZq unFstIn2N9ZTxcrx+B2KYN8diBUBLu8N0dhMiEpGzOujqDK4wrFz22hVsXcVATKJFoGK7YH0HVGiU 7QWWvqACl70D4iEjb8tQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWIeh-004Vw6-0c; Wed, 16 Aug 2023 15:41:55 +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 1qWIeZ-004VsH-39 for linux-arm-kernel@lists.infradead.org; Wed, 16 Aug 2023 15:41:49 +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 799F564DD3; Wed, 16 Aug 2023 15:41:47 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5E34BC433C8; Wed, 16 Aug 2023 15:41:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692200506; bh=d0jes+KrJeiWl6LJI3nrjoLh3/r6+H9lE5veVs3+NN8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KEEdMxD0b9PLscPEqG8w/hUc7DEM9kbhfjd2v65dvGQMUN+FT6pldecS8L+DOR+4Z ZzV1WITkzhou/COccdDVKQaO6FsfchN4yjW8OyK7ExzfS/gezDhNDxYDEBJMn1q7Ae ksbxbvQUeu6h4UQSKIsYvRodgiXk/7OOBynz7rquDOboqsadS8+74KJsqnvPDBWuUx ezNr+/AuEIl7IpxWAsMAWK/pgBb01lTBdpFCV4XibHAB2i9ybfqGEh/xKs62e5VKCd dD8F/40VkeZ3xdz5OiYImXFWgQyIBwLKMEULzp03OXhsRAQcT8HuaOfqf8TkOhYYpO 13RDrc08fcksA== 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 8/9] dt-bindings: net: snps,dwmac: add per channel irq support Date: Wed, 16 Aug 2023 23:29:25 +0800 Message-Id: <20230816152926.4093-9-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230816_084148_106494_1B02DEA1 X-CRM114-Status: UNSURE ( 9.41 ) 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 optional per channel interrupt, add support for this usage case. Signed-off-by: Jisheng Zhang --- .../devicetree/bindings/net/snps,dwmac.yaml | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/Documentation/devicetree/bindings/net/snps,dwmac.yaml b/Documentation/devicetree/bindings/net/snps,dwmac.yaml index b8d01bba6e1a..a916701474dc 100644 --- a/Documentation/devicetree/bindings/net/snps,dwmac.yaml +++ b/Documentation/devicetree/bindings/net/snps,dwmac.yaml @@ -103,15 +103,51 @@ properties: interrupts: minItems: 1 + maxItems: 37 + additionalItems: true items: - 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 + - description: rx0 per-channel interrupt + - description: rx1 per-channel interrupt + - description: rx2 per-channel interrupt + - description: rx3 per-channel interrupt + - description: rx4 per-channel interrupt + - description: rx5 per-channel interrupt + - description: rx6 per-channel interrupt + - description: rx7 per-channel interrupt + - description: rx8 per-channel interrupt + - description: rx9 per-channel interrupt + - description: rx10 per-channel interrupt + - description: rx11 per-channel interrupt + - description: rx12 per-channel interrupt + - description: rx13 per-channel interrupt + - description: rx14 per-channel interrupt + - description: rx15 per-channel interrupt + - description: tx0 per-channel interrupt + - description: tx1 per-channel interrupt + - description: tx2 per-channel interrupt + - description: tx3 per-channel interrupt + - description: tx4 per-channel interrupt + - description: tx5 per-channel interrupt + - description: tx6 per-channel interrupt + - description: tx7 per-channel interrupt + - description: tx8 per-channel interrupt + - description: tx9 per-channel interrupt + - description: tx10 per-channel interrupt + - description: tx11 per-channel interrupt + - description: tx12 per-channel interrupt + - description: tx13 per-channel interrupt + - description: tx14 per-channel interrupt + - description: tx15 per-channel interrupt interrupt-names: minItems: 1 + maxItems: 37 + additionalItems: true items: - const: macirq - enum: @@ -119,6 +155,38 @@ properties: - eth_lpi - sfty_ce - sfty_ue + - rx0 + - rx1 + - rx2 + - rx3 + - rx4 + - rx5 + - rx6 + - rx7 + - rx8 + - rx9 + - rx10 + - rx11 + - rx12 + - rx13 + - rx14 + - rx15 + - tx0 + - tx1 + - tx2 + - tx3 + - tx4 + - tx5 + - tx6 + - tx7 + - tx8 + - tx9 + - tx10 + - tx11 + - tx12 + - tx13 + - tx14 + - tx15 clocks: minItems: 1 From patchwork Wed Aug 16 15:29:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jisheng Zhang X-Patchwork-Id: 13355438 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 78DD6C001E0 for ; Wed, 16 Aug 2023 15:42:38 +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=rEwVK2OFCzb+6AgWyX5m931eitlmHbZEseCGvHxAOTY=; b=j2OL3nTu7jJvsY GPBpZRzLjqa2+OwhsmeSElQkhE6sJGlNs3lF9OHzuzm5I/AYSk0t7qglj3sokrjR+ZSlGpAg9dSjk uub4PgrRp7DCfgkbB5uzuvlbanfNGWZLjr2PPS0PhBfoefqaUIYJTgfyZ6KD5Q46fIBdAZ+KmUnsU 7nncYSe+DU4RThp/W/GaznQyJuCYL4eBvDdb/uD6tDGzWXc5gieGrIqya00WB6IbbZdHmaAE2Dlb0 44ghIS3jUlgyHuKsSc3HaTlV871H8ogDP2prlYrgCCBA/6hcefAZY2BEDH6pQyIAeeCQNTc2U0M44 mebtVS/VFgcUknMTBTxQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qWIew-004W3O-0u; Wed, 16 Aug 2023 15:42:10 +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 1qWIed-004Vu5-39 for linux-arm-kernel@lists.infradead.org; Wed, 16 Aug 2023 15:41: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 81D7D64BBE; Wed, 16 Aug 2023 15:41:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5050FC433CC; Wed, 16 Aug 2023 15:41:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692200510; bh=IR6gUNrGlpvXPqUl6ePu23Yb6z5yLdZcfdC0Vl1Tk5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=NDBHKHzTzqYtf84tuKMNpO7JrsBxgJrYjlAJD7mOc/vcFT4TR5PZYH166vxaDX7w/ myNG8+jyyjHhCuqo5YSIE1Z0qBk3QhHLRaP9OPM/VX0XKhRtLwzesQGf4Nm2dbZrCH EhxstAPdlpX+6sFHg0xvQ9dXjXAkUvmhyk8Cv9rTdeLAwnGmqsnNFXRf2/lhTyK3Pk lfoeka0qnkHDb8sDyiPc44BcNxycCi01HfGe8vJyYw7y+GEZzLhnyyGml6HOFuo3gm eELsWcnl+5cVAuvySfHx/1EPNtiSJSWUi6BAZTjJ4p0/vAPD88TGDm+C+F594DkI2L AjYhvf8ec/31w== 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 9/9] net: stmmac: platform: support parsing per channel irq from DT Date: Wed, 16 Aug 2023 23:29:26 +0800 Message-Id: <20230816152926.4093-10-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230816_084152_100545_0E62CA1D X-CRM114-Status: GOOD ( 16.37 ) 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 64c55024d69d..d4a8d7b48ad2 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -3619,7 +3619,7 @@ static int stmmac_request_irq_multi_channel(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]; @@ -3644,7 +3644,7 @@ static int stmmac_request_irq_multi_channel(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]; @@ -7300,8 +7300,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 4a2002eea870..0fb9868aeffc 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -704,6 +704,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 @@ -737,6 +740,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)