static int fec_enet_clk_enable(struct net_device *ndev, bool enable)
 {
        struct fec_enet_private *fep = netdev_priv(ndev);
-       unsigned long flags;
        int ret;
 
        if (enable) {
                        return ret;
 
                if (fep->clk_ptp) {
-                       spin_lock_irqsave(&fep->tmreg_lock, flags);
+                       mutex_lock(&fep->ptp_clk_mutex);
                        ret = clk_prepare_enable(fep->clk_ptp);
                        if (ret) {
-                               spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+                               mutex_unlock(&fep->ptp_clk_mutex);
                                goto failed_clk_ptp;
                        } else {
                                fep->ptp_clk_on = true;
                        }
-                       spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+                       mutex_unlock(&fep->ptp_clk_mutex);
                }
 
                ret = clk_prepare_enable(fep->clk_ref);
        } else {
                clk_disable_unprepare(fep->clk_enet_out);
                if (fep->clk_ptp) {
-                       spin_lock_irqsave(&fep->tmreg_lock, flags);
+                       mutex_lock(&fep->ptp_clk_mutex);
                        clk_disable_unprepare(fep->clk_ptp);
                        fep->ptp_clk_on = false;
-                       spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+                       mutex_unlock(&fep->ptp_clk_mutex);
                }
                clk_disable_unprepare(fep->clk_ref);
                clk_disable_unprepare(fep->clk_2x_txclk);
                clk_disable_unprepare(fep->clk_ref);
 failed_clk_ref:
        if (fep->clk_ptp) {
-               spin_lock_irqsave(&fep->tmreg_lock, flags);
+               mutex_lock(&fep->ptp_clk_mutex);
                clk_disable_unprepare(fep->clk_ptp);
                fep->ptp_clk_on = false;
-               spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+               mutex_unlock(&fep->ptp_clk_mutex);
        }
 failed_clk_ptp:
        clk_disable_unprepare(fep->clk_enet_out);
        }
 
        fep->ptp_clk_on = false;
-       spin_lock_init(&fep->tmreg_lock);
+       mutex_init(&fep->ptp_clk_mutex);
 
        /* clk_ref is optional, depends on board */
        fep->clk_ref = devm_clk_get_optional(&pdev->dev, "enet_clk_ref");
 
  */
 static int fec_ptp_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
 {
-       struct fec_enet_private *fep =
+       struct fec_enet_private *adapter =
            container_of(ptp, struct fec_enet_private, ptp_caps);
        u64 ns;
        unsigned long flags;
 
-       spin_lock_irqsave(&fep->tmreg_lock, flags);
+       mutex_lock(&adapter->ptp_clk_mutex);
        /* Check the ptp clock */
-       if (!fep->ptp_clk_on) {
-               spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+       if (!adapter->ptp_clk_on) {
+               mutex_unlock(&adapter->ptp_clk_mutex);
                return -EINVAL;
        }
-       ns = timecounter_read(&fep->tc);
-       spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+       spin_lock_irqsave(&adapter->tmreg_lock, flags);
+       ns = timecounter_read(&adapter->tc);
+       spin_unlock_irqrestore(&adapter->tmreg_lock, flags);
+       mutex_unlock(&adapter->ptp_clk_mutex);
 
        *ts = ns_to_timespec64(ns);
 
        unsigned long flags;
        u32 counter;
 
-       spin_lock_irqsave(&fep->tmreg_lock, flags);
+       mutex_lock(&fep->ptp_clk_mutex);
        /* Check the ptp clock */
        if (!fep->ptp_clk_on) {
-               spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+               mutex_unlock(&fep->ptp_clk_mutex);
                return -EINVAL;
        }
 
         */
        counter = ns & fep->cc.mask;
 
+       spin_lock_irqsave(&fep->tmreg_lock, flags);
        writel(counter, fep->hwp + FEC_ATIME);
        timecounter_init(&fep->tc, &fep->cc, ns);
        spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+       mutex_unlock(&fep->ptp_clk_mutex);
        return 0;
 }
 
        struct fec_enet_private *fep = container_of(dwork, struct fec_enet_private, time_keep);
        unsigned long flags;
 
-       spin_lock_irqsave(&fep->tmreg_lock, flags);
+       mutex_lock(&fep->ptp_clk_mutex);
        if (fep->ptp_clk_on) {
+               spin_lock_irqsave(&fep->tmreg_lock, flags);
                timecounter_read(&fep->tc);
+               spin_unlock_irqrestore(&fep->tmreg_lock, flags);
        }
-       spin_unlock_irqrestore(&fep->tmreg_lock, flags);
+       mutex_unlock(&fep->ptp_clk_mutex);
 
        schedule_delayed_work(&fep->time_keep, HZ);
 }
        }
        fep->ptp_inc = NSEC_PER_SEC / fep->cycle_speed;
 
+       spin_lock_init(&fep->tmreg_lock);
+
        fec_ptp_start_cyclecounter(ndev);
 
        INIT_DELAYED_WORK(&fep->time_keep, fec_time_keep);