|
|
@@ -2275,6 +2275,45 @@ static int cpsw_switch_config_ioctl(struct net_device *ndev,
|
|
|
case CONFIG_SWITCH_DEL_VLAN:
|
|
|
ret = cpsw_ale_del_vlan(cpsw->ale, config.vid, 0);
|
|
|
break;
|
|
|
+ case CONFIG_SWITCH_SET_PORT_CONFIG:
|
|
|
+ {
|
|
|
+ struct phy_device *phy = NULL;
|
|
|
+ struct ethtool_link_ksettings cmd;
|
|
|
+
|
|
|
+ if ((config.port == 1) || (config.port == 2))
|
|
|
+ phy = cpsw->slaves[config.port - 1].phy;
|
|
|
+
|
|
|
+ if (!phy) {
|
|
|
+ dev_err(priv->dev, "Phy not Found\n");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ convert_legacy_settings_to_link_ksettings(&cmd, &config.ecmd);
|
|
|
+ cmd.base.phy_address = phy->mdio.addr;
|
|
|
+ ret = phy_ethtool_ksettings_set(phy, &cmd);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ case CONFIG_SWITCH_GET_PORT_CONFIG:
|
|
|
+ {
|
|
|
+ struct phy_device *phy = NULL;
|
|
|
+ struct ethtool_link_ksettings cmd;
|
|
|
+
|
|
|
+ if ((config.port == 1) || (config.port == 2))
|
|
|
+ phy = cpsw->slaves[config.port - 1].phy;
|
|
|
+
|
|
|
+ if (!phy) {
|
|
|
+ dev_err(priv->dev, "Phy not Found\n");
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
+ cmd.base.phy_address = phy->mdio.addr;
|
|
|
+ phy_ethtool_ksettings_get(phy, &cmd);
|
|
|
+ convert_link_ksettings_to_legacy_settings(&config.ecmd, &cmd);
|
|
|
+
|
|
|
+ ret = copy_to_user(ifrq->ifr_data, &config, sizeof(config));
|
|
|
+ break;
|
|
|
+ }
|
|
|
+
|
|
|
default:
|
|
|
ret = -EOPNOTSUPP;
|
|
|
}
|