Received: by 2002:ab2:6816:0:b0:1f9:5764:f03e with SMTP id t22csp1254565lqo; Fri, 17 May 2024 16:43:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUWh5sTwGkf2kBF2/+yLr3veUmK1cKDPIKZm8Cw6WTdU8OXYN/ERspQw0bvS7u3iEDSjzzaWNxcOoJ2NADcfHkbra8Wyd/4SQClbFAaKg== X-Google-Smtp-Source: AGHT+IG4Q1QfgrJOxYw6P65/ngAea6o5+inoY0HDm6SqkzyfvfDmk4mW7exkkD0dcAmAO41zTMHF X-Received: by 2002:a17:902:8648:b0:1e4:b16e:7f10 with SMTP id d9443c01a7336-1ef43e292e4mr223022465ad.33.1715989439216; Fri, 17 May 2024 16:43:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715989439; cv=pass; d=google.com; s=arc-20160816; b=pcq00oVTrX+l4FS2GmUeUwZbk6/VHbcFlMlKpekY0vs8JqL0z3sVUDGfHb+G0ccW1G 2ex1AWqYYZeSwCGD826PWnX57L5ELUodMTetrL8ZZ8/pFo3BfMalTa3ObMzA6Xv/TTnZ 7Ca1guxa68uC774d5qUmwe9ZEfhdG3RwrmUFrHh7e2iWcDLWGxE54OSFBGmdhVpp/GvT WEi5QeQ4CRIxW+2HFE8HJOxxtZ4gVj3pfReqY909MJYwndNfh4xWjGGT9wgRv8EZLaSk H+LT8uw6ZM4r5b+gEZYPS3Morcb1mcJ2Fo5O8G3aoccUSIuGNLrAhEJtsxnbf+3EUm8A lo6w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=2v1/YXR2GimaLG5uR1GGycdNdXwLlVivQdeAFA74MKY=; fh=XfG3To2iOTA5O8FMXEBj/z4p7vH51SLWWAoCGfMh1iA=; b=hsRh4RIICl7tH009tDt6+iTMYeLvn9PqNTOvnN3GAo4rUKN5HN5613rEImTWt/mwGr 88kssp8bqkx4T8gcvzfvye4prTxWPscZUMhGZB/lCKqJC0CIZC5EWd/t+ZEl897xI5BU qa7M2ucT0wrVRVSeN3jjTyKeaLAM3WS9xPy05ZYe2i4tV4KzSrqMqXN07/j6++ax0/lG vcLmS6TNo4FWtD7dLosTo8zmFdWL2SvsRjQhE0RihdmAKBH8X2NspyVmoRyuhymUdFI/ iyrqFSOB/JqfBwlEVKgiC4R/CSKhSUNeS0CzbbXIqTEL5H+WctBgiEb1KxrjbNfHErbS 8zCA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=NI8N36hk; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-182706-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182706-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1ef0b9cfb2fsi198288205ad.98.2024.05.17.16.43.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 May 2024 16:43:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-182706-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@lunn.ch header.s=20171124 header.b=NI8N36hk; arc=pass (i=1 spf=pass spfdomain=lunn.ch dkim=pass dkdomain=lunn.ch dmarc=pass fromdomain=lunn.ch); spf=pass (google.com: domain of linux-kernel+bounces-182706-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-182706-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=lunn.ch 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 BC789B20B89 for ; Fri, 17 May 2024 23:43:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 89FBF1419B5; Fri, 17 May 2024 23:43:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b="NI8N36hk" Received: from vps0.lunn.ch (vps0.lunn.ch [156.67.10.101]) (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 074E21E532; Fri, 17 May 2024 23:43:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=156.67.10.101 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715989426; cv=none; b=QX4VsGcIq6cYfeSQulj6wQBjw2a79uMmLOb+lj1KIrsppLaoNc0Pj1yx+DKk95ZS/9TByNqR0rvDM71KQVfzrKHeZUl/w5nlsmTNJOvkHtv1QarZVD6rZFi4choSXZGOTeUgmfLi4H/RmHmEeaQiat3z0494W890aUN5+Ql2JgA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715989426; c=relaxed/simple; bh=SUJNIfxCBNQFiBrC8tFj+egOdR1XQPQFhxzFYVcVbvk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=oGOfKGFNd6QOVM1MD3TonDVARQWhlEiKVH/h92u07icCcVFKN4h7unZaJiElDM8Xtlaw0rXKZjzmvbI6qzyRa7PcoD0ZTisteMH61eVVFQmxkHVnCEMrjS5BDp9OusPU6EbhTn/6jByWfD2ckTxc9cHf58829KyJnMsqmdJFavw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch; spf=pass smtp.mailfrom=lunn.ch; dkim=pass (1024-bit key) header.d=lunn.ch header.i=@lunn.ch header.b=NI8N36hk; arc=none smtp.client-ip=156.67.10.101 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=lunn.ch Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=lunn.ch DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lunn.ch; s=20171124; h=In-Reply-To:Content-Disposition:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:From:Sender:Reply-To:Subject: Date:Message-ID:To:Cc:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Content-Disposition:In-Reply-To:References; bh=2v1/YXR2GimaLG5uR1GGycdNdXwLlVivQdeAFA74MKY=; b=NI8N36hk3w1HBCPBgYWVnuTdlU MN8Jb6YqDUjkgQWyBkeFvHzmmqRZz4DDcjHWIv2z3Yw97fVCuPPTzQJj64sxUNfcdvAHFdrCeP0cB HLlQbW4Tt2zfmgBaj8IJZWx1b5FoQpTsvM3V/W44EGW1j6VIdnwjjrAkwlgxmNBuFcVs=; Received: from andrew by vps0.lunn.ch with local (Exim 4.94.2) (envelope-from ) id 1s87EJ-00FbJa-LE; Sat, 18 May 2024 01:43:15 +0200 Date: Sat, 18 May 2024 01:43:15 +0200 From: Andrew Lunn To: Sky Huang Cc: Heiner Kallweit , Russell King , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Daniel Golle , Qingfang Deng , Matthias Brugger , AngeloGioacchino Del Regno , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, Steven Liu Subject: Re: [PATCH net-next v2 4/5] net: phy: mediatek: Extend 1G TX/RX link pulse time Message-ID: References: <20240517102908.12079-1-SkyLake.Huang@mediatek.com> <20240517102908.12079-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=us-ascii Content-Disposition: inline In-Reply-To: <20240517102908.12079-5-SkyLake.Huang@mediatek.com> > +int mtk_gphy_cl22_read_status(struct phy_device *phydev) > +{ > + int err, old_link = phydev->link; > + int mii_ctrl; > + > + /* Update the link, but return if there was an error */ > + err = genphy_update_link(phydev); > + if (err) > + return err; > + > + /* why bother the PHY if nothing can have changed */ > + if (phydev->autoneg == AUTONEG_ENABLE && old_link && phydev->link) > + return 0; > + > + phydev->master_slave_get = MASTER_SLAVE_CFG_UNSUPPORTED; > + phydev->master_slave_state = MASTER_SLAVE_STATE_UNSUPPORTED; > + phydev->speed = SPEED_UNKNOWN; > + phydev->duplex = DUPLEX_UNKNOWN; > + phydev->pause = 0; > + phydev->asym_pause = 0; > + > + if (phydev->is_gigabit_capable) { > + err = genphy_read_master_slave(phydev); > + if (err < 0) > + return err; > + } > + > + err = genphy_read_lpa(phydev); > + if (err < 0) > + return err; > + > + if (phydev->autoneg == AUTONEG_ENABLE) { > + if (phydev->autoneg_complete) { > + phy_resolve_aneg_linkmode(phydev); > + } else { > + mii_ctrl = phy_read(phydev, MII_CTRL1000); > + if ((mii_ctrl & ADVERTISE_1000FULL) || (mii_ctrl & ADVERTISE_1000HALF)) > + extend_an_new_lp_cnt_limit(phydev); This all looks very similar to genphy_read_status(), except these three. Would it be possible to call genphy_read_status() to do most of the work, and then do these couple of lines of code. Andrew