790-37-v6.9-net-dsa-mt7530-remove-.mac_port_config-for-MT7988-an.patch 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. From 2f507aaeb1a12044f2376a255c2afff1f7432b0b Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= <[email protected]>
  3. Date: Fri, 1 Mar 2024 12:42:57 +0200
  4. Subject: [PATCH 37/48] net: dsa: mt7530: remove .mac_port_config for MT7988
  5. and make it optional
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. For the switch on the MT7988 SoC, the mac_port_config member for ID_MT7988
  10. in mt753x_table is not needed as the interfaces of all MACs are already
  11. handled on mt7988_mac_port_get_caps().
  12. Therefore, remove the mac_port_config member from ID_MT7988 in
  13. mt753x_table. Before calling priv->info->mac_port_config(), if there's no
  14. mac_port_config member in mt753x_table, exit mt753x_mac_config()
  15. successfully.
  16. Remove calling priv->info->mac_port_config() from the sanity check as the
  17. sanity check requires a pointer to a mac_port_config function to be
  18. non-NULL. This will fail for MT7988 as mac_port_config won't be a member of
  19. its info table.
  20. Co-developed-by: Daniel Golle <[email protected]>
  21. Signed-off-by: Daniel Golle <[email protected]>
  22. Signed-off-by: Arınç ÜNAL <[email protected]>
  23. Reviewed-by: Vladimir Oltean <[email protected]>
  24. Reviewed-by: Russell King (Oracle) <[email protected]>
  25. Signed-off-by: Paolo Abeni <[email protected]>
  26. ---
  27. drivers/net/dsa/mt7530.c | 18 ++++--------------
  28. 1 file changed, 4 insertions(+), 14 deletions(-)
  29. --- a/drivers/net/dsa/mt7530.c
  30. +++ b/drivers/net/dsa/mt7530.c
  31. @@ -2683,17 +2683,6 @@ static bool mt753x_is_mac_port(u32 port)
  32. }
  33. static int
  34. -mt7988_mac_config(struct dsa_switch *ds, int port, unsigned int mode,
  35. - phy_interface_t interface)
  36. -{
  37. - if (dsa_is_cpu_port(ds, port) &&
  38. - interface == PHY_INTERFACE_MODE_INTERNAL)
  39. - return 0;
  40. -
  41. - return -EINVAL;
  42. -}
  43. -
  44. -static int
  45. mt7531_mac_config(struct dsa_switch *ds, int port, unsigned int mode,
  46. phy_interface_t interface)
  47. {
  48. @@ -2733,6 +2722,9 @@ mt753x_mac_config(struct dsa_switch *ds,
  49. {
  50. struct mt7530_priv *priv = ds->priv;
  51. + if (!priv->info->mac_port_config)
  52. + return 0;
  53. +
  54. return priv->info->mac_port_config(ds, port, mode, state->interface);
  55. }
  56. @@ -3193,7 +3185,6 @@ const struct mt753x_info mt753x_table[]
  57. .phy_write = mt7531_ind_phy_write,
  58. .cpu_port_config = mt7988_cpu_port_config,
  59. .mac_port_get_caps = mt7988_mac_port_get_caps,
  60. - .mac_port_config = mt7988_mac_config,
  61. },
  62. };
  63. EXPORT_SYMBOL_GPL(mt753x_table);
  64. @@ -3221,8 +3212,7 @@ mt7530_probe_common(struct mt7530_priv *
  65. * properly.
  66. */
  67. if (!priv->info->sw_setup || !priv->info->phy_read ||
  68. - !priv->info->phy_write || !priv->info->mac_port_get_caps ||
  69. - !priv->info->mac_port_config)
  70. + !priv->info->phy_write || !priv->info->mac_port_get_caps)
  71. return -EINVAL;
  72. priv->id = priv->info->id;