diff options
author | Marek BehĂșn <kabel@kernel.org> | 2020-10-20 19:09:11 +0200 |
---|---|---|
committer | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2021-06-07 11:26:45 +0100 |
commit | 7aaeb289a0dc5138ecfa86982db03263f0fdb012 (patch) | |
tree | f2ba9c75323761e1326a203171d1077f0a0a7dc1 | |
parent | 5841242c08016430214846ab47162c9b2a415040 (diff) |
net: dsa: fill phylink's config supported_interfaces member
Add a new DSA switch operation, phylink_get_interfaces, which should
fill in which PHY_INTERFACE_MODE_* are supported by given port.
Use this before phylink_create to fill phylink's config
supported_interfaces member.
This allows for phylink to determine which PHY_INTERFACE_MODE to use
with SFP modules.
Signed-off-by: Marek BehĂșn <kabel@kernel.org>
Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
-rw-r--r-- | include/net/dsa.h | 2 | ||||
-rw-r--r-- | net/dsa/slave.c | 4 |
2 files changed, 6 insertions, 0 deletions
diff --git a/include/net/dsa.h b/include/net/dsa.h index 83a933e563fe..35a9e072fb87 100644 --- a/include/net/dsa.h +++ b/include/net/dsa.h @@ -529,6 +529,8 @@ struct dsa_switch_ops { /* * PHYLINK integration */ + void (*phylink_get_interfaces)(struct dsa_switch *ds, int port, + unsigned long *supported_interfaces); void (*phylink_validate)(struct dsa_switch *ds, int port, unsigned long *supported, struct phylink_link_state *state); diff --git a/net/dsa/slave.c b/net/dsa/slave.c index 992fcab4b552..d2377be80591 100644 --- a/net/dsa/slave.c +++ b/net/dsa/slave.c @@ -1746,6 +1746,10 @@ static int dsa_slave_phy_setup(struct net_device *slave_dev) dp->pl_config.poll_fixed_state = true; } + if (ds->ops->phylink_get_interfaces) + ds->ops->phylink_get_interfaces(ds, dp->index, + dp->pl_config.supported_interfaces); + dp->pl = phylink_create(&dp->pl_config, of_fwnode_handle(port_dn), mode, &dsa_port_phylink_mac_ops); if (IS_ERR(dp->pl)) { |