linux-renesas-soc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] phy: renesas: r8a779f0-ether-serdes: Add Re-initialize code
@ 2023-10-11  8:18 Yoshihiro Shimoda
  2023-10-11  8:18 ` [PATCH 1/2] phy: renesas: r8a779f0-ether-serdes: Reset in .init() Yoshihiro Shimoda
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2023-10-11  8:18 UTC (permalink / raw)
  To: vkoul, kishon; +Cc: linux-phy, linux-renesas-soc, Yoshihiro Shimoda

This patch series can re-initialize this PHY after called phy_exit() and
phy_init() again. Such re-initializing the PHY will be needed for system
suspend/resume.

Yoshihiro Shimoda (2):
  phy: renesas: r8a779f0-ether-serdes: Reset in .init()
  phy: renesas: r8a779f0-ether-serdes: Add .exit() ops

 drivers/phy/renesas/r8a779f0-ether-serdes.c | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] phy: renesas: r8a779f0-ether-serdes: Reset in .init()
  2023-10-11  8:18 [PATCH 0/2] phy: renesas: r8a779f0-ether-serdes: Add Re-initialize code Yoshihiro Shimoda
@ 2023-10-11  8:18 ` Yoshihiro Shimoda
  2023-10-11  8:18 ` [PATCH 2/2] phy: renesas: r8a779f0-ether-serdes: Add .exit() ops Yoshihiro Shimoda
  2023-10-13 10:43 ` [PATCH 0/2] phy: renesas: r8a779f0-ether-serdes: Add Re-initialize code Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2023-10-11  8:18 UTC (permalink / raw)
  To: vkoul, kishon; +Cc: linux-phy, linux-renesas-soc, Yoshihiro Shimoda

