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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F053FC6379F for ; Thu, 19 Jan 2023 17:22:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230188AbjASRWJ (ORCPT ); Thu, 19 Jan 2023 12:22:09 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229634AbjASRWF (ORCPT ); Thu, 19 Jan 2023 12:22:05 -0500 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 49D5393F4 for ; Thu, 19 Jan 2023 09:22:03 -0800 (PST) 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-Transfer-Encoding:Content-Type: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-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=gHTUhXp1oIOUR/fxnoi4uPGWxB/25tr2xPFfXTm8eeo=; b=U0o/AH9tgh1ezvkriq/AGZ8p5/ eBzNhngupxZ+3BvbRc7pu2yxXSPRYtRSsKED20CMM7k2RgBqFyb8idKHQcqywbUdkvc3H53BsovAA qOxo7br07bif1q9Jl+kp1o8TaXbIpwN5Yf+vPH07R2BPRoDS45f3dNvlbgjyzUNU7ylNt8X0bwY/k nhdJCEAdHDM/qxlCAR+ui2OxovCHkQyCvxiKRCSPq0bbHXdsC/kCcrCRuofeJjATkcM8pqT4RKuiS MwXBAKtnQgMa5xeIDMFF78TKXth/wwUfE5BWm+1U146ysl0iBh7adSvQdNjR4rcwez5Agkl0Je7sw dO+b+gLQ==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:36212) 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 1pIYbw-0004jx-9e; Thu, 19 Jan 2023 17:21:59 +0000 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1pIYbt-0000eT-KS; Thu, 19 Jan 2023 17:21:57 +0000 Date: Thu, 19 Jan 2023 17:21:57 +0000 From: "Russell King (Oracle)" To: =?iso-8859-1?Q?Bj=F8rn?= Mork Cc: netdev@vger.kernel.org, Felix Fietkau , John Crispin , Sean Wang , Mark Lee , Lorenzo Bianconi , Daniel Golle , Alexander Couzens Subject: Re: [PATCH net 2/3] net: mediatek: sgmii: autonegotiation is required Message-ID: References: <20230119171248.3882021-1-bjorn@mork.no> <20230119171248.3882021-3-bjorn@mork.no> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230119171248.3882021-3-bjorn@mork.no> Sender: Russell King (Oracle) Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org On Thu, Jan 19, 2023 at 06:12:47PM +0100, Bjørn Mork wrote: > sgmii mode fails if autonegotiation is disabled. > > Signed-off-by: Bjørn Mork > --- > drivers/net/ethernet/mediatek/mtk_sgmii.c | 11 +++-------- > 1 file changed, 3 insertions(+), 8 deletions(-) > > diff --git a/drivers/net/ethernet/mediatek/mtk_sgmii.c b/drivers/net/ethernet/mediatek/mtk_sgmii.c > index 481f2f1e39f5..d1f2bcb21242 100644 > --- a/drivers/net/ethernet/mediatek/mtk_sgmii.c > +++ b/drivers/net/ethernet/mediatek/mtk_sgmii.c > @@ -62,14 +62,9 @@ static int mtk_pcs_config(struct phylink_pcs *pcs, unsigned int mode, > * other words, 1000Mbps or 2500Mbps). > */ > if (interface == PHY_INTERFACE_MODE_SGMII) { > - sgm_mode = SGMII_IF_MODE_SGMII; > - if (phylink_autoneg_inband(mode)) { > - sgm_mode |= SGMII_REMOTE_FAULT_DIS | > - SGMII_SPEED_DUPLEX_AN; > - use_an = true; > - } else { > - use_an = false; > - } > + sgm_mode = SGMII_IF_MODE_SGMII | SGMII_REMOTE_FAULT_DIS | > + SGMII_SPEED_DUPLEX_AN; > + use_an = true; I wasn't actually suggesting in our discussion that this is something which should be changed. The reference implementation for the expected behaviour is phylink_mii_c22_pcs_config(), and it only enables in-band if "mode" says so. If we have a PHY which has in-band disabled (yes, they do exist) then having SGMII in-band unconditionally enabled breaks them, and yes, those PHYs appear on SFP modules. The proper answer is to use 'managed = "in-band-status";' in your DT to have in-band used with SGMII. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 40Mbps down 10Mbps up. Decent connectivity at last!