Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp2191962rwo; Sun, 23 Jul 2023 09:25:21 -0700 (PDT) X-Google-Smtp-Source: APBJJlFGInek/F9L9u+FpQxtPXdAsFRkzujYckdYEiVyt5DAQRsvuzMy3pKOy/UTakliKq7+pvdZ X-Received: by 2002:a05:6a20:1391:b0:133:6c35:99c1 with SMTP id hn17-20020a056a20139100b001336c3599c1mr7251273pzc.16.1690129520957; Sun, 23 Jul 2023 09:25:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690129520; cv=none; d=google.com; s=arc-20160816; b=0gClJU3diATq2dzBjkjFoErDG936paJCQMv+3uxOF8zNSEiV8aM3CqZpXuJP0WT/g7 eGNkIzpZnXHuA+eD1GGKqVnZi7J2euszHQRU2ng96+Rk/I87FflNZC/8Rh3Db6ucXWsJ ksbTdZ9Iie03BY5/eRR+sF1Ue5NDC8RQnXcB+bfxDi6fm0rtB+CExPPjRMwyz0IB8NPM BJWUUrMjkmw82o4JtlGdYnT4wE8PqNs2o8UdgeZgQmLOi1txka7yEjYyFnzvXJovBaQw Ql685lB9AZBCNU6cMvYtBLNIJDYA1m9USq7bqzFeuu8or+EW7VhhxYlEw45D6cIjT4L1 UECA== 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=C9P6oYWu3YnMnE1ja/pWT3IrJD1G+gURAiUrxbgGKek=; fh=UEVvRAFK6gmZxZNnJDUC7AmNk/iU78fiWA23OmiDi44=; b=UAqX7lHUJdwl15oNkoCJ14S00HULdVIU1yCt6Yx/bt8XTN869WHF9eH6FuTHi+/nDr YC8x+fpJ8tg0bW8zQmOFG+BIN/1OBonTLP1FzkdTq7YBAYX32IvLs3ILjHBPFgx5sp2d Vxxv9jxVnm8woNuX6JbllGZpyS9xSfHxcnCrf0ykmRnDnWVvRedG9YZJmC5F4ymfUPE9 OKa8ABiNCsqZ3XqfE2lL3iENOX+g0HM5nrIl7tZDs+f6cJNNpDN9JTEVzhpuLiQoKfZa BVBGdskqefGiW2KZgTey0X5UetVl+P8YlJaFCDPde6dFkc/u4ObSPLhUmJq3mX1S5lK0 TpQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=fVXln860; 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 bu8-20020a056a00410800b00662ba7f8a5fsi7375069pfb.170.2023.07.23.09.25.08; Sun, 23 Jul 2023 09:25:20 -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=fVXln860; 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 S229646AbjGWQXs (ORCPT + 99 others); Sun, 23 Jul 2023 12:23:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45012 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229692AbjGWQXq (ORCPT ); Sun, 23 Jul 2023 12:23:46 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 982B61BE4; Sun, 23 Jul 2023 09:23:18 -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 71D5060E03; Sun, 23 Jul 2023 16:22:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DBE3FC433C9; Sun, 23 Jul 2023 16:22:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690129365; bh=qDI0Xb5iaQWdsQql8g8clSdLAw51YwA2gB/y/HlqbvM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fVXln860LhUZcxF5EYN3gLM6af9tazNAY7YXKWeCJndIKqyXeMu8VBtbEEPrnnJJf pgz4q/ToKIP59p1+VzHxLLHDojPmJpfu0VZcIeBw499UMjt6dovJefE8Bm6ebXkBzE e3GORnARNutWgspjrF8VJVtzJFUV9kXshfdBhK3NLiM0tstmPOEX65Y/pLoCWvthUF yBj/TQlm45C85bQyDIsPSsVK6aGGJlJPVTuMfLewFSeD2ttgfHGRpi+lbPKHUa4+ds 01IoMUIfk6k+eucfSvTVZiopFDKcMOsJYKFFC1WCH56N91vHrSJnw54cSH8BS6irtC JMTiTPs3TaUMw== 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 10/10] net: stmmac: platform: support parsing per channel irq from DT Date: Mon, 24 Jul 2023 00:10:29 +0800 Message-Id: <20230723161029.1345-11-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 In-Reply-To: <20230723161029.1345-1-jszhang@kernel.org> References: <20230723161029.1345-1-jszhang@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 --- .../ethernet/stmicro/stmmac/stmmac_platform.c | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c index e1b7a3fefd1a..16fff66c578b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_platform.c @@ -539,10 +539,14 @@ stmmac_probe_config_dt(struct platform_device *pdev, u8 *mac) if (of_device_is_compatible(np, "snps,dwxgmac")) { plat->has_xgmac = 1; plat->pmt = 1; + if (of_property_read_bool(np, "snps,tso")) plat->flags |= STMMAC_FLAG_TSO_EN; } + if (of_property_read_bool(np, "snps,per-channel-interrupt")) + plat->flags |= STMMAC_FLAG_PERCH_IRQ_EN; + dma_cfg = devm_kzalloc(&pdev->dev, sizeof(*dma_cfg), GFP_KERNEL); if (!dma_cfg) { @@ -705,6 +709,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 +745,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_irq"); if (stmmac_res->sfty_ce_irq < 0) { if (stmmac_res->sfty_ce_irq == -EPROBE_DEFER) -- 2.40.1