Reset this PHY in .init() instead of probe() for re-initializing
this PHY after probed correctly.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/phy/renesas/r8a779f0-ether-serdes.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/phy/renesas/r8a779f0-ether-serdes.c b/drivers/phy/renesas/r8a779f0-ether-serdes.c
index 683b19bc411a..ba1109d6bdd9 100644
--- a/drivers/phy/renesas/r8a779f0-ether-serdes.c
+++ b/drivers/phy/renesas/r8a779f0-ether-serdes.c
@@ -214,6 +214,10 @@ static int r8a779f0_eth_serdes_hw_init(struct r8a779f0_eth_serdes_channel *chann
 	if (dd->initialized)
 		return 0;
 
+	reset_control_reset(dd->reset);
+
+	usleep_range(1000, 2000);
+
 	ret = r8a779f0_eth_serdes_common_init_ram(dd);
 	if (ret)
 		return ret;
@@ -356,8 +360,6 @@ static int r8a779f0_eth_serdes_probe(struct platform_device *pdev)
 	if (IS_ERR(dd->reset))
 		return PTR_ERR(dd->reset);
 
-	reset_control_reset(dd->reset);
-
 	for (i = 0; i < R8A779F0_ETH_SERDES_NUM; i++) {
 		struct r8a779f0_eth_serdes_channel *channel = &dd->channel[i];
 
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] phy: renesas: r8a779f0-ether-serdes: Add .exit() ops
  2023-10-11  8:18 [PATCH 0/2] phy: renesas: r8a779f0-ether-serdes: Add Re-initialize code Yoshihiro Shimoda
  2023-10-11  8:18 ` [PATCH 1/2] phy: renesas: r8a779f0-ether-serdes: Reset in .init() Yoshihiro Shimoda
@ 2023-10-11  8:18 ` Yoshihiro Shimoda
  2023-10-13 10:43 ` [PATCH 0/2] phy: renesas: r8a779f0-ether-serdes: Add Re-initialize code Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Yoshihiro Shimoda @ 2023-10-11  8:18 UTC (permalink / raw)
  To: vkoul, kishon; +Cc: linux-phy, linux-renesas-soc, Yoshihiro Shimoda

Add r8a779f0_eth_serdes_exit() to clear the initialized flag
for re-initializing this PHY if needed.

Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
---
 drivers/phy/renesas/r8a779f0-ether-serdes.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/phy/renesas/r8a779f0-ether-serdes.c b/drivers/phy/renesas/r8a779f0-ether-serdes.c
index ba1109d6bdd9..fc6e398fa3bf 100644
--- a/drivers/phy/renesas/r8a779f0-ether-serdes.c
+++ b/drivers/phy/renesas/r8a779f0-ether-serdes.c
@@ -261,6 +261,15 @@ static int r8a779f0_eth_serdes_init(struct phy *p)
 	return ret;
 }
 
+static int r8a779f0_eth_serdes_exit(struct phy *p)
+{
+	struct r8a779f0_eth_serdes_channel *channel = phy_get_drvdata(p);
+
+	channel->dd->initialized = false;
+
+	return 0;
+}
+
 static int r8a779f0_eth_serdes_hw_init_late(struct r8a779f0_eth_serdes_channel
 *channel)
 {
@@ -318,6 +327,7 @@ static int r8a779f0_eth_serdes_set_speed(struct phy *p, int speed)
 
 static const struct phy_ops r8a779f0_eth_serdes_ops = {
 	.init		= r8a779f0_eth_serdes_init,
+	.exit		= r8a779f0_eth_serdes_exit,
 	.power_on	= r8a779f0_eth_serdes_power_on,
 	.set_mode	= r8a779f0_eth_serdes_set_mode,
 	.set_speed	= r8a779f0_eth_serdes_set_speed,
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] phy: renesas: r8a779f0-ether-serdes: Add Re-initialize code
  2023-10-11  8:18 [PATCH 0/2] phy: renesas: r8a779f0-ether-serdes: Add Re-initialize code Yoshihiro Shimoda
  2023-10-11  8:18 ` [PATCH 1/2] phy: renesas: r8a779f0-ether-serdes: Reset in .init() Yoshihiro Shimoda
  2023-10-11  8:18 ` [PATCH 2/2] phy: renesas: r8a779f0-ether-serdes: Add .exit() ops Yoshihiro Shimoda
@ 2023-10-13 10:43 ` Vinod Koul
  2 siblings, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2023-10-13 10:43 UTC (permalink / raw)
  To: kishon, Yoshihiro Shimoda; +Cc: linux-phy, linux-renesas-soc


On Wed, 11 Oct 2023 17:18:15 +0900, Yoshihiro Shimoda wrote:
> This patch series can re-initialize this PHY after called phy_exit() and
> phy_init() again. Such re-initializing the PHY will be needed for system
> suspend/resume.
> 
> Yoshihiro Shimoda (2):
>   phy: renesas: r8a779f0-ether-serdes: Reset in .init()
>   phy: renesas: r8a779f0-ether-serdes: Add .exit() ops
> 
> [...]

Applied, thanks!

[1/2] phy: renesas: r8a779f0-ether-serdes: Reset in .init()
      commit: aa4c0bbf820ddb9dd8105a403aa12df57b9e5129
[2/2] phy: renesas: r8a779f0-ether-serdes: Add .exit() ops
      commit: 1a5361189b7acac15b9b086b2300a11b7aa84c06

Best regards,
-- 
~Vinod



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2023-10-13 10:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-11  8:18 [PATCH 0/2] phy: renesas: r8a779f0-ether-serdes: Add Re-initialize code Yoshihiro Shimoda
2023-10-11  8:18 ` [PATCH 1/2] phy: renesas: r8a779f0-ether-serdes: Reset in .init() Yoshihiro Shimoda
2023-10-11  8:18 ` [PATCH 2/2] phy: renesas: r8a779f0-ether-serdes: Add .exit() ops Yoshihiro Shimoda
2023-10-13 10:43 ` [PATCH 0/2] phy: renesas: r8a779f0-ether-serdes: Add Re-initialize code Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).