Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp2677046rwr; Fri, 21 Apr 2023 12:14:35 -0700 (PDT) X-Google-Smtp-Source: AKy350Y/3NhiC79HZRGdC/8x9ifbqGBEg5ce5xoeIc0d80R4y/LPqZA8Vmd8JKhAXIHRNYfBEaGZ X-Received: by 2002:a17:902:ced0:b0:1a7:db2f:e918 with SMTP id d16-20020a170902ced000b001a7db2fe918mr7085995plg.1.1682104475299; Fri, 21 Apr 2023 12:14:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682104475; cv=none; d=google.com; s=arc-20160816; b=aypC+TBEKSOMZXpEyP1mdMeVDy9waDwbn1ZkT6VjwP6GO9awOL5oogGud7mAXQq6xT MtnYE/c20K04v4uTQxQLb7RO3O/dDV3eaf3z8IlEDHuyv//6hJgoZx9ImeyCkiaujcWs keS/CNOW2XVvcdI2YLrGfHAEwVyI7qvPak7BYXuasjfFbmKQ2+Pi4V3G1r9n7o+u23fH u33aNP/ZmdhFi1UMxQI6g+R+WFKs98m5Pr6up0oXy8jQExPP2XyAYsvnGkDCesQyRlWd caQtAtEkrmRK3Dfi7Dlo5CfMAsStNlUYfDrcY3/yKaAm8DmNutv6dGAg+nPGzZ162OTi dHGg== 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-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=GZGv9cQrrre1lqWgC7IqFyZLxHbrSjanKLwNZbrl950=; b=yhsMvesXwu2xh4ae4ltuf3IR+W1kBpQ5YtQa2hJrGSXlWp+xc6iVLQbRqVwZ6GFWi9 2k5sOOAP+GkgavR541wN6xVNsueOJfM7MyrcL2Oa94xRysFJD1ThyZWsT8a/+a6U+wjl 8tm4aiPiAg9ZNDg2X9j4xUJgNUyO0tyoCJrdwIAcpZER+E+OuSIgO4SmPygJZnt/KmiA DkXSSN1RPkSLuTgJNZ7VdTomG00AyFmVJRaembo42+qnnSa/z9gK7wlZ4EaVei2B6JfL liYz/TpkrlbGoR0rsz8NMkPM70k93AN6C13EKg6j/+25Pf0RytiO2EzC+dWtmp4O8032 QbVQ== 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b6-20020a170902650600b001a6d4eab483si4649286plk.49.2023.04.21.12.14.23; Fri, 21 Apr 2023 12:14:35 -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 S233316AbjDUTGu (ORCPT + 99 others); Fri, 21 Apr 2023 15:06:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34322 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232017AbjDUTGt (ORCPT ); Fri, 21 Apr 2023 15:06:49 -0400 Received: from fudo.makrotopia.org (fudo.makrotopia.org [IPv6:2a07:2ec0:3002::71]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B477E53; Fri, 21 Apr 2023 12:06:45 -0700 (PDT) Received: from local by fudo.makrotopia.org with esmtpsa (TLS1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.96) (envelope-from ) id 1ppw5N-0002na-2t; Fri, 21 Apr 2023 21:06:22 +0200 Date: Fri, 21 Apr 2023 20:06:18 +0100 From: Daniel Golle To: =?utf-8?B?QXLEsW7DpyDDnE5BTA==?= Cc: Sean Wang , Landen Chao , DENG Qingfang , Andrew Lunn , Florian Fainelli , Vladimir Oltean , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Matthias Brugger , AngeloGioacchino Del Regno , Russell King , Richard van Schagen , Richard van Schagen , Frank Wunderlich , erkin.bozoglu@xeront.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: Re: [RFC PATCH net-next 20/22] net: dsa: mt7530: force link-down on MACs before reset on MT7530 Message-ID: References: <20230421143648.87889-1-arinc.unal@arinc9.com> <20230421143648.87889-21-arinc.unal@arinc9.com> <7982894a-029c-585a-9ab5-3a6295c6abaa@arinc9.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <7982894a-029c-585a-9ab5-3a6295c6abaa@arinc9.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 On Fri, Apr 21, 2023 at 09:47:16PM +0300, Arınç ÜNAL wrote: > On 21.04.2023 21:42, Daniel Golle wrote: > > On Fri, Apr 21, 2023 at 05:36:46PM +0300, arinc9.unal@gmail.com wrote: > > > From: Arınç ÜNAL > > > > > > Force link-down on all MACs before internal reset. Let's follow suit commit > > > 728c2af6ad8c ("net: mt7531: ensure all MACs are powered down before > > > reset"). > > > > > > Tested-by: Arınç ÜNAL > > > Signed-off-by: Arınç ÜNAL > > > --- > > > drivers/net/dsa/mt7530.c | 4 ++++ > > > 1 file changed, 4 insertions(+) > > > > > > diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c > > > index ac1e3c58aaac..8ece3d0d820c 100644 > > > --- a/drivers/net/dsa/mt7530.c > > > +++ b/drivers/net/dsa/mt7530.c > > > @@ -2203,6 +2203,10 @@ mt7530_setup(struct dsa_switch *ds) > > > return -EINVAL; > > > } > > > + /* Force link-down on all MACs before internal reset */ > > > + for (i = 0; i < MT7530_NUM_PORTS; i++) > > > + mt7530_write(priv, MT7530_PMCR_P(i), PMCR_FORCE_LNK); > > > + > > > > Moving this part to mt753x_setup just before calling priv->info->sw_setup(ds); > > is probably better. Though it isn't documented I assume that the requirement > > to have the ports in force-link-down may also apply to MT7988, and for sure > > it doesn't do any harm. > > > > Hence I suggest to squash this change: > > diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c > > index a2cb7e296165e..998c4e8930cd3 100644 > > --- a/drivers/net/dsa/mt7530.c > > +++ b/drivers/net/dsa/mt7530.c > > @@ -2203,10 +2203,6 @@ mt7530_setup(struct dsa_switch *ds) > > return -EINVAL; > > } > > - /* Force link-down on all MACs before internal reset */ > > - for (i = 0; i < MT7530_NUM_PORTS; i++) > > - mt7530_write(priv, MT7530_PMCR_P(i), PMCR_FORCE_LNK); > > - > > /* Reset the switch through internal reset */ > > mt7530_write(priv, MT7530_SYS_CTRL, > > SYS_CTRL_PHY_RST | SYS_CTRL_SW_RST | > > @@ -2423,10 +2419,6 @@ mt7531_setup(struct dsa_switch *ds) > > dev_info(priv->dev, "found MT7531BE\n"); > > } > > - /* all MACs must be forced link-down before sw reset */ > > - for (i = 0; i < MT7530_NUM_PORTS; i++) > > - mt7530_write(priv, MT7530_PMCR_P(i), MT7531_FORCE_LNK); > > - > > /* Reset the switch through internal reset */ > > mt7530_write(priv, MT7530_SYS_CTRL, > > SYS_CTRL_PHY_RST | SYS_CTRL_SW_RST | > > @@ -2907,6 +2899,10 @@ mt753x_setup(struct dsa_switch *ds) > > priv->pcs[i].port = i; > > } > > + /* Force link-down on all MACs before setup */ > > + for (i = 0; i < MT7530_NUM_PORTS; i++) > > + mt7530_write(priv, MT7530_PMCR_P(i), PMCR_FORCE_LNK); > > MT7531 has got a different bit on the register for this, MT7531_FORCE_LNK. > Are you sure PMCR_FORCE_LNK would work for MT7531 too? No, I had overlooked that. As the effects of not doing the force-link-down before the reset are subtle and depend on the link-partners I may not have cought them in my tests. > > Arınç