diff mbox series

[net-next] net: dsa: mt7530: do not set MT7530_P5_DIS when PHY muxing is being used

Message ID 20240427-for-netnext-mt7530-do-not-disable-port5-when-phy-muxing-v1-1-793cdf9d7707@arinc9.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series [net-next] net: dsa: mt7530: do not set MT7530_P5_DIS when PHY muxing is being used | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 926 this patch: 926
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 15 of 15 maintainers
netdev/build_clang success Errors and warnings before: 937 this patch: 937
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 937 this patch: 937
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest fail net-next-2024-04-27--15-00 (tests: 995)

Commit Message

Arınç ÜNAL via B4 Relay April 27, 2024, 11:24 a.m. UTC
From: Arınç ÜNAL <arinc.unal@arinc9.com>

When the PHY muxing feature is in use, port 5 won't be defined in the
device tree. Because of this, the type member of the dsa_port structure for
this port will be assigned DSA_PORT_TYPE_UNUSED. The dsa_port_setup()
function calls ds->ops->port_disable() when the port type is
DSA_PORT_TYPE_UNUSED.

The MT7530_P5_DIS bit is unset when PHY muxing is being used.
mt7530_port_disable() which is assigned to ds->ops->port_disable() is
called afterwards. Currently, mt7530_port_disable() sets MT7530_P5_DIS
which breaks network connectivity when PHY muxing is being used.

Therefore, do not set MT7530_P5_DIS when PHY muxing is being used.

Fixes: 377174c5760c ("net: dsa: mt7530: move MT753X_MTRAP operations for MT7530")
Reported-by: Daniel Golle <daniel@makrotopia.org>
Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
---
Hello.

I've sent this to net-next as the patch it fixes is on the current
development cycle.
---
 drivers/net/dsa/mt7530.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


---
base-commit: 5c4c0edca68a5841a8d53ccd49596fe199c8334c
change-id: 20240427-for-netnext-mt7530-do-not-disable-port5-when-phy-muxing-7ff5fd0995d7

Best regards,

Comments

Andrew Lunn April 27, 2024, 1:31 p.m. UTC | #1
On Sat, Apr 27, 2024 at 02:24:42PM +0300, Arınç ÜNAL via B4 Relay wrote:
> From: Arınç ÜNAL <arinc.unal@arinc9.com>
> 
> When the PHY muxing feature is in use, port 5 won't be defined in the
> device tree. Because of this, the type member of the dsa_port structure for
> this port will be assigned DSA_PORT_TYPE_UNUSED. The dsa_port_setup()
> function calls ds->ops->port_disable() when the port type is
> DSA_PORT_TYPE_UNUSED.
> 
> The MT7530_P5_DIS bit is unset when PHY muxing is being used.
> mt7530_port_disable() which is assigned to ds->ops->port_disable() is
> called afterwards. Currently, mt7530_port_disable() sets MT7530_P5_DIS
> which breaks network connectivity when PHY muxing is being used.
> 
> Therefore, do not set MT7530_P5_DIS when PHY muxing is being used.
> 
> Fixes: 377174c5760c ("net: dsa: mt7530: move MT753X_MTRAP operations for MT7530")
> Reported-by: Daniel Golle <daniel@makrotopia.org>
> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
> ---
> Hello.
> 
> I've sent this to net-next as the patch it fixes is on the current
> development cycle.
> ---
>  drivers/net/dsa/mt7530.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
> index 2b9f904a98f0..07b6da3ae97c 100644
> --- a/drivers/net/dsa/mt7530.c
> +++ b/drivers/net/dsa/mt7530.c
> @@ -1220,7 +1220,7 @@ mt7530_port_disable(struct dsa_switch *ds, int port)
>  	if (priv->id != ID_MT7530 && priv->id != ID_MT7621)
>  		return;
>  
> -	if (port == 5)
> +	if (port == 5 && priv->p5_mode == GMAC5)
>  		mt7530_set(priv, MT753X_MTRAP, MT7530_P5_DIS);


It might be worth a comment. It is not obvious that
priv->p5_mode == GMAC5 means the PHY MUX is being used.
mt7530_setup_port5() thinks it is sufficiently obscure that
it comments each case.

	Andrew
Arınç ÜNAL April 27, 2024, 3:43 p.m. UTC | #2
On 27.04.2024 16:31, Andrew Lunn wrote:
> On Sat, Apr 27, 2024 at 02:24:42PM +0300, Arınç ÜNAL via B4 Relay wrote:
>> From: Arınç ÜNAL <arinc.unal@arinc9.com>
>>
>> When the PHY muxing feature is in use, port 5 won't be defined in the
>> device tree. Because of this, the type member of the dsa_port structure for
>> this port will be assigned DSA_PORT_TYPE_UNUSED. The dsa_port_setup()
>> function calls ds->ops->port_disable() when the port type is
>> DSA_PORT_TYPE_UNUSED.
>>
>> The MT7530_P5_DIS bit is unset when PHY muxing is being used.
>> mt7530_port_disable() which is assigned to ds->ops->port_disable() is
>> called afterwards. Currently, mt7530_port_disable() sets MT7530_P5_DIS
>> which breaks network connectivity when PHY muxing is being used.
>>
>> Therefore, do not set MT7530_P5_DIS when PHY muxing is being used.
>>
>> Fixes: 377174c5760c ("net: dsa: mt7530: move MT753X_MTRAP operations for MT7530")
>> Reported-by: Daniel Golle <daniel@makrotopia.org>
>> Signed-off-by: Arınç ÜNAL <arinc.unal@arinc9.com>
>> ---
>> Hello.
>>
>> I've sent this to net-next as the patch it fixes is on the current
>> development cycle.
>> ---
>>   drivers/net/dsa/mt7530.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
>> index 2b9f904a98f0..07b6da3ae97c 100644
>> --- a/drivers/net/dsa/mt7530.c
>> +++ b/drivers/net/dsa/mt7530.c
>> @@ -1220,7 +1220,7 @@ mt7530_port_disable(struct dsa_switch *ds, int port)
>>   	if (priv->id != ID_MT7530 && priv->id != ID_MT7621)
>>   		return;
>>   
>> -	if (port == 5)
>> +	if (port == 5 && priv->p5_mode == GMAC5)
>>   		mt7530_set(priv, MT753X_MTRAP, MT7530_P5_DIS);
> 
> 
> It might be worth a comment. It is not obvious that
> priv->p5_mode == GMAC5 means the PHY MUX is being used.
> mt7530_setup_port5() thinks it is sufficiently obscure that
> it comments each case.

priv->p5_mode == GMAC5 means PHY muxing is not being used. That is why
MT7530_P5_DIS is set when priv->p5_mode is GMAC5. Anyway, I believe this
proves your point.

Arınç
diff mbox series

Patch

diff --git a/drivers/net/dsa/mt7530.c b/drivers/net/dsa/mt7530.c
index 2b9f904a98f0..07b6da3ae97c 100644
--- a/drivers/net/dsa/mt7530.c
+++ b/drivers/net/dsa/mt7530.c
@@ -1220,7 +1220,7 @@  mt7530_port_disable(struct dsa_switch *ds, int port)
 	if (priv->id != ID_MT7530 && priv->id != ID_MT7621)
 		return;
 
-	if (port == 5)
+	if (port == 5 && priv->p5_mode == GMAC5)
 		mt7530_set(priv, MT753X_MTRAP, MT7530_P5_DIS);
 	else if (port == 6)
 		mt7530_set(priv, MT753X_MTRAP, MT7530_P6_DIS);