Received: by 2002:a05:7412:bb8d:b0:d7:7d3a:4fe2 with SMTP id js13csp2713638rdb; Fri, 18 Aug 2023 08:27:26 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEjzp7x5FzeuUD61nYcpQbLYAO2RTdHngJijdOs/24+PJEehuocOBmfueoEc8Slom2opvAf X-Received: by 2002:a19:4f09:0:b0:4fe:5654:9d00 with SMTP id d9-20020a194f09000000b004fe56549d00mr1864288lfb.48.1692372446275; Fri, 18 Aug 2023 08:27:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692372446; cv=none; d=google.com; s=arc-20160816; b=mh+R5DxjRLP2CypaoDwN5/tKAv1yJGeIfMN4iqXgKn61y+NUwgZHYI36oEtKAQLfTF cwVGXPCkd2YHpjRfWPtFLyjmyVt3xZSKS60JTKafrsth9TSGu+JaQsyhj9tlepGQgSn8 YM/QFQ8yB3Mz2ZqM39/4UVjX/cvK9ueUxqlforR4udzHjpSKS0/8H+TBL4ibMXf4F9c/ FfjfPe5MzcWOsI7yieLAXo0gHZlUBRgYdG2SNtSC6zpF1/lOaiLIgVEm73QZ5pBC199D ISHezswSEWom9JJdQ+jMkp7TYHg9WUvOexVpP47zjx1vRaNK+QNJSI/kVkihX/jC47X3 J7kg== 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=rksCAGfwMHkvpuTR//aiWq8reu5vdjOMCWMKsoRuDdQ=; fh=UEVvRAFK6gmZxZNnJDUC7AmNk/iU78fiWA23OmiDi44=; b=VqRoTdR2e4Up06HsrL4weBIG2vENlCJU7WYR7YtvHxCDlAEzuW1ubSu1DotXdSiZfY Gdh3064m2xRKB+QYhbx+O9IHvFFZFQvtTNRrPVg/m7w2QcoP6dFNOKHcMYz9fLjtwtAZ 53PdUtvVg7PgXalX9htzEQk4ti5soiU1YrGNkfQvsQfKWFpvE3EcM+yXEtgMWHy6QPtA cJARX0BzlO7u/+d5sXL8VVksclcVffifoUg8Mf4fTvG/GwFApZWzos8AfhQnKwUJo5Ld xntc9fXxvTY+BBmBOJOrSLtP8/SVed+Iq+rEqyuhZz1qXTKr8r0NH4JN6tNSaOpbB1VG UEZg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=TOgqtLSv; 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 g24-20020aa7d1d8000000b005231005e43asi1580440edp.2.2023.08.18.08.26.58; Fri, 18 Aug 2023 08:27:26 -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=TOgqtLSv; 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 S1353851AbjHQRKf (ORCPT + 99 others); Thu, 17 Aug 2023 13:10:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49408 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353869AbjHQRKE (ORCPT ); Thu, 17 Aug 2023 13:10:04 -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 449472136; Thu, 17 Aug 2023 10:10:03 -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 CE194675C1; Thu, 17 Aug 2023 17:10:02 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 795D1C433CC; Thu, 17 Aug 2023 17:09:59 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1692292202; bh=IR6gUNrGlpvXPqUl6ePu23Yb6z5yLdZcfdC0Vl1Tk5c=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TOgqtLSvVE7GaAYuEOY1QQVKqR/aWnRL6qArTZKkIzyUuFnur3EN4pXVMdXyyIYOF MpqH4+lNowBpEX69kkTJ9u5ZRywciLVWgwl58JF6KcwE8CXAZCWSKv8akgnm9KvVxf yNfhZUEHyw6xMo4a4XSkbD1ghvJV1XNN4nPgxyQ+MlyjTfoLbEjXswY1YTgBPRunkR vtU2EkuO5Izs/qJlL5qkomGoI/SkEn0NMwh3mJ7Ng/BM3BXMlp/NkeEtgIYaEC1Oo4 KmxizblmMKBLZvZu5b2KGdEL3jZwCsRAGNSKI3lJUK8gdDoKfgIXLxCuki8g8wnyJb piBqRfmbMcSWw== 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 v5 9/9] net: stmmac: platform: support parsing per channel irq from DT Date: Fri, 18 Aug 2023 00:57:49 +0800 Message-Id: <20230817165749.672-10-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230817165749.672-1-jszhang@kernel.org> References: <20230817165749.672-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 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) -- 2.40.1