mbox series

[net,0/4] Fixes for dwmac-sun8i suspend/resume

Message ID 20210103111744.34989-1-samuel@sholland.org
Headers show
Series Fixes for dwmac-sun8i suspend/resume | expand

Message

Samuel Holland Jan. 3, 2021, 11:17 a.m. UTC
This series fixes issues preventing dwmac-sun8i from working after a
suspend/resume cycle. Those issues include the PHY being left powered
off, the MAC syscon configuration being reset, and the reference to the
reset controller being improperly dropped. They also fix related issues
in probe error handling and driver removal.

Samuel Holland (4):
  net: stmmac: dwmac-sun8i: Fix probe error handling
  net: stmmac: dwmac-sun8i: Balance internal PHY resource references
  net: stmmac: dwmac-sun8i: Balance internal PHY power
  net: stmmac: dwmac-sun8i: Balance syscon (de)initialization

 .../net/ethernet/stmicro/stmmac/dwmac-sun8i.c | 129 +++++++++++-------
 1 file changed, 82 insertions(+), 47 deletions(-)

Comments

Chen-Yu Tsai Jan. 4, 2021, 1:42 p.m. UTC | #1
On Sun, Jan 3, 2021 at 7:17 PM Samuel Holland <samuel@sholland.org> wrote:
>

> stmmac_pltfr_remove does three things in one function, making it

> inapproprate for unwinding the steps in the probe function. Currently,

> a failure before the call to stmmac_dvr_probe would leak OF node

> references due to missing a call to stmmac_remove_config_dt. And an

> error in stmmac_dvr_probe would cause the driver to attempt to remove a

> netdevice that was never added. Fix these by reordering the init and

> splitting out the error handling steps.

>

> Fixes: 9f93ac8d4085 ("net-next: stmmac: Add dwmac-sun8i")

> Fixes: 40a1dcee2d18 ("net: ethernet: dwmac-sun8i: Use the correct function in exit path")

> Signed-off-by: Samuel Holland <samuel@sholland.org>


Reviewed-by: Chen-Yu Tsai <wens@csie.org>
Chen-Yu Tsai Jan. 4, 2021, 1:42 p.m. UTC | #2
On Sun, Jan 3, 2021 at 7:17 PM Samuel Holland <samuel@sholland.org> wrote:
>

> While stmmac_pltfr_remove calls sun8i_dwmac_exit, the sun8i_dwmac_init

> and sun8i_dwmac_exit functions are also called by the stmmac_platform

> suspend/resume callbacks. They may be called many times during the

> device's lifetime and should not release resources used by the driver.

>

> Furthermore, there was no error handling in case registering the MDIO

> mux failed during probe, and the EPHY clock was never released at all.

>

> Fix all of these issues by moving the deinitialization code to a driver

> removal callback. Also ensure the EPHY is powered down before removal.

>

> Fixes: 634db83b8265 ("net: stmmac: dwmac-sun8i: Handle integrated/external MDIOs")

> Signed-off-by: Samuel Holland <samuel@sholland.org>


Reviewed-by: Chen-Yu Tsai <wens@csie.org>