[PATCH net-next v3 04/12] net: dsa: lantiq_gswip: set link parameters also for CPU port

Daniel Golle posted 12 patches 3 months, 1 week ago
There is a newer version of this series
[PATCH net-next v3 04/12] net: dsa: lantiq_gswip: set link parameters also for CPU port
Posted by Daniel Golle 3 months, 1 week ago
On standalone switch ICs the link parameters of the CPU port need to
be setup just like user ports. The destinction in the driver to not
carry out link parameter setup for the CPU port does make sense for
in-SoC switches on which the CPU port is internally connected to the
SoC's Ethernet MAC.
Set link parameters also for the CPU port unless it is an internal
interface.

Signed-off-by: Daniel Golle <daniel@makrotopia.org>
---
 drivers/net/dsa/lantiq/lantiq_gswip_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/dsa/lantiq/lantiq_gswip_common.c b/drivers/net/dsa/lantiq/lantiq_gswip_common.c
index 092187603dea..0ac87eb23bb5 100644
--- a/drivers/net/dsa/lantiq/lantiq_gswip_common.c
+++ b/drivers/net/dsa/lantiq/lantiq_gswip_common.c
@@ -1459,7 +1459,7 @@ static void gswip_phylink_mac_link_up(struct phylink_config *config,
 	struct gswip_priv *priv = dp->ds->priv;
 	int port = dp->index;
 
-	if (!dsa_port_is_cpu(dp)) {
+	if (!dsa_port_is_cpu(dp) || interface != PHY_INTERFACE_MODE_INTERNAL) {
 		gswip_port_set_link(priv, port, true);
 		gswip_port_set_speed(priv, port, speed, interface);
 		gswip_port_set_duplex(priv, port, duplex);
-- 
2.51.1
Re: [PATCH net-next v3 04/12] net: dsa: lantiq_gswip: set link parameters also for CPU port
Posted by Vladimir Oltean 3 months, 1 week ago
On Sun, Oct 26, 2025 at 11:44:24PM +0000, Daniel Golle wrote:
> On standalone switch ICs the link parameters of the CPU port need to
> be setup just like user ports. The destinction in the driver to not
> carry out link parameter setup for the CPU port does make sense for
> in-SoC switches on which the CPU port is internally connected to the
> SoC's Ethernet MAC.
> Set link parameters also for the CPU port unless it is an internal
> interface.
> 
> Signed-off-by: Daniel Golle <daniel@makrotopia.org>
> ---
>  drivers/net/dsa/lantiq/lantiq_gswip_common.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/dsa/lantiq/lantiq_gswip_common.c b/drivers/net/dsa/lantiq/lantiq_gswip_common.c
> index 092187603dea..0ac87eb23bb5 100644
> --- a/drivers/net/dsa/lantiq/lantiq_gswip_common.c
> +++ b/drivers/net/dsa/lantiq/lantiq_gswip_common.c
> @@ -1459,7 +1459,7 @@ static void gswip_phylink_mac_link_up(struct phylink_config *config,
>  	struct gswip_priv *priv = dp->ds->priv;
>  	int port = dp->index;
>  
> -	if (!dsa_port_is_cpu(dp)) {
> +	if (!dsa_port_is_cpu(dp) || interface != PHY_INTERFACE_MODE_INTERNAL) {
>  		gswip_port_set_link(priv, port, true);
>  		gswip_port_set_speed(priv, port, speed, interface);
>  		gswip_port_set_duplex(priv, port, duplex);
> -- 
> 2.51.1

PHY_INTERFACE_MODE_INTERNAL has two meanings: an internal MAC-to-MAC
connection or an internal PHY. In principle, your check excludes the
link parameter setup for CPU ports with internal PHYs. I had to check
that these don't exist, by looking at allowed_cpu_ports and seeing that
only the MII ports can be CPU ports. So this is OK, although being a bit
more explicit in the commit message would help, if you need to resend.

Reviewed-by: Vladimir Oltean <olteanv@gmail.com>