717-v6.9-net-phy-qca807x-move-interface-mode-check-to-.config.patch 2.0 KB

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