Skip to content

Commit 0735e63

Browse files
Mohammad Athari Bin Ismaildavem330
authored andcommitted
net: stmmac: skip only stmmac_ptp_register when resume from suspend
When resume from suspend, besides skipping PTP registration, it also skipping PTP HW initialization. This could cause PTP clock not able to operate properly when resume from suspend. To fix this, only stmmac_ptp_register() is skipped when resume from suspend. Fixes: fe13192 ("stmmac: Don't init ptp again when resume from suspend/hibernation") Cc: <[email protected]> # 5.15.x Signed-off-by: Mohammad Athari Bin Ismail <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 94c82de commit 0735e63

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -915,8 +915,6 @@ static int stmmac_init_ptp(struct stmmac_priv *priv)
915915
priv->hwts_tx_en = 0;
916916
priv->hwts_rx_en = 0;
917917

918-
stmmac_ptp_register(priv);
919-
920918
return 0;
921919
}
922920

@@ -3242,7 +3240,7 @@ static int stmmac_fpe_start_wq(struct stmmac_priv *priv)
32423240
/**
32433241
* stmmac_hw_setup - setup mac in a usable state.
32443242
* @dev : pointer to the device structure.
3245-
* @init_ptp: initialize PTP if set
3243+
* @ptp_register: register PTP if set
32463244
* Description:
32473245
* this is the main function to setup the HW in a usable state because the
32483246
* dma engine is reset, the core registers are configured (e.g. AXI,
@@ -3252,7 +3250,7 @@ static int stmmac_fpe_start_wq(struct stmmac_priv *priv)
32523250
* 0 on success and an appropriate (-)ve integer as defined in errno.h
32533251
* file on failure.
32543252
*/
3255-
static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
3253+
static int stmmac_hw_setup(struct net_device *dev, bool ptp_register)
32563254
{
32573255
struct stmmac_priv *priv = netdev_priv(dev);
32583256
u32 rx_cnt = priv->plat->rx_queues_to_use;
@@ -3309,13 +3307,13 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
33093307

33103308
stmmac_mmc_setup(priv);
33113309

3312-
if (init_ptp) {
3313-
ret = stmmac_init_ptp(priv);
3314-
if (ret == -EOPNOTSUPP)
3315-
netdev_warn(priv->dev, "PTP not supported by HW\n");
3316-
else if (ret)
3317-
netdev_warn(priv->dev, "PTP init failed\n");
3318-
}
3310+
ret = stmmac_init_ptp(priv);
3311+
if (ret == -EOPNOTSUPP)
3312+
netdev_warn(priv->dev, "PTP not supported by HW\n");
3313+
else if (ret)
3314+
netdev_warn(priv->dev, "PTP init failed\n");
3315+
else if (ptp_register)
3316+
stmmac_ptp_register(priv);
33193317

33203318
priv->eee_tw_timer = STMMAC_DEFAULT_TWT_LS;
33213319

0 commit comments

Comments
 (0)