Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp4373817rwl; Mon, 3 Apr 2023 04:11:49 -0700 (PDT) X-Google-Smtp-Source: AKy350bLCUwVetmPpbqzWR/C8qSknWFS4C8irpKTKXwsWLqbwb4EPmzmg6/6ghqTQFOPWMXiyYHI X-Received: by 2002:a17:906:9397:b0:93f:fbe:ed17 with SMTP id l23-20020a170906939700b0093f0fbeed17mr31600685ejx.62.1680520308972; Mon, 03 Apr 2023 04:11:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680520308; cv=none; d=google.com; s=arc-20160816; b=Hyenx81sKpXoc+kDkojQ9rpwmbu766vPGIq/FEZsZ4kuCUKvaubSw4Dqxf2VWoAiuY iImgmxS/uKoiXriyNpxYIS08X6I+/Z4sTm1xBsU1J5wsJxv2gwdgeIFX5L5YWWwK10P1 rW5gCRGUIvjInRDZ8ecUk7sk/aTC+lctbPfO9R1iKpCuPX3691/+WwPYHFiMn0DRMraF vXKrLpIIlIL88Jl9va7JffAUJcrlIlnt5Jiqri9X00YSLyUlm3LGZIc8dknntQdl/FLg TJAPA0HqmA04JoWt0xXWhKBi2V9khErNb+C3VLP93YSbtvwDzY7MFZAaIJ6CYFQ0K4La 8a7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=2I5G0aWxNwP2AuZEd7HJV9PNt405h29TCjS3lS11GQE=; b=c8Xz8r1gaBXdOjPLb+4xUmJjp2sIsLLNQYb2RAt2zaCwvnotD6uDxoWBE8jpKrFrEP foxGtiiiO2VaqXANEgg9CwDNxJFJY834a5zcVfJ68asTmcUmDn6/707ztVzPLjW8Sfdy WOq0CVwVfqA3ILbZ2SLfKtpCn/fkKzD9FgZ07lS3jOcivVsA0HV03wwYWRHCPuq9DTeG bc6xQNhQhWRHk8HC5vEiuhHQzcSihMXkQWAjbiiu1s3BSsEJTSHlz3Hvcpw4+R+rdpYI MC/ekQjh2hVrV03NgxW5E2LOsMegMubEFtPPD7owYOaUYh4S+S5uNEXlsrtqB9EWJ4Wd elrA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=tGCSsnfX; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i5-20020a056402054500b005022100f550si8225230edx.686.2023.04.03.04.11.22; Mon, 03 Apr 2023 04:11:48 -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=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=tGCSsnfX; 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=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232023AbjDCLI4 (ORCPT + 99 others); Mon, 3 Apr 2023 07:08:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230090AbjDCLIy (ORCPT ); Mon, 3 Apr 2023 07:08:54 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D1F24F3; Mon, 3 Apr 2023 04:08:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=2I5G0aWxNwP2AuZEd7HJV9PNt405h29TCjS3lS11GQE=; b=tGCSsnfXfckTnukgZgod3OCwsa YnU3b/KQbrvK9i7Qq+Rkjbx4nZ9yBsb3Wbd61buN2wxXFaB9p6jOswox6Dy8BDEv5BIj/DtXeCY+U ljUoSTnuv16a9XP3Qk320OF4TgzfAANoGfajSHx7TpgLrj8qoPypAPU/nwism8gL+8mYDVKjGfQj6 fqxf/5Rso9kWci8OIB2ctsYzaCNI7yMjRtHY2MgaxuP1/Py2mzJ9pLRXs/hWzd1J6WsFqYuT3O1M6 oBfiaHkJJ3M6GfSsEdoZom3z/zWXdu2yqRw1Qu1VDr2ioCLwRTraXPivM+9uP3H8UfYPneTdr9Yz+ hKGCWXvg==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:39376) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1pjI3I-0002eu-Ld; Mon, 03 Apr 2023 12:08:44 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1pjI3H-0004AB-3C; Mon, 03 Apr 2023 12:08:43 +0100 Date: Mon, 3 Apr 2023 12:08:43 +0100 From: "Russell King (Oracle)" To: Siddharth Vadapalli Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, rogerq@kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, srk@ti.com Subject: Re: [PATCH net-next v2 1/3] net: ethernet: ti: am65-cpsw: Move mode specific config to mac_config() Message-ID: References: <20230403110106.983994-1-s-vadapalli@ti.com> <20230403110106.983994-2-s-vadapalli@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230403110106.983994-2-s-vadapalli@ti.com> Sender: Russell King (Oracle) X-Spam-Status: No, score=-2.5 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 Mon, Apr 03, 2023 at 04:31:04PM +0530, Siddharth Vadapalli wrote: > Move the interface mode specific configuration to the mac_config() > callback am65_cpsw_nuss_mac_config(). > > Signed-off-by: Siddharth Vadapalli > --- > drivers/net/ethernet/ti/am65-cpsw-nuss.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/ethernet/ti/am65-cpsw-nuss.c b/drivers/net/ethernet/ti/am65-cpsw-nuss.c > index d17757ecbf42..74e099828978 100644 > --- a/drivers/net/ethernet/ti/am65-cpsw-nuss.c > +++ b/drivers/net/ethernet/ti/am65-cpsw-nuss.c > @@ -1504,12 +1504,17 @@ static void am65_cpsw_nuss_mac_config(struct phylink_config *config, unsigned in > phylink_config); > struct am65_cpsw_port *port = container_of(slave, struct am65_cpsw_port, slave); > struct am65_cpsw_common *common = port->common; > + u32 mac_control = 0; > > if (common->pdata.extra_modes & BIT(state->interface)) { > - if (state->interface == PHY_INTERFACE_MODE_SGMII) > + if (state->interface == PHY_INTERFACE_MODE_SGMII) { > + mac_control |= CPSW_SL_CTL_EXT_EN; > writel(ADVERTISE_SGMII, > port->sgmii_base + AM65_CPSW_SGMII_MR_ADV_ABILITY_REG); > + } > > + if (mac_control) > + cpsw_sl_ctl_set(port->slave.mac_sl, mac_control); > writel(AM65_CPSW_SGMII_CONTROL_MR_AN_ENABLE, > port->sgmii_base + AM65_CPSW_SGMII_CONTROL_REG); > } > @@ -1553,8 +1558,7 @@ static void am65_cpsw_nuss_mac_link_up(struct phylink_config *config, struct phy > > if (speed == SPEED_1000) > mac_control |= CPSW_SL_CTL_GIG; > - if (interface == PHY_INTERFACE_MODE_SGMII) > - mac_control |= CPSW_SL_CTL_EXT_EN; > + /* TODO: Verify whether in-band is necessary for 10 Mbps RGMII */ > if (speed == SPEED_10 && phy_interface_mode_is_rgmii(interface)) > /* Can be used with in band mode only */ > mac_control |= CPSW_SL_CTL_EXT_EN; I'm afraid I can see you haven't thought this patch through properly. am65_cpsw_nuss_mac_link_down() will call cpsw_sl_ctl_reset(port->slave.mac_sl); which has the effect of clearing to zero the entire MAC control register. This will clear CPSW_SL_CTL_EXT_EN that was set in am65_cpsw_nuss_mac_config() which is not what you want to be doing. Given that we have the 10Mbps issue with RGMII, I think what you want to be doing is: 1. Set CPSW_SL_CTL_EXT_EN in am65_cpsw_nuss_mac_config() if in SGMII mode, otherwise clear this bit. 2. Clear the mac_control register in am65_cpsw_nuss_mac_link_down() if in RMGII mode, otherwise preserve the state of CPSW_SL_CTL_EXT_EN but clear all other bits. 3. Set CPSW_SL_CTL_EXT_EN in am65_cpsw_nuss_mac_link_up() if in RGMII mode and 10Mbps. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!