diff mbox series

[RFC,net-next] net: lan966x: make PHY reset support optional

Message ID 20220330110210.3374165-1-michael@walle.cc (mailing list archive)
State RFC
Delegated to: Netdev Maintainers
Headers show
Series [RFC,net-next] net: lan966x: make PHY reset support optional | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 1 maintainers not CCed: davem@davemloft.net
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Michael Walle March 30, 2022, 11:02 a.m. UTC
The PHY subsystem as well as the MIIM mdio driver (in case of the
integrated PHYs) will already take care of the resets of any external
and internal PHY. There is no need for this reset anymore, so mark it
optionally to be backwards compatible.

Signed-off-by: Michael Walle <michael@walle.cc>
---

Horatiu, what do you think, should it be removed altogether? There is
no user for that in mainline and I don't know about downstream but the
reset driver doesn't really work (as it also resets the GPIO/SGPIO)
and conceptionally the property is on the wrong DT node. All of the
drawbacks should have been addressed by my patches for the miim [1]
and the pinctrl driver [2].

[1] https://lore.kernel.org/netdev/20220318201324.1647416-1-michael@walle.cc/
[2] https://lore.kernel.org/linux-gpio/20220313154640.63813-1-michael@walle.cc/

 drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Horatiu Vultur March 31, 2022, 8:30 a.m. UTC | #1
The 03/30/2022 13:02, Michael Walle wrote:

Hi Michael,

> 
> The PHY subsystem as well as the MIIM mdio driver (in case of the
> integrated PHYs) will already take care of the resets of any external
> and internal PHY. There is no need for this reset anymore, so mark it
> optionally to be backwards compatible.
> 
> Signed-off-by: Michael Walle <michael@walle.cc>
> ---
> 
> Horatiu, what do you think, should it be removed altogether? 

I think it is OK to remove it altogether. If you get both [1] and [2]
in.

> There is
> no user for that in mainline and I don't know about downstream but the
> reset driver doesn't really work (as it also resets the GPIO/SGPIO)

Yes because I didn't manage to send yet those patches. But if your get
yours in that is fine for me.
My problem was, if after the probe of the MDIO controller it was probed
the SGPIO then the PHYs will be in reset because the SGPIO was resetting
the swich. But you put the reset of the swich on the pinctrl which will
be probed before the MDIO, so that should be fine.

> and conceptionally the property is on the wrong DT node. All of the
> drawbacks should have been addressed by my patches for the miim [1]
> and the pinctrl driver [2].
> 
> [1] https://lore.kernel.org/netdev/20220318201324.1647416-1-michael@walle.cc/
> [2] https://lore.kernel.org/linux-gpio/20220313154640.63813-1-michael@walle.cc/
> 
>  drivers/net/ethernet/microchip/lan966x/lan966x_main.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
> index 1f8c67f0261b..0765064d2845 100644
> --- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
> +++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
> @@ -916,7 +916,7 @@ static int lan966x_reset_switch(struct lan966x *lan966x)
>                 return dev_err_probe(lan966x->dev, PTR_ERR(switch_reset),
>                                      "Could not obtain switch reset");
> 
> -       phy_reset = devm_reset_control_get_shared(lan966x->dev, "phy");
> +       phy_reset = devm_reset_control_get_optional_shared(lan966x->dev, "phy");
>         if (IS_ERR(phy_reset))
>                 return dev_err_probe(lan966x->dev, PTR_ERR(phy_reset),
>                                      "Could not obtain phy reset\n");
> --
> 2.30.2
>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
index 1f8c67f0261b..0765064d2845 100644
--- a/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
+++ b/drivers/net/ethernet/microchip/lan966x/lan966x_main.c
@@ -916,7 +916,7 @@  static int lan966x_reset_switch(struct lan966x *lan966x)
 		return dev_err_probe(lan966x->dev, PTR_ERR(switch_reset),
 				     "Could not obtain switch reset");
 
-	phy_reset = devm_reset_control_get_shared(lan966x->dev, "phy");
+	phy_reset = devm_reset_control_get_optional_shared(lan966x->dev, "phy");
 	if (IS_ERR(phy_reset))
 		return dev_err_probe(lan966x->dev, PTR_ERR(phy_reset),
 				     "Could not obtain phy reset\n");