netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: phy: qca807x: move interface mode check to .config_init_once
@ 2024-02-12 11:49 Robert Marko
  2024-02-12 14:51 ` Andrew Lunn
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Robert Marko @ 2024-02-12 11:49 UTC (permalink / raw)
  To: andersson, konrad.dybcio, andrew, hkallweit1, linux, davem,
	edumazet, kuba, pabeni, ansuelsmth, linux-arm-msm, netdev,
	linux-kernel
  Cc: Robert Marko

Currently, we are checking whether the PHY package mode matches the
individual PHY interface modes at PHY package probe time, but at that time
we only know the PHY package mode and not the individual PHY interface
modes as of_get_phy_mode() that populates it will only get called once the
netdev to which PHY-s are attached to is being probed and thus this check
will always fail and return -EINVAL.

So, lets move this check to .config_init_once as at that point individual
PHY interface modes should be populated.

Fixes: d1cb613efbd3 ("net: phy: qcom: add support for QCA807x PHY Family")
Signed-off-by: Robert Marko <robimarko@gmail.com>
---
 drivers/net/phy/qcom/qca807x.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/net/phy/qcom/qca807x.c b/drivers/net/phy/qcom/qca807x.c
index 01815f947060..780c28e2e4aa 100644
--- a/drivers/net/phy/qcom/qca807x.c
+++ b/drivers/net/phy/qcom/qca807x.c
@@ -562,6 +562,11 @@ static int qca807x_phy_package_config_init_once(struct phy_device *phydev)
 	struct qca807x_shared_priv *priv = shared->priv;
 	int val, ret;
 
+	/* Make sure PHY follow PHY package mode if enforced */
+	if (priv->package_mode != PHY_INTERFACE_MODE_NA &&
+	    phydev->interface != priv->package_mode)
+		return -EINVAL;
+
 	phy_lock_mdio_bus(phydev);
 
 	/* Set correct PHY package mode */
@@ -718,11 +723,6 @@ static int qca807x_probe(struct phy_device *phydev)
 	shared = phydev->shared;
 	shared_priv = shared->priv;
 
-	/* Make sure PHY follow PHY package mode if enforced */
-	if (shared_priv->package_mode != PHY_INTERFACE_MODE_NA &&
-	    phydev->interface != shared_priv->package_mode)
-		return -EINVAL;
-
 	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
 	if (!priv)
 		return -ENOMEM;
-- 
2.43.0


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

end of thread, other threads:[~2024-02-15 10:50 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-02-12 11:49 [PATCH net-next] net: phy: qca807x: move interface mode check to .config_init_once Robert Marko
2024-02-12 14:51 ` Andrew Lunn
2024-02-12 18:09   ` Robert Marko
2024-02-12 19:48     ` Andrew Lunn
2024-02-13 10:16       ` Robert Marko
2024-02-13 13:02         ` Christian Marangi
2024-02-13 13:27           ` Andrew Lunn
2024-02-14 17:59 ` Andrew Lunn
2024-02-15 10:50 ` patchwork-bot+netdevbpf

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).