diff options
Diffstat (limited to 'drivers/net/dsa')
| -rw-r--r-- | drivers/net/dsa/ocelot/felix.c | 23 | ||||
| -rw-r--r-- | drivers/net/dsa/ocelot/felix_vsc9959.c | 2 | ||||
| -rw-r--r-- | drivers/net/dsa/realtek/Kconfig | 30 | ||||
| -rw-r--r-- | drivers/net/dsa/realtek/realtek-smi.c | 5 | 
4 files changed, 45 insertions, 15 deletions
diff --git a/drivers/net/dsa/ocelot/felix.c b/drivers/net/dsa/ocelot/felix.c index 413b0006e9a2..9e28219b223d 100644 --- a/drivers/net/dsa/ocelot/felix.c +++ b/drivers/net/dsa/ocelot/felix.c @@ -670,6 +670,8 @@ static int felix_change_tag_protocol(struct dsa_switch *ds, int cpu,  	struct ocelot *ocelot = ds->priv;  	struct felix *felix = ocelot_to_felix(ocelot);  	enum dsa_tag_protocol old_proto = felix->tag_proto; +	bool cpu_port_active = false; +	struct dsa_port *dp;  	int err;  	if (proto != DSA_TAG_PROTO_SEVILLE && @@ -677,6 +679,27 @@ static int felix_change_tag_protocol(struct dsa_switch *ds, int cpu,  	    proto != DSA_TAG_PROTO_OCELOT_8021Q)  		return -EPROTONOSUPPORT; +	/* We don't support multiple CPU ports, yet the DT blob may have +	 * multiple CPU ports defined. The first CPU port is the active one, +	 * the others are inactive. In this case, DSA will call +	 * ->change_tag_protocol() multiple times, once per CPU port. +	 * Since we implement the tagging protocol change towards "ocelot" or +	 * "seville" as effectively initializing the NPI port, what we are +	 * doing is effectively changing who the NPI port is to the last @cpu +	 * argument passed, which is an unused DSA CPU port and not the one +	 * that should actively pass traffic. +	 * Suppress DSA's calls on CPU ports that are inactive. +	 */ +	dsa_switch_for_each_user_port(dp, ds) { +		if (dp->cpu_dp->index == cpu) { +			cpu_port_active = true; +			break; +		} +	} + +	if (!cpu_port_active) +		return 0; +  	felix_del_tag_protocol(ds, cpu, old_proto);  	err = felix_set_tag_protocol(ds, cpu, proto); diff --git a/drivers/net/dsa/ocelot/felix_vsc9959.c b/drivers/net/dsa/ocelot/felix_vsc9959.c index 8d382b27e625..52a8566071ed 100644 --- a/drivers/net/dsa/ocelot/felix_vsc9959.c +++ b/drivers/net/dsa/ocelot/felix_vsc9959.c @@ -2316,7 +2316,7 @@ static int felix_pci_probe(struct pci_dev *pdev,  	err = dsa_register_switch(ds);  	if (err) { -		dev_err(&pdev->dev, "Failed to register DSA switch: %d\n", err); +		dev_err_probe(&pdev->dev, err, "Failed to register DSA switch\n");  		goto err_register_ds;  	} diff --git a/drivers/net/dsa/realtek/Kconfig b/drivers/net/dsa/realtek/Kconfig index 1aa79735355f..060165a85fb7 100644 --- a/drivers/net/dsa/realtek/Kconfig +++ b/drivers/net/dsa/realtek/Kconfig @@ -9,34 +9,46 @@ menuconfig NET_DSA_REALTEK  	help  	  Select to enable support for Realtek Ethernet switch chips. +	  Note that at least one interface driver must be enabled for the +	  subdrivers to be loaded. Moreover, an interface driver cannot achieve +	  anything without at least one subdriver enabled. + +if NET_DSA_REALTEK +  config NET_DSA_REALTEK_MDIO -	tristate "Realtek MDIO connected switch driver" -	depends on NET_DSA_REALTEK +	tristate "Realtek MDIO interface driver"  	depends on OF +	depends on NET_DSA_REALTEK_RTL8365MB || NET_DSA_REALTEK_RTL8366RB +	depends on NET_DSA_REALTEK_RTL8365MB || !NET_DSA_REALTEK_RTL8365MB +	depends on NET_DSA_REALTEK_RTL8366RB || !NET_DSA_REALTEK_RTL8366RB  	help  	  Select to enable support for registering switches configured  	  through MDIO.  config NET_DSA_REALTEK_SMI -	tristate "Realtek SMI connected switch driver" -	depends on NET_DSA_REALTEK +	tristate "Realtek SMI interface driver"  	depends on OF +	depends on NET_DSA_REALTEK_RTL8365MB || NET_DSA_REALTEK_RTL8366RB +	depends on NET_DSA_REALTEK_RTL8365MB || !NET_DSA_REALTEK_RTL8365MB +	depends on NET_DSA_REALTEK_RTL8366RB || !NET_DSA_REALTEK_RTL8366RB  	help  	  Select to enable support for registering switches connected  	  through SMI.  config NET_DSA_REALTEK_RTL8365MB  	tristate "Realtek RTL8365MB switch subdriver" -	depends on NET_DSA_REALTEK -	depends on NET_DSA_REALTEK_SMI || NET_DSA_REALTEK_MDIO +	imply NET_DSA_REALTEK_SMI +	imply NET_DSA_REALTEK_MDIO  	select NET_DSA_TAG_RTL8_4  	help  	  Select to enable support for Realtek RTL8365MB-VC and RTL8367S.  config NET_DSA_REALTEK_RTL8366RB  	tristate "Realtek RTL8366RB switch subdriver" -	depends on NET_DSA_REALTEK -	depends on NET_DSA_REALTEK_SMI || NET_DSA_REALTEK_MDIO +	imply NET_DSA_REALTEK_SMI +	imply NET_DSA_REALTEK_MDIO  	select NET_DSA_TAG_RTL4_A  	help -	  Select to enable support for Realtek RTL8366RB +	  Select to enable support for Realtek RTL8366RB. + +endif diff --git a/drivers/net/dsa/realtek/realtek-smi.c b/drivers/net/dsa/realtek/realtek-smi.c index 2243d3da55b2..6cec559c90ce 100644 --- a/drivers/net/dsa/realtek/realtek-smi.c +++ b/drivers/net/dsa/realtek/realtek-smi.c @@ -546,11 +546,6 @@ static const struct of_device_id realtek_smi_of_match[] = {  		.data = &rtl8366rb_variant,  	},  #endif -	{ -		/* FIXME: add support for RTL8366S and more */ -		.compatible = "realtek,rtl8366s", -		.data = NULL, -	},  #if IS_ENABLED(CONFIG_NET_DSA_REALTEK_RTL8365MB)  	{  		.compatible = "realtek,rtl8365mb",  | 
