From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id BD4AFC761A6 for ; Mon, 3 Apr 2023 11:09:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=hf5BP2ok/Yg3dWPlPxTNwzqje7M+zw59rukh2/xL7UY=; b=Mw9DzA9fpwb+2n IThgVf2zmjUXJtgH0InRDjWDI5aeBRDn5tJfDcInoAWhUiKDZ/XRBiGrrR59Cj1MbVhlJIB+t0NSv MTff6Q02pqZCrT94BAuEFSy8xXRaQokpz7CZhE8Ot0neRlOUGrkP6zPoXKvsP3qftNjO7bkg5Rjxn aiwbzBBfRC7/yEyAi7xZ+vUrn9AaBSIR8tyeWWjBMMleXthz1RVKI3HqNL7Astpq0ge2sUUy6o1Q4 GHT4HsKpCWLTCb/KQwlUViVnj2h8wuphmkp/4lqNukdqp6Swu3doH3h72te7kiDIs7kMkFuXfnUCg HuKEmfaej/c5ZbkhXwlQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1pjI3Z-00F3qQ-3A; Mon, 03 Apr 2023 11:09:01 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pjI3W-00F3os-24 for linux-arm-kernel@lists.infradead.org; Mon, 03 Apr 2023 11:09:00 +0000 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-Disposition: inline In-Reply-To: <20230403110106.983994-2-s-vadapalli@ti.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230403_040858_683549_E3F4D6F8 X-CRM114-Status: GOOD ( 19.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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! _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel