Received: by 2002:a05:6358:51dd:b0:131:369:b2a3 with SMTP id 29csp33371rwl; Wed, 9 Aug 2023 10:28:16 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHO462186rfRqLRftpoQ2QoYi5TlWp5LN+RBrwy4F/Q8TWBvzfT5ac1lPOMfHqAJa6Dm+sw X-Received: by 2002:a05:6a20:9385:b0:12e:ae87:45d2 with SMTP id x5-20020a056a20938500b0012eae8745d2mr3505907pzh.51.1691602095894; Wed, 09 Aug 2023 10:28:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691602095; cv=none; d=google.com; s=arc-20160816; b=pzzjWKNZr4l3IUwsh+xnc4336CPgfMdr/IL8oD+t36rwAc41/oNDNeI5dADzRUHMfR EUdP4ryvKnbVnH7IJAumdY790Aih8joAdgteJfLAwFXKaUFO+snAIk06xE8pLQc7aWwk vq5B2pf31nLRKtYTjCGhZ2AGUco6w1Jo1JcHFPwyprnTVmEROKvlo6EgHoS5YwF6oMYb Iq8QZMkvQ9rcjTqC3kLaEWM4Hib82iEY+cPE9zRqsCm18BI6iKTwIRDXRyddjjpWfx2P O0Ur6O1TDE+dCj+E8BcmD2uflGZ4LQSybrNgAK++qLHbzZ01tnK0jaWymuXOiRfX5qNL HNZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=za89CA3NT2s3h4TX6Zjtigxaq5mkstRFrGh9pNRJhsw=; fh=UEVvRAFK6gmZxZNnJDUC7AmNk/iU78fiWA23OmiDi44=; b=uWzgjVsX3SeCgLplYf1I2nY8uVqQg9e4Tyu7IlPj8By+f1IDWNMjL627z3KByfifQZ kAHpiddWDFFjFL71cLapZbEjAkMuRu/qEGPBIlJZbOLchTUyAV40AOZLQGnjYBfW9BwU 8PtUFzGeRvLPKlXhPTtTx7FOjmqP8TvLX6EZcuEreAKMbzYVR+4bVOWjpPDR8O0YwB2l oL6jTYaHRwWJjGwpw1BqkEKhgzurGWrrbAeRyTm02ypFnFHQRPBZ0/MqlHevnuuOUIFI Ndd8EedllH+3sWAl3mXyIBiqjPYwtD79cfkUDSTNyLYZzIQ29qguKinxJm9AisVKu+4p tClg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WMhObEz5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id br13-20020a056a00440d00b006872f156f0dsi9448948pfb.89.2023.08.09.10.28.04; Wed, 09 Aug 2023 10:28:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=WMhObEz5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232623AbjHIRCm (ORCPT + 99 others); Wed, 9 Aug 2023 13:02:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232609AbjHIRCf (ORCPT ); Wed, 9 Aug 2023 13:02:35 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 241DD26AA; Wed, 9 Aug 2023 10:02:20 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id ADF55641F5; Wed, 9 Aug 2023 17:02:19 +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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The 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) -- 2.40.1