From patchwork Wed Dec 20 15:55:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 13500305 X-Patchwork-Delegate: kuba@kernel.org Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 7FBD741875 for ; Wed, 20 Dec 2023 15:56:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="ES0S4cDx" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5FEACC433C9; Wed, 20 Dec 2023 15:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1703087760; bh=PzqSoS7JcvqSMbjEYVeKdFso7tqADg3bJ1pfbVXyVDU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ES0S4cDxOVXd+2Fl6uKtO1BKt0J/axd0o6ZbB4HPQevWUvAdmzb+ARCEXY5DvXVtL n5jd/cJsB5vU6CwUslQUOnJEeVv7xy+7DH5XmsP31/7WRj1Rie5vjCjIXiJsrGPXjx qbwoNsUzmc57NOGHQCYTOT6x+4Y0AAi/ZwFSagsUd87NKD87nk2XOLP6qRnNy95sg0 nxoO3xgDuwFyTKgXEGsXlaKEGsc+CKFG+DDlc5anuaFyO165mT4TOY/tvJp0VYtB7D PCy+UTFaKe5x+mSPy5KKG3ZM8p46HbnxZhdYJeZH/hc1bjmirRk2/tuFebojS2OgW4 RTiEyTlwEPG2A== From: =?utf-8?q?Marek_Beh=C3=BAn?= To: netdev@vger.kernel.org, Andrew Lunn , "David S. Miller" , Jakub Kicinski , Paolo Abeni Cc: Russell King , Alexander Couzens , Daniel Golle , Heiner Kallweit , Willy Liu , Ioana Ciornei , =?utf-8?q?Marek_Moj=C3=ADk?= , =?utf-8?q?Maximili=C3=A1?= =?utf-8?q?n_Maliar?= , =?utf-8?q?Marek_Beh=C3=BAn?= Subject: [PATCH net-next 12/15] net: phy: realtek: use generic c45 suspend/resume for rtl822x Date: Wed, 20 Dec 2023 16:55:15 +0100 Message-ID: <20231220155518.15692-13-kabel@kernel.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20231220155518.15692-1-kabel@kernel.org> References: <20231220155518.15692-1-kabel@kernel.org> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org Now that rtl822x PHYs .read_mmd() and .write_mmd() methods support accessing all MMD registers, use the generic clause 45 functions genphy_c45_pma_suspend() and genphy_c45_pma_resume() for the rtl822x series of Realtek transceivers. Add a 20ms delay after resume, as done in the current resume implementation. Signed-off-by: Marek BehĂșn --- drivers/net/phy/realtek.c | 36 ++++++++++++++++++++++++------------ 1 file changed, 24 insertions(+), 12 deletions(-) diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index f36b2bfabe57..cf608d390aa5 100644 --- a/drivers/net/phy/realtek.c +++ b/drivers/net/phy/realtek.c @@ -651,6 +651,18 @@ static int rtl822x_probe(struct phy_device *phydev) return 0; } +static int rtl822x_resume(struct phy_device *phydev) +{ + int ret = genphy_c45_pma_resume(phydev); + + if (ret < 0) + return ret; + + msleep(20); + + return 0; +} + static int rtl822x_config_aneg(struct phy_device *phydev) { bool changed = false; @@ -949,8 +961,8 @@ static struct phy_driver realtek_drvs[] = { .probe = rtl822x_probe, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, - .suspend = genphy_suspend, - .resume = rtlgen_resume, + .suspend = genphy_c45_pma_suspend, + .resume = rtl822x_resume, .read_page = rtl821x_read_page, .write_page = rtl821x_write_page, .read_mmd = rtlgen_read_mmd, @@ -961,8 +973,8 @@ static struct phy_driver realtek_drvs[] = { .probe = rtl822x_probe, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, - .suspend = genphy_suspend, - .resume = rtlgen_resume, + .suspend = genphy_c45_pma_suspend, + .resume = rtl822x_resume, .read_page = rtl821x_read_page, .write_page = rtl821x_write_page, .read_mmd = rtlgen_read_mmd, @@ -973,8 +985,8 @@ static struct phy_driver realtek_drvs[] = { .probe = rtl822x_probe, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, - .suspend = genphy_suspend, - .resume = rtlgen_resume, + .suspend = genphy_c45_pma_suspend, + .resume = rtl822x_resume, .read_page = rtl821x_read_page, .write_page = rtl821x_write_page, .read_mmd = rtlgen_read_mmd, @@ -985,8 +997,8 @@ static struct phy_driver realtek_drvs[] = { .probe = rtl822x_probe, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, - .suspend = genphy_suspend, - .resume = rtlgen_resume, + .suspend = genphy_c45_pma_suspend, + .resume = rtl822x_resume, .read_page = rtl821x_read_page, .write_page = rtl821x_write_page, .read_mmd = rtlgen_read_mmd, @@ -997,8 +1009,8 @@ static struct phy_driver realtek_drvs[] = { .probe = rtl822x_probe, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, - .suspend = genphy_suspend, - .resume = rtlgen_resume, + .suspend = genphy_c45_pma_suspend, + .resume = rtl822x_resume, .read_page = rtl821x_read_page, .write_page = rtl821x_write_page, .read_mmd = rtlgen_read_mmd, @@ -1009,8 +1021,8 @@ static struct phy_driver realtek_drvs[] = { .probe = rtl822x_probe, .config_aneg = rtl822x_config_aneg, .read_status = rtl822x_read_status, - .suspend = genphy_suspend, - .resume = rtlgen_resume, + .suspend = genphy_c45_pma_suspend, + .resume = rtl822x_resume, .read_page = rtl821x_read_page, .write_page = rtl821x_write_page, .read_mmd = rtlgen_read_mmd,