Received: by 2002:ab2:7903:0:b0:1fb:b500:807b with SMTP id a3csp814950lqj; Mon, 3 Jun 2024 01:14:08 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWHI3UhKnBWs0hPc1UV68/WG1zuyc5ow7ul9Abg69bKpoTT2ON9TzVE1/BKBLmx5vm4XyWncBBKzZXtnVhc/B31wn54MvW3nrQBvvfKJA== X-Google-Smtp-Source: AGHT+IE32uC5UqWYzIfrTDjpaoZAXjV45tjI7MYsqYEcFoqKCA5/BUwutZ978HSujuce624VEMvD X-Received: by 2002:a17:902:e546:b0:1f6:5c5e:d84f with SMTP id d9443c01a7336-1f65c5edabemr47768275ad.59.1717402447762; Mon, 03 Jun 2024 01:14:07 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717402447; cv=pass; d=google.com; s=arc-20160816; b=ICFSIeqTqAD/ePAwwW5ki/kMn5zHB8XvEeIm7UQM8in8t0hzaa/NpwAyHVxuCec4pF 1ezq9dXFrs8aKf4xZduUuP6MYaAOy9grbz0WNaWVBJ77DevG2NfCUAWsBmKPh+EOEeuJ UbAaYsCJnbjORVtF8j77kCu0dmv+zRB5kQ8x5xJzRX7iKrPt/JYR5LVhRdlEifmraYgT wmdvNbVmic15Tfm4nqJyX5H+EDXOZwQwDDi9ZE+P7bSvhfJGRKFWNugAqOKvM3MFOY8B pOpqYU8vcWAcSXYcctQAV/13DF42Yq+J+u+vOxFTji61xgEx1KAv6noQSTPOkBtP++hw WUBg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=59CM1T4kNHLXN8iP2xZIPMYXtUjSOpZ37vbcWdKyQJY=; fh=HKiS1ZJuFOTRlOvwU9MJaeSfDNXh8zFyTZYoZbt/pLA=; b=DpohAESP/5GqpjJLIe4dp3kvWDK/oEstA4sjwG8FAlJ+kap83PpD7uNL/wzLPNVw7e /qeirgYL+pWymJhxeTdyYmfKdautzfjWbeiLXvMy2zkIzd1UGQhqde4G3X81MALJnhYa wInMVIGK4UQsDC2F3kp6QqUJ/5Qc3z5Gx3vVpTouWtFXaIyd8/GMb1J3klZStYP24uhz kj0e9mf5p9vE7Ai0pI39kKyfMnQ8IO0SJjaHgr+kOtEJBSi/cycT6iOmHmqBuVltXx/W 5k3ALq89QU1gfmJJrLeF1QDaa5xW0QfXIk2GH15inlgRCFfoQ9Z4t8RQgqAS/cGqnAPT ZACA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=k8EuRzzC; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-198759-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198759-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id d9443c01a7336-1f6323de8b2si48266815ad.215.2024.06.03.01.14.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Jun 2024 01:14:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-198759-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=k8EuRzzC; arc=pass (i=1 dkim=pass dkdomain=armlinux.org.uk dmarc=pass fromdomain=armlinux.org.uk); spf=pass (google.com: domain of linux-kernel+bounces-198759-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-198759-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 10E4BB210C0 for ; Mon, 3 Jun 2024 08:14:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 79C2757C9A; Mon, 3 Jun 2024 08:13:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b="k8EuRzzC" Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [78.32.30.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F2DF7487BF; Mon, 3 Jun 2024 08:13:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=78.32.30.218 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717402431; cv=none; b=Es2dZBjQLmkabrEnIPRuuaZYKoDaykULPLgNqHN4LcfPFRMRsUHF+NXGJmqWT5UCgaqn0BZW5lqwyGFKWp6D5SmOgQ7wm9Eu4OSgPYhSudf8SNzwOS9OUqaW8VKnM4gvJBLodQq9MLtJ2GDhKwRoK5nOtrTlhhsI6+SbIB1XmCs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717402431; c=relaxed/simple; bh=dw35w2HlX6uEnLlGNP7oEeKFfwVxxiVEbHS8HsSh6Pc=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=RLmtzltzhsC9yqBv6wiGonsf4liBWvELcdn/v2eh9IKa7GR3RdKSoWDSrtMIy8E0kSjDxNKZTgrKfw6v4v052i6Oz0SW9Wci/he1KRN0c1tqAiOdqh6Rba768TqQOMQl3FJBOsu38mZLOyqqYnLHTuRre6WKa/TBxJas6Qon1Ig= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk; spf=none smtp.mailfrom=armlinux.org.uk; dkim=pass (2048-bit key) header.d=armlinux.org.uk header.i=@armlinux.org.uk header.b=k8EuRzzC; arc=none smtp.client-ip=78.32.30.218 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=armlinux.org.uk Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=armlinux.org.uk 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=59CM1T4kNHLXN8iP2xZIPMYXtUjSOpZ37vbcWdKyQJY=; b=k8EuRzzCfKfASeTkUM2IU1ILOO wJkGORLCBY5HaUOijcxWfp3qDWtOYt2ghO1T3T8m6SHBTf4uYr5NlTmkwQG1F/QCnZH4l8aiw4jPP 9Av/CfwaGZWtgawb95ZQt/1ExzH8/nCNWS4Z9AGRzpMQe4gvf7z/i6hqgp/PfZbtGcXStlSnU9EIE VfikzYJdeyrQzEuuVz6X0HL/rfP1aFGjcyvpHOow3m/Xdk+MqpeL03AAUYWNKiIsUPexZ6RY5deUb ybosb0beHgkpRMEIIGgU4EsSIt/Cmxp5Qk1tiImUk5AUp0ZnwzhaYKWAy96LRL/bVAkX8hTH0aqyT ye9H7dLA==; Received: from shell.armlinux.org.uk ([fd8f:7570:feb6:1:5054:ff:fe00:4ec]:50452) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1sE2hz-0002PF-31; Mon, 03 Jun 2024 09:06:24 +0100 Received: from linux by shell.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1sE2hy-0000Fn-FF; Mon, 03 Jun 2024 09:06:22 +0100 Date: Mon, 3 Jun 2024 09:06:22 +0100 From: "Russell King (Oracle)" To: SkyLake Huang =?utf-8?B?KOm7g+WVn+a+pCk=?= Cc: "andrew@lunn.ch" , "linux-kernel@vger.kernel.org" , "linux-mediatek@lists.infradead.org" , "kuba@kernel.org" , "pabeni@redhat.com" , "edumazet@google.com" , "linux-arm-kernel@lists.infradead.org" , "netdev@vger.kernel.org" , "dqfext@gmail.com" , "matthias.bgg@gmail.com" , Steven Liu =?utf-8?B?KOWKieS6uuixqik=?= , "davem@davemloft.net" , "hkallweit1@gmail.com" , "angelogioacchino.delregno@collabora.com" , "daniel@makrotopia.org" Subject: Re: [PATCH net-next v5 4/5] net: phy: mediatek: Extend 1G TX/RX link pulse time Message-ID: References: <20240530034844.11176-1-SkyLake.Huang@mediatek.com> <20240530034844.11176-5-SkyLake.Huang@mediatek.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Sender: Russell King (Oracle) On Mon, Jun 03, 2024 at 03:15:36AM +0000, SkyLake Huang (黃啟澤) wrote: > On Thu, 2024-05-30 at 17:10 +0100, Russell King (Oracle) wrote: > > > > External email : Please do not click links or open attachments until > > you have verified the sender or the content. > > On Thu, May 30, 2024 at 04:01:08PM +0000, SkyLake Huang (黃啟澤) wrote: > > > I'm not going to handle timeout case here. If we can't detect > > > MTK_PHY_FINAL_SPEED_1000 in 1 second, let it go and we'll detect it > > > next round. > > > > With this waiting up to one second for MTK_PHY_FINAL_SPEED_1000 to be > > set... > > > > > > > +int mtk_gphy_cl22_read_status(struct phy_device *phydev) > > > > > +{ > > > > > +int ret; > > > > > + > > > > > +ret = genphy_read_status(phydev); > > > > > +if (ret) > > > > > +return ret; > > > > > + > > > > > +if (phydev->autoneg == AUTONEG_ENABLE && !phydev- > > > > >autoneg_complete) { > > > > Are you sure you want this condition like this? When the link is > > down, > > and 1G speeds are being advertised, it means that you'll call > > extend_an_new_lp_cnt_limit(). If MTK_PHY_FINAL_SPEED_1000 doesn't get > > set, that'll take one second each and every time we poll the PHY for > > its status - which will be done while holding phydev->lock. > > > > This doesn't sound very good. > > > > -- > > RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ > > FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last! > > I add another condition to make sure we enter > extend_an_new_lp_cnt_limit() only in first few seconds when we plug in > cable. > > It will look like this: > =============================================================== > #define MTK_PHY_AUX_CTRL_AND_STATUS 0x14 > #define MTK_PHY_LP_DETECTED_MASK GENMASK(7, 6) > > if (phydev->autoneg == AUTONEG_ENABLE && !phydev->autoneg_complete) { > phy_select_page(phydev, MTK_PHY_PAGE_EXTENDED_1); > ret = __phy_read(phydev, MTK_PHY_AUX_CTRL_AND_STATUS); > phy_restore_page(phydev, MTK_PHY_PAGE_STANDARD, 0); We provide a helper for this: ret = phy_read_paged(phydev, MTK_PHY_PAGE_EXTENDED_1, MTK_PHY_AUX_CTRL_AND_STATUS); but please check "ret" for errors. -- RMK's Patch system: https://www.armlinux.org.uk/developer/patches/ FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!