790-33-v6.9-net-dsa-mt7530-call-port-6-setup-from-mt7530_mac_con.patch 3.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. From 921a7deee767aa157b5372863a4c1cac53e5c53a Mon Sep 17 00:00:00 2001
  2. From: =?UTF-8?q?Ar=C4=B1n=C3=A7=20=C3=9CNAL?= <[email protected]>
  3. Date: Tue, 6 Feb 2024 01:08:05 +0300
  4. Subject: [PATCH 33/48] net: dsa: mt7530: call port 6 setup from
  5. mt7530_mac_config()
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. mt7530_pad_clk_setup() is called if port 6 is enabled. It used to do more
  10. things than setting up port 6. That part was moved to more appropriate
  11. locations, mt7530_setup() and mt7530_pll_setup().
  12. Now that all it does is set up port 6, rename it to mt7530_setup_port6(),
  13. and move it to a more appropriate location, under mt7530_mac_config().
  14. Change mt7530_setup_port6() to void as there're no error cases.
  15. Leave an empty mt7530_pad_clk_setup() to satisfy the pad_setup function
  16. pointer.
  17. This is the code path for setting up the ports before:
  18. dsa_switch_ops :: phylink_mac_config() -> mt753x_phylink_mac_config()
  19. -> mt753x_mac_config()
  20. -> mt753x_info :: mac_port_config() -> mt7530_mac_config()
  21. -> mt7530_setup_port5()
  22. -> mt753x_pad_setup()
  23. -> mt753x_info :: pad_setup() -> mt7530_pad_clk_setup()
  24. This is after:
  25. dsa_switch_ops :: phylink_mac_config() -> mt753x_phylink_mac_config()
  26. -> mt753x_mac_config()
  27. -> mt753x_info :: mac_port_config() -> mt7530_mac_config()
  28. -> mt7530_setup_port5()
  29. -> mt7530_setup_port6()
  30. Reviewed-by: Vladimir Oltean <[email protected]>
  31. Reviewed-by: Russell King (Oracle) <[email protected]>
  32. Signed-off-by: Arınç ÜNAL <[email protected]>
  33. Link: https://lore.kernel.org/r/20240206-for-netnext-mt7530-improvements-2-v5-4-d7d92a185cb1@arinc9.com
  34. Signed-off-by: Jakub Kicinski <[email protected]>
  35. ---
  36. drivers/net/dsa/mt7530.c | 19 +++++++++++--------
  37. 1 file changed, 11 insertions(+), 8 deletions(-)
  38. --- a/drivers/net/dsa/mt7530.c
  39. +++ b/drivers/net/dsa/mt7530.c
  40. @@ -400,8 +400,8 @@ static void mt7530_pll_setup(struct mt75
  41. }
  42. /* Setup port 6 interface mode and TRGMII TX circuit */
  43. -static int
  44. -mt7530_pad_clk_setup(struct dsa_switch *ds, phy_interface_t interface)
  45. +static void
  46. +mt7530_setup_port6(struct dsa_switch *ds, phy_interface_t interface)
  47. {
  48. struct mt7530_priv *priv = ds->priv;
  49. u32 ncpo1, ssc_delta, xtal;
  50. @@ -412,7 +412,7 @@ mt7530_pad_clk_setup(struct dsa_switch *
  51. if (interface == PHY_INTERFACE_MODE_RGMII) {
  52. mt7530_rmw(priv, MT7530_P6ECR, P6_INTF_MODE_MASK,
  53. P6_INTF_MODE(0));
  54. - return 0;
  55. + return;
  56. }
  57. mt7530_rmw(priv, MT7530_P6ECR, P6_INTF_MODE_MASK, P6_INTF_MODE(1));
  58. @@ -451,7 +451,11 @@ mt7530_pad_clk_setup(struct dsa_switch *
  59. /* Enable the MT7530 TRGMII clocks */
  60. core_set(priv, CORE_TRGMII_GSW_CLK_CG, REG_TRGMIICK_EN);
  61. +}
  62. +static int
  63. +mt7530_pad_clk_setup(struct dsa_switch *ds, phy_interface_t interface)
  64. +{
  65. return 0;
  66. }
  67. @@ -2640,11 +2644,10 @@ mt7530_mac_config(struct dsa_switch *ds,
  68. {
  69. struct mt7530_priv *priv = ds->priv;
  70. - /* Only need to setup port5. */
  71. - if (port != 5)
  72. - return 0;
  73. -
  74. - mt7530_setup_port5(priv->ds, interface);
  75. + if (port == 5)
  76. + mt7530_setup_port5(priv->ds, interface);
  77. + else if (port == 6)
  78. + mt7530_setup_port6(priv->ds, interface);
  79. return 0;
  80. }