[PATCH net-next 2/6] net: dsa: lantiq_gswip: support model-specific mac_select_pcs()

Daniel Golle posted 6 patches 1 month, 1 week ago
There is a newer version of this series
[PATCH net-next 2/6] net: dsa: lantiq_gswip: support model-specific mac_select_pcs()
Posted by Daniel Golle 1 month, 1 week ago
Call mac_select_pcs() function if provided in struct gswip_hwinfo.
The MaxLinear GSW1xx series got one port wired to a SerDes PCS and
PHY which can do 1000Base-X, 2500Base-X and SGMII. Support for the
SerDes port will be provided using phylink_pcs, so provide a
convenient way for mac_select_pcs() to differ based on the hardware
model.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
 drivers/net/dsa/lantiq_gswip.c | 21 +++++++++++++++++----
 drivers/net/dsa/lantiq_gswip.h |  3 +++
 2 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/drivers/net/dsa/lantiq_gswip.c b/drivers/net/dsa/lantiq_gswip.c
index 67919c3935e4..4822812bba27 100644
--- a/drivers/net/dsa/lantiq_gswip.c
+++ b/drivers/net/dsa/lantiq_gswip.c
@@ -1592,10 +1592,23 @@ static int gswip_get_sset_count(struct dsa_switch *ds, int port, int sset)
 	return ARRAY_SIZE(gswip_rmon_cnt);
 }
 
-static const struct phylink_mac_ops gswip_phylink_mac_ops = {
-	.mac_config	= gswip_phylink_mac_config,
-	.mac_link_down	= gswip_phylink_mac_link_down,
-	.mac_link_up	= gswip_phylink_mac_link_up,
+static struct phylink_pcs *gswip_phylink_mac_select_pcs(struct phylink_config *config,
+							phy_interface_t interface)
+{
+	struct dsa_port *dp = dsa_phylink_to_port(config);
+	struct gswip_priv *priv = dp->ds->priv;
+
+	if (priv->hw_info->mac_select_pcs)
+		return priv->hw_info->mac_select_pcs(config, interface);
+
+	return NULL;
+}
+
+const struct phylink_mac_ops gswip_phylink_mac_ops = {
+	.mac_config		= gswip_phylink_mac_config,
+	.mac_link_down		= gswip_phylink_mac_link_down,
+	.mac_link_up		= gswip_phylink_mac_link_up,
+	.mac_select_pcs		= gswip_phylink_mac_select_pcs,
 };
 
 static const struct dsa_switch_ops gswip_switch_ops = {
diff --git a/drivers/net/dsa/lantiq_gswip.h b/drivers/net/dsa/lantiq_gswip.h
index 620c2d560cbe..19bbe6fddf04 100644
--- a/drivers/net/dsa/lantiq_gswip.h
+++ b/drivers/net/dsa/lantiq_gswip.h
@@ -4,6 +4,7 @@
 
 #include <linux/clk.h>
 #include <linux/mutex.h>
+#include <linux/phylink.h>
 #include <linux/platform_device.h>
 #include <linux/regmap.h>
 #include <linux/reset.h>
@@ -237,6 +238,8 @@ struct gswip_hw_info {
 	enum dsa_tag_protocol tag_protocol;
 	void (*phylink_get_caps)(struct dsa_switch *ds, int port,
 				 struct phylink_config *config);
+	struct phylink_pcs *(*mac_select_pcs)(struct phylink_config *config,
+					      phy_interface_t interface);
 };
 
 struct gswip_gphy_fw {
-- 
2.50.1
Re: [PATCH net-next 2/6] net: dsa: lantiq_gswip: support model-specific mac_select_pcs()
Posted by kernel test robot 1 month, 1 week ago
Hi Daniel,

kernel test robot noticed the following build warnings:

[auto build test WARNING on net-next/main]

url:    https://github.com/intel-lab-lkp/linux/commits/Daniel-Golle/MAINTAINERS-lantiq_gswip-broaden-file-pattern/20250826-081728
base:   net-next/main
patch link:    https://lore.kernel.org/r/7576c237814016ee5e18572b2788f955071a922c.1756163848.git.daniel%40makrotopia.org
patch subject: [PATCH net-next 2/6] net: dsa: lantiq_gswip: support model-specific mac_select_pcs()
config: alpha-randconfig-r133-20250826 (https://download.01.org/0day-ci/archive/20250827/202508270335.PG3eJBYD-lkp@intel.com/config)
compiler: alpha-linux-gcc (GCC) 8.5.0
reproduce: (https://download.01.org/0day-ci/archive/20250827/202508270335.PG3eJBYD-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202508270335.PG3eJBYD-lkp@intel.com/

sparse warnings: (new ones prefixed by >>)
>> drivers/net/dsa/lantiq_gswip.c:1607:30: sparse: sparse: symbol 'gswip_phylink_mac_ops' was not declared. Should it be static?

vim +/gswip_phylink_mac_ops +1607 drivers/net/dsa/lantiq_gswip.c

  1606	
> 1607	const struct phylink_mac_ops gswip_phylink_mac_ops = {
  1608		.mac_config		= gswip_phylink_mac_config,
  1609		.mac_link_down		= gswip_phylink_mac_link_down,
  1610		.mac_link_up		= gswip_phylink_mac_link_up,
  1611		.mac_select_pcs		= gswip_phylink_mac_select_pcs,
  1612	};
  1613	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki