Commit 0394a63a authored by Vivien Didelot's avatar Vivien Didelot Committed by David S. Miller

net: dsa: enable and disable all ports

Call the .port_enable and .port_disable functions for all ports,
not only the user ports, so that drivers may optimize the power
consumption of all ports after a successful setup.

Unused ports are now disabled on setup. CPU and DSA ports are now
enabled on setup and disabled on teardown. User ports were already
enabled at slave creation and disabled at slave destruction.
Signed-off-by: default avatarVivien Didelot <vivien.didelot@gmail.com>
Reviewed-by: default avatarFlorian Fainelli <f.fainelli@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 74be4bab
...@@ -264,6 +264,7 @@ static int dsa_port_setup(struct dsa_port *dp) ...@@ -264,6 +264,7 @@ static int dsa_port_setup(struct dsa_port *dp)
switch (dp->type) { switch (dp->type) {
case DSA_PORT_TYPE_UNUSED: case DSA_PORT_TYPE_UNUSED:
dsa_port_disable(dp);
break; break;
case DSA_PORT_TYPE_CPU: case DSA_PORT_TYPE_CPU:
memset(dlp, 0, sizeof(*dlp)); memset(dlp, 0, sizeof(*dlp));
...@@ -274,6 +275,10 @@ static int dsa_port_setup(struct dsa_port *dp) ...@@ -274,6 +275,10 @@ static int dsa_port_setup(struct dsa_port *dp)
return err; return err;
err = dsa_port_link_register_of(dp); err = dsa_port_link_register_of(dp);
if (err)
return err;
err = dsa_port_enable(dp, NULL);
if (err) if (err)
return err; return err;
break; break;
...@@ -286,6 +291,10 @@ static int dsa_port_setup(struct dsa_port *dp) ...@@ -286,6 +291,10 @@ static int dsa_port_setup(struct dsa_port *dp)
return err; return err;
err = dsa_port_link_register_of(dp); err = dsa_port_link_register_of(dp);
if (err)
return err;
err = dsa_port_enable(dp, NULL);
if (err) if (err)
return err; return err;
break; break;
...@@ -317,11 +326,13 @@ static void dsa_port_teardown(struct dsa_port *dp) ...@@ -317,11 +326,13 @@ static void dsa_port_teardown(struct dsa_port *dp)
case DSA_PORT_TYPE_UNUSED: case DSA_PORT_TYPE_UNUSED:
break; break;
case DSA_PORT_TYPE_CPU: case DSA_PORT_TYPE_CPU:
dsa_port_disable(dp);
dsa_tag_driver_put(dp->tag_ops); dsa_tag_driver_put(dp->tag_ops);
devlink_port_unregister(dlp); devlink_port_unregister(dlp);
dsa_port_link_unregister_of(dp); dsa_port_link_unregister_of(dp);
break; break;
case DSA_PORT_TYPE_DSA: case DSA_PORT_TYPE_DSA:
dsa_port_disable(dp);
devlink_port_unregister(dlp); devlink_port_unregister(dlp);
dsa_port_link_unregister_of(dp); dsa_port_link_unregister_of(dp);
break; break;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment