Received: by 2002:a05:6359:6284:b0:131:369:b2a3 with SMTP id se4csp3311080rwb; Mon, 7 Aug 2023 11:19:18 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFA0Z1YljYhCUhdSF/htGW+uw5gjuQ4jRT2HylCLio7pipNS8vp7D6WBPbsD9EK45j58dnh X-Received: by 2002:a05:6a20:a123:b0:140:730b:4b3f with SMTP id q35-20020a056a20a12300b00140730b4b3fmr7475110pzk.1.1691432358067; Mon, 07 Aug 2023 11:19:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691432358; cv=none; d=google.com; s=arc-20160816; b=p+Hi0n9E3yEonmFygpvno/1B8c0AmDDFsOUxERFhBrq2dM46QrOKPehMXrcUYTcEoU HO4ZdzgMmR2bxoMir1ss46FWuMm5c81xcq7L4bRjroj9qjglJJNPtmAbAdZkppjkEAKW SdbJ44d73SuXPFtqgp64KyhdTqIidmcWiLZTuvsbj7qmOW5xX2lw3SYf5Y2yzSJ2W68L e+qDSY1mpg1bUTpsQ7qkg/wCFK1NY4QVB6ja2jJlElM4nxjr1SjxfNUWuGoq/P41lo7V fZy3NJnPU4Bf/cxLisvsi+zww3Ggh6t+ACwWp0UjyxEo+xwzv+jD73zTHnrB9FZ5it4p 0tVA== 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=aQytbfLb5bYmAtUxVsSw4HnRcs3nsnoId5tcIWNQh7k=; fh=UEVvRAFK6gmZxZNnJDUC7AmNk/iU78fiWA23OmiDi44=; b=KSDnH4259Q9kSfRMzxcKDajR8EFyhoz8xjMHpKTm6bSDEYisCf/+mqml3DqhT9Fqua TmrPT006Xu7ytpynJd9kciSsW/7JX59SsWH0QDsM0foojoCzP800xEpe7IZ4mFRd8S7P CqgkyQEcFp8EXnKxTzOAe54z3qPwP8+KO7/GasmGIhg8F75av/HU4AsodQepvzUSWz2B mZbV7Y5ARHJLKHoIWZKKHZnRCvDV2ojovaojAOHJDWEiLUzBQi7YOoVN62bMRofv8sT6 MEZHi8eNlOOgrIdfzQHp1rlzUCKL9QuStU/bFOelX15L+TynUy/OHLrDAjrfn9PGblQ/ Syig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=T8+xLqHN; 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 h19-20020a056a001a5300b00665dfbf3b17si6197477pfv.264.2023.08.07.11.19.03; Mon, 07 Aug 2023 11:19:18 -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=T8+xLqHN; 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 S232005AbjHGQzB (ORCPT + 99 others); Mon, 7 Aug 2023 12:55:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57704 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231289AbjHGQy7 (ORCPT ); Mon, 7 Aug 2023 12:54:59 -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 EC6DF1BEA; Mon, 7 Aug 2023 09:54:37 -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 A87BC61FA0; Mon, 7 Aug 2023 16:54:10 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 450C2C433CB; Mon, 7 Aug 2023 16:54:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1691427250; bh=meIPlCLi1bchsiAPHa2YkAHiZoy6af5a6nvWxPBXByQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=T8+xLqHNrEOI5ubSRNwSnODx9PNj3Y8aPp+tRzdpDXrHdHfLT2wsmNdVDHVLv8oAg dYpGMCTnv83a9TyKjdjUMULv641OUyCNzV/lg3zHMUn9C1EnfwWSdNbAixUi6k8/Se dmV48RAleYf6zULf7Bk83NUaPJsXQcPYAltfqosGAvNhhAx4hvw5qF9geXMuMYENkW PwhBcTN1XAfywgY/lENUWxjya0dCfHJYBI6zoEIAGvX6kbAwjsxNfHZ/9nNip34ezG +B5ao3HxhZwXZ4W0ulDZFce3Iozuk1iTgyxw8w7Rp5zVuQMmEaNT6jsAYudXJkFdB0 ndIGPd4ALY/5w== 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 v2 10/10] net: stmmac: platform: support parsing per channel irq from DT Date: Tue, 8 Aug 2023 00:41:51 +0800 Message-Id: <20230807164151.1130-11-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230807164151.1130-1-jszhang@kernel.org> References: <20230807164151.1130-1-jszhang@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The 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 | 6 +++-- .../ethernet/stmicro/stmmac/stmmac_platform.c | 23 +++++++++++++++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c index 4ed5c976c7a3..7c607ef6f364 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c @@ -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] && res->tx_irq[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