Skip to content

Commit c07c6e8

Browse files
elkablodavem330
authored andcommitted
net: dsa: populate 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 phylinks supported_interfaces member, allowing phylink to determine which PHY_INTERFACE_MODEs are supported. Signed-off-by: Marek Behún <[email protected]> [tweaked patch and description to add more complete support -- rmk] Signed-off-by: Russell King <[email protected]> Signed-off-by: Russell King (Oracle) <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ebed1cf commit c07c6e8

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

include/net/dsa.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,8 @@ struct dsa_switch_ops {
645645
/*
646646
* PHYLINK integration
647647
*/
648+
void (*phylink_get_interfaces)(struct dsa_switch *ds, int port,
649+
unsigned long *supported_interfaces);
648650
void (*phylink_validate)(struct dsa_switch *ds, int port,
649651
unsigned long *supported,
650652
struct phylink_link_state *state);

net/dsa/port.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,6 +1168,10 @@ static int dsa_port_phylink_register(struct dsa_port *dp)
11681168
dp->pl_config.type = PHYLINK_DEV;
11691169
dp->pl_config.pcs_poll = ds->pcs_poll;
11701170

1171+
if (ds->ops->phylink_get_interfaces)
1172+
ds->ops->phylink_get_interfaces(ds, dp->index,
1173+
dp->pl_config.supported_interfaces);
1174+
11711175
dp->pl = phylink_create(&dp->pl_config, of_fwnode_handle(port_dn),
11721176
mode, &dsa_port_phylink_mac_ops);
11731177
if (IS_ERR(dp->pl)) {

net/dsa/slave.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1871,6 +1871,10 @@ static int dsa_slave_phy_setup(struct net_device *slave_dev)
18711871
dp->pl_config.poll_fixed_state = true;
18721872
}
18731873

1874+
if (ds->ops->phylink_get_interfaces)
1875+
ds->ops->phylink_get_interfaces(ds, dp->index,
1876+
dp->pl_config.supported_interfaces);
1877+
18741878
dp->pl = phylink_create(&dp->pl_config, of_fwnode_handle(port_dn), mode,
18751879
&dsa_port_phylink_mac_ops);
18761880
if (IS_ERR(dp->pl)) {

0 commit comments

Comments
 (0)