From patchwork Thu Jul 13 02:18:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Golle X-Patchwork-Id: 119472 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a6b2:0:b0:3e4:2afc:c1 with SMTP id c18csp1542424vqm; Wed, 12 Jul 2023 19:20:43 -0700 (PDT) X-Google-Smtp-Source: APBJJlGbjI7c1mAz3tBBH6lzbbNsfvBElXIx0DSz8HJOfwwQ7gtlC1M3YCrIeL72cAcf8LtchMBN X-Received: by 2002:a05:6871:79f:b0:1b7:7439:c584 with SMTP id o31-20020a056871079f00b001b77439c584mr736809oap.59.1689214843356; Wed, 12 Jul 2023 19:20:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689214843; cv=none; d=google.com; s=arc-20160816; b=TUAdbkfCZQzn4rehlrxx5knS8bMBUfPiGTUxHlzoPqSWz1DUOEokb+wTb7GQI0/Akw BNnWL7GYn60qIw7z02DePBF29oU+Qvxe/cRsIeHb/s9NFJvIyS0gwierK/ZroMGWjYD8 A5oaeZprVyG49PZ91FHHmBmXCidMko7keo/MQjBp5NJR1U6lFdcwqXL9PZmSwZJOrJnA z6dcwlrVyKqGc4rYahzBOs2CSiwRanB+/+wFYgph/g7Bit2/DBzv6QIRg3FbbbJiBISX L+yhfowZ2ff1e7eJAn0O/Sre+Qx5aNcF88hiHb4zTS0tD8+7W0xKmuqTQyZ2WOeCVBo7 bU3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:to:from:date; bh=B15sksH76SkHgQdEWVy6xLiMIraCMaM5vx8Ai35ldxY=; fh=9pKblXLHR4b0iqJeNGezDe9eB2gLZXksRAVo2lkFWAw=; b=JjTI5pC0erqAdc4RrNiyel53dBddmb/y6uxhRzNZESZrOwlI8+lQ4OWgxF6JfchfXg 8xO37dJPw74K8iN4/4xs8gmyunwObW7LreUf6BV2hqtr1dDiRpqQCYQeNBT3DKBpsHMI 2EO6Xiy2+klOFdcIPDIke7Sya64YR2DACgyCJGlhF8AvKGTE5fPINEaeipAd/Om1+x4F Sk3bZDw+VpL5jDberKCJl5SzfBiTB1DdDxO4CKPpd92rR+BsXK31GAHCTqe/H27MgzP8 s+cqu+WdiAGON/OAR8vPrHczMh7EYmC7tj8CCzinjtrBT4NZVZp0Dhdxg8K27WUaK3eg J3Qg== ARC-Authentication-Results: i=1; mx.google.com; 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g4-20020a17090ace8400b00259b2f52633si4371255pju.166.2023.07.12.19.20.30; Wed, 12 Jul 2023 19:20:43 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232412AbjGMCTP (ORCPT + 99 others); Wed, 12 Jul 2023 22:19:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233497AbjGMCTN (ORCPT ); Wed, 12 Jul 2023 22:19:13 -0400 Received: from pidgin.makrotopia.org (pidgin.makrotopia.org [185.142.180.65]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F89D2120; Wed, 12 Jul 2023 19:19:06 -0700 (PDT) Received: from local by pidgin.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from ) id 1qJlv6-0005XJ-1Y; Thu, 13 Jul 2023 02:19:05 +0000 Date: Thu, 13 Jul 2023 03:18:52 +0100 From: Daniel Golle To: netdev@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org, "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , Matthias Brugger , AngeloGioacchino Del Regno , Russell King , =?iso-8859-1?q?Bj=F8rn?= Mork , Florian Fainelli , Greg Ungerer Subject: [PATCH v2 net-next 4/9] net: ethernet: mtk_eth_soc: increase MAX_DEVS to 3 Message-ID: <2cc8012ec538106c6bcf22a40b647ec342e687a8.1689012506.git.daniel@makrotopia.org> References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,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 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1771270143622381802 X-GMAIL-MSGID: 1771270143622381802 From: Lorenzo Bianconi This is a preliminary patch to add MT7988 SoC support since it runs 3 macs instead of 2. Signed-off-by: Lorenzo Bianconi Signed-off-by: Daniel Golle --- drivers/net/ethernet/mediatek/mtk_eth_soc.c | 6 +++++- drivers/net/ethernet/mediatek/mtk_eth_soc.h | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/drivers/net/ethernet/mediatek/mtk_eth_soc.c index 7014e0d108b27..7f191e4337dd8 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.c +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.c @@ -4030,8 +4030,12 @@ static void mtk_sgmii_destroy(struct mtk_eth *eth) { int i; - for (i = 0; i < MTK_MAX_DEVS; i++) + for (i = 0; i < MTK_MAX_DEVS; i++) { + if (!eth->sgmii_pcs[i]) + continue; + mtk_pcs_lynxi_destroy(eth->sgmii_pcs[i]); + } } static int mtk_cleanup(struct mtk_eth *eth) diff --git a/drivers/net/ethernet/mediatek/mtk_eth_soc.h b/drivers/net/ethernet/mediatek/mtk_eth_soc.h index c74c3918113a5..b18ce4430d437 100644 --- a/drivers/net/ethernet/mediatek/mtk_eth_soc.h +++ b/drivers/net/ethernet/mediatek/mtk_eth_soc.h @@ -1049,8 +1049,8 @@ struct mtk_soc_data { #define MTK_DMA_MONITOR_TIMEOUT msecs_to_jiffies(1000) -/* currently no SoC has more than 2 macs */ -#define MTK_MAX_DEVS 2 +/* currently no SoC has more than 3 macs */ +#define MTK_MAX_DEVS 3 /* struct mtk_eth - This is the main datasructure for holding the state * of the driver