diff mbox series

[net-next,v2,4/6] net: phylink: unset ovr_an_inband if fixed-link is selected

Message ID 20220610032941.113690-5-boon.leong.ong@intel.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series pcs-xpcs, stmmac: add 1000BASE-X AN for network switch | expand

Commit Message

Ong Boon Leong June 10, 2022, 3:29 a.m. UTC
If "fixed-link" DT or ACPI _DSD subnode is selected, it should take
precedence over the value of ovr_an_inband passed by MAC driver.

Fixes: ab39385021d1 ("net: phylink: make phylink_parse_mode() support non-DT platform")
Tested-by: Emilio Riva <emilio.riva@ericsson.com>
Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com>
---
 drivers/net/phy/phylink.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Russell King (Oracle) June 10, 2022, 7:31 a.m. UTC | #1
On Fri, Jun 10, 2022 at 11:29:39AM +0800, Ong Boon Leong wrote:
> If "fixed-link" DT or ACPI _DSD subnode is selected, it should take
> precedence over the value of ovr_an_inband passed by MAC driver.
> 
> Fixes: ab39385021d1 ("net: phylink: make phylink_parse_mode() support non-DT platform")
> Tested-by: Emilio Riva <emilio.riva@ericsson.com>
> Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com>
> ---
>  drivers/net/phy/phylink.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
> index 066684b8091..566852815e0 100644
> --- a/drivers/net/phy/phylink.c
> +++ b/drivers/net/phy/phylink.c
> @@ -609,8 +609,10 @@ static int phylink_parse_mode(struct phylink *pl, struct fwnode_handle *fwnode)
>  	const char *managed;
>  
>  	dn = fwnode_get_named_child_node(fwnode, "fixed-link");
> -	if (dn || fwnode_property_present(fwnode, "fixed-link"))
> +	if (dn || fwnode_property_present(fwnode, "fixed-link")) {
>  		pl->cfg_link_an_mode = MLO_AN_FIXED;
> +		pl->config->ovr_an_inband = false;
> +	}

ovr_an_inband was added to support "non-DT" platforms, and the only
place it's set is stmmac. I don't see why you'd want a driver to always
set this member, and then have phylink clear it - the driver should be
setting it correctly itself, otherwise it becomes a "maybe override AN
inband if certain conditions are met" flag inside phylink.
Ong Boon Leong June 14, 2022, 1:54 a.m. UTC | #2
>On Fri, Jun 10, 2022 at 11:29:39AM +0800, Ong Boon Leong wrote:
>> If "fixed-link" DT or ACPI _DSD subnode is selected, it should take
>> precedence over the value of ovr_an_inband passed by MAC driver.
>>
>> Fixes: ab39385021d1 ("net: phylink: make phylink_parse_mode() support
>non-DT platform")
>> Tested-by: Emilio Riva <emilio.riva@ericsson.com>
>> Signed-off-by: Ong Boon Leong <boon.leong.ong@intel.com>
>> ---
>>  drivers/net/phy/phylink.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
>> index 066684b8091..566852815e0 100644
>> --- a/drivers/net/phy/phylink.c
>> +++ b/drivers/net/phy/phylink.c
>> @@ -609,8 +609,10 @@ static int phylink_parse_mode(struct phylink *pl,
>struct fwnode_handle *fwnode)
>>  	const char *managed;
>>
>>  	dn = fwnode_get_named_child_node(fwnode, "fixed-link");
>> -	if (dn || fwnode_property_present(fwnode, "fixed-link"))
>> +	if (dn || fwnode_property_present(fwnode, "fixed-link")) {
>>  		pl->cfg_link_an_mode = MLO_AN_FIXED;
>> +		pl->config->ovr_an_inband = false;
>> +	}
>
>ovr_an_inband was added to support "non-DT" platforms, and the only
>place it's set is stmmac. I don't see why you'd want a driver to always
>set this member, and then have phylink clear it - the driver should be
>setting it correctly itself, otherwise it becomes a "maybe override AN
>inband if certain conditions are met" flag inside phylink.
Good point. Will make the "ovr_an_inband" not set inside the dwmac-intel
if fixed-link is used.
diff mbox series

Patch

diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index 066684b8091..566852815e0 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -609,8 +609,10 @@  static int phylink_parse_mode(struct phylink *pl, struct fwnode_handle *fwnode)
 	const char *managed;
 
 	dn = fwnode_get_named_child_node(fwnode, "fixed-link");
-	if (dn || fwnode_property_present(fwnode, "fixed-link"))
+	if (dn || fwnode_property_present(fwnode, "fixed-link")) {
 		pl->cfg_link_an_mode = MLO_AN_FIXED;
+		pl->config->ovr_an_inband = false;
+	}
 	fwnode_handle_put(dn);
 
 	if ((fwnode_property_read_string(fwnode, "managed", &managed) == 0 &&