[PATCH 1/3] net: microchip_t1s: refactor reset functionality

From: Ramón N.Rodriguez
Date: Mon Nov 27 2023 - 05:41:43 EST


From: Ramón Nordin Rodriguez <ramon.nordin.rodriguez@xxxxxxxxxxx>

This commit moves the reset functionality for lan867x from the revb1
init function to a separate function. The intention with this minor
refactor is to prepare for adding support for lan867x rev C1.

Signed-off-by: Ramón Nordin Rodriguez <ramon.nordin.rodriguez@xxxxxxxxxxx>
---
drivers/net/phy/microchip_t1s.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/microchip_t1s.c b/drivers/net/phy/microchip_t1s.c
index 534ca7d1b061..ace2bf35a18a 100644
--- a/drivers/net/phy/microchip_t1s.c
+++ b/drivers/net/phy/microchip_t1s.c
@@ -213,7 +213,7 @@ static int lan865x_revb0_config_init(struct phy_device *phydev)
return lan865x_setup_cfgparam(phydev);
}

-static int lan867x_revb1_config_init(struct phy_device *phydev)
+static int lan867x_wait_for_reset_complete(struct phy_device *phydev)
{
int err;

@@ -234,6 +234,16 @@ static int lan867x_revb1_config_init(struct phy_device *phydev)
return -ENODEV;
}
}
+ return 0;
+}
+
+static int lan867x_revb1_config_init(struct phy_device *phydev)
+{
+ int err;
+
+ err = lan867x_wait_for_reset_complete(phydev);
+ if (err)
+ return err;

/* Reference to AN1699
* https://ww1.microchip.com/downloads/aemDocuments/documents/AIS/ProductDocuments/SupportingCollateral/AN-LAN8670-1-2-config-60001699.pdf
--
2.40.1