53652c38fc0561ab1b685f6b3da01d2eae0c2d60
[openwrt/staging/wigyori.git] /
1 From 3be0d950b62852a693182cb678948f481de02825 Mon Sep 17 00:00:00 2001
2 From: Robert Marko <robimarko@gmail.com>
3 Date: Mon, 12 Feb 2024 12:49:34 +0100
4 Subject: [PATCH] net: phy: qca807x: move interface mode check to
5 .config_init_once
6
7 Currently, we are checking whether the PHY package mode matches the
8 individual PHY interface modes at PHY package probe time, but at that time
9 we only know the PHY package mode and not the individual PHY interface
10 modes as of_get_phy_mode() that populates it will only get called once the
11 netdev to which PHY-s are attached to is being probed and thus this check
12 will always fail and return -EINVAL.
13
14 So, lets move this check to .config_init_once as at that point individual
15 PHY interface modes should be populated.
16
17 Fixes: d1cb613efbd3 ("net: phy: qcom: add support for QCA807x PHY Family")
18 Signed-off-by: Robert Marko <robimarko@gmail.com>
19 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
20 Link: https://lore.kernel.org/r/20240212115043.1725918-1-robimarko@gmail.com
21 Signed-off-by: Paolo Abeni <pabeni@redhat.com>
22 ---
23 drivers/net/phy/qcom/qca807x.c | 10 +++++-----
24 1 file changed, 5 insertions(+), 5 deletions(-)
25
26 --- a/drivers/net/phy/qcom/qca807x.c
27 +++ b/drivers/net/phy/qcom/qca807x.c
28 @@ -562,6 +562,11 @@ static int qca807x_phy_package_config_in
29 struct qca807x_shared_priv *priv = shared->priv;
30 int val, ret;
31
32 + /* Make sure PHY follow PHY package mode if enforced */
33 + if (priv->package_mode != PHY_INTERFACE_MODE_NA &&
34 + phydev->interface != priv->package_mode)
35 + return -EINVAL;
36 +
37 phy_lock_mdio_bus(phydev);
38
39 /* Set correct PHY package mode */
40 @@ -718,11 +723,6 @@ static int qca807x_probe(struct phy_devi
41 shared = phydev->shared;
42 shared_priv = shared->priv;
43
44 - /* Make sure PHY follow PHY package mode if enforced */
45 - if (shared_priv->package_mode != PHY_INTERFACE_MODE_NA &&
46 - phydev->interface != shared_priv->package_mode)
47 - return -EINVAL;
48 -
49 priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
50 if (!priv)
51 return -ENOMEM;