From: Christian Marangi <ansuelsmth@gmail.com>
To: Andrew Lunn <andrew@lunn.ch>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Christian Marangi <ansuelsmth@gmail.com>
Subject: [net-next PATCH v2 07/12] net: phy: at803x: move specific at8031 config_init to dedicated function
Date: Fri, 1 Dec 2023 01:14:17 +0100 [thread overview]
Message-ID: <20231201001423.20989-8-ansuelsmth@gmail.com> (raw)
In-Reply-To: <20231201001423.20989-1-ansuelsmth@gmail.com>
Move specific at8031 config_init to dedicated function to make
at803x_config_init more generic and tidy things up.
Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
---
drivers/net/phy/at803x.c | 45 ++++++++++++++++++++++------------------
1 file changed, 25 insertions(+), 20 deletions(-)
diff --git a/drivers/net/phy/at803x.c b/drivers/net/phy/at803x.c
index ed3be7ed5463..02ac71f98466 100644
--- a/drivers/net/phy/at803x.c
+++ b/drivers/net/phy/at803x.c
@@ -951,27 +951,8 @@ static int at803x_hibernation_mode_config(struct phy_device *phydev)
static int at803x_config_init(struct phy_device *phydev)
{
- struct at803x_priv *priv = phydev->priv;
int ret;
- if (phydev->drv->phy_id == ATH8031_PHY_ID) {
- /* Some bootloaders leave the fiber page selected.
- * Switch to the appropriate page (fiber or copper), as otherwise we
- * read the PHY capabilities from the wrong page.
- */
- phy_lock_mdio_bus(phydev);
- ret = at803x_write_page(phydev,
- priv->is_fiber ? AT803X_PAGE_FIBER :
- AT803X_PAGE_COPPER);
- phy_unlock_mdio_bus(phydev);
- if (ret)
- return ret;
-
- ret = at8031_pll_config(phydev);
- if (ret < 0)
- return ret;
- }
-
/* The RX and TX delay default is:
* after HW reset: RX delay enabled and TX delay disabled
* after SW reset: RX delay enabled, while TX delay retains the
@@ -1606,6 +1587,30 @@ static int at8031_probe(struct phy_device *phydev)
return ret;
}
+static int at8031_config_init(struct phy_device *phydev)
+{
+ struct at803x_priv *priv = phydev->priv;
+ int ret;
+
+ /* Some bootloaders leave the fiber page selected.
+ * Switch to the appropriate page (fiber or copper), as otherwise we
+ * read the PHY capabilities from the wrong page.
+ */
+ phy_lock_mdio_bus(phydev);
+ ret = at803x_write_page(phydev,
+ priv->is_fiber ? AT803X_PAGE_FIBER :
+ AT803X_PAGE_COPPER);
+ phy_unlock_mdio_bus(phydev);
+ if (ret)
+ return ret;
+
+ ret = at8031_pll_config(phydev);
+ if (ret < 0)
+ return ret;
+
+ return at803x_config_init(phydev);
+}
+
static int qca83xx_config_init(struct phy_device *phydev)
{
u8 switch_revision;
@@ -2115,7 +2120,7 @@ static struct phy_driver at803x_driver[] = {
.name = "Qualcomm Atheros AR8031/AR8033",
.flags = PHY_POLL_CABLE_TEST,
.probe = at8031_probe,
- .config_init = at803x_config_init,
+ .config_init = at8031_config_init,
.config_aneg = at803x_config_aneg,
.soft_reset = genphy_soft_reset,
.set_wol = at803x_set_wol,
--
2.40.1
next prev parent reply other threads:[~2023-12-01 0:14 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-01 0:14 [net-next PATCH v2 00/12] net: phy: at803x: cleanup Christian Marangi
2023-12-01 0:14 ` [net-next PATCH v2 01/12] net: phy: at803x: fix passing the wrong reference for config_intr Christian Marangi
2023-12-01 0:14 ` [net-next PATCH v2 02/12] net: phy: at803x: move disable WOL to specific at8031 probe Christian Marangi
2023-12-06 17:09 ` Andrew Lunn
2023-12-01 0:14 ` [net-next PATCH v2 03/12] net: phy: at803x: raname hw_stats functions to qca83xx specific name Christian Marangi
2023-12-01 0:14 ` [net-next PATCH v2 04/12] net: phy: at803x: move qca83xx specific check in dedicated functions Christian Marangi
2023-12-01 0:14 ` [net-next PATCH v2 05/12] net: phy: at803x: move specific DT option for at8031 to specific probe Christian Marangi
2023-12-06 17:11 ` Andrew Lunn
2023-12-01 0:14 ` [net-next PATCH v2 06/12] net: phy: at803x: move specific at8031 probe mode check to dedicated probe Christian Marangi
2023-12-06 17:15 ` Andrew Lunn
2023-12-01 0:14 ` Christian Marangi [this message]
2023-12-06 17:16 ` [net-next PATCH v2 07/12] net: phy: at803x: move specific at8031 config_init to dedicated function Andrew Lunn
2023-12-01 0:14 ` [net-next PATCH v2 08/12] net: phy: at803x: move specific at8031 WOL bits " Christian Marangi
2023-12-05 9:32 ` Paolo Abeni
2023-12-05 14:43 ` Christian Marangi
2023-12-05 14:58 ` Russell King (Oracle)
2023-12-01 0:14 ` [net-next PATCH v2 09/12] net: phy: at803x: move specific at8031 config_intr " Christian Marangi
2023-12-01 0:14 ` [net-next PATCH v2 10/12] net: phy: at803x: make at8031 related DT functions name more specific Christian Marangi
2023-12-06 17:23 ` Andrew Lunn
2023-12-01 0:14 ` [net-next PATCH v2 11/12] net: phy: at803x: move at8035 specific DT parse to dedicated probe Christian Marangi
2023-12-06 17:25 ` Andrew Lunn
2023-12-01 0:14 ` [net-next PATCH v2 12/12] net: phy: at803x: drop specific PHY ID check from cable test functions Christian Marangi
2023-12-01 0:14 ` [net-next PATCH v2 12/12] net: phy: at803x: drop specific PHY id " Christian Marangi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231201001423.20989-8-ansuelsmth@gmail.com \
--to=ansuelsmth@gmail.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hkallweit1@gmail.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).