Skip to content

Commit aa44323

Browse files
committed
Merge branch 'stmmac-ptp-fix'
Mohammad Athari Bin Ismail says: ==================== Fix PTP issue in stmmac This patch series to fix PTP issue in stmmac related to: 1/ PTP clock source configuration during initialization. 2/ PTP initialization during resume from suspend. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 3626898 + 0735e63 commit aa44323

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

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

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -890,6 +890,9 @@ static int stmmac_init_ptp(struct stmmac_priv *priv)
890890
bool xmac = priv->plat->has_gmac4 || priv->plat->has_xgmac;
891891
int ret;
892892

893+
if (priv->plat->ptp_clk_freq_config)
894+
priv->plat->ptp_clk_freq_config(priv);
895+
893896
ret = stmmac_init_tstamp_counter(priv, STMMAC_HWTS_ACTIVE);
894897
if (ret)
895898
return ret;
@@ -912,8 +915,6 @@ static int stmmac_init_ptp(struct stmmac_priv *priv)
912915
priv->hwts_tx_en = 0;
913916
priv->hwts_rx_en = 0;
914917

915-
stmmac_ptp_register(priv);
916-
917918
return 0;
918919
}
919920

@@ -3239,7 +3240,7 @@ static int stmmac_fpe_start_wq(struct stmmac_priv *priv)
32393240
/**
32403241
* stmmac_hw_setup - setup mac in a usable state.
32413242
* @dev : pointer to the device structure.
3242-
* @init_ptp: initialize PTP if set
3243+
* @ptp_register: register PTP if set
32433244
* Description:
32443245
* this is the main function to setup the HW in a usable state because the
32453246
* dma engine is reset, the core registers are configured (e.g. AXI,
@@ -3249,7 +3250,7 @@ static int stmmac_fpe_start_wq(struct stmmac_priv *priv)
32493250
* 0 on success and an appropriate (-)ve integer as defined in errno.h
32503251
* file on failure.
32513252
*/
3252-
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)
32533254
{
32543255
struct stmmac_priv *priv = netdev_priv(dev);
32553256
u32 rx_cnt = priv->plat->rx_queues_to_use;
@@ -3306,13 +3307,13 @@ static int stmmac_hw_setup(struct net_device *dev, bool init_ptp)
33063307

33073308
stmmac_mmc_setup(priv);
33083309

3309-
if (init_ptp) {
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-
}
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);
33163317

33173318
priv->eee_tw_timer = STMMAC_DEFAULT_TWT_LS;
33183319

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,6 @@ void stmmac_ptp_register(struct stmmac_priv *priv)
297297
{
298298
int i;
299299

300-
if (priv->plat->ptp_clk_freq_config)
301-
priv->plat->ptp_clk_freq_config(priv);
302-
303300
for (i = 0; i < priv->dma_cap.pps_out_num; i++) {
304301
if (i >= STMMAC_PPS_MAX)
305302
break;

0 commit comments

Comments
 (0)