ptp: ptp_clockmatrix: return -EBUSY if phase pull-in is in progress
authorMin Li <min.li.xe@renesas.com>
Mon, 16 May 2022 14:47:07 +0000 (10:47 -0400)
committerJakub Kicinski <kuba@kernel.org>
Wed, 18 May 2022 00:49:04 +0000 (17:49 -0700)
Also removes PEROUT_ENABLE_OUTPUT_MASK

Signed-off-by: Min Li <min.li.xe@renesas.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Link: https://lore.kernel.org/r/1652712427-14703-2-git-send-email-min.li.xe@renesas.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/ptp/ptp_clockmatrix.c
drivers/ptp/ptp_clockmatrix.h

index 25075764eea43405506dccb53acfb4506814ccc8..cb258e1448d553120a77e604834ecb8b92291135 100644 (file)
@@ -1352,43 +1352,15 @@ static int idtcm_output_enable(struct idtcm_channel *channel,
        return idtcm_write(idtcm, (u16)base, OUT_CTRL_1, &val, sizeof(val));
 }
 
-static int idtcm_output_mask_enable(struct idtcm_channel *channel,
-                                   bool enable)
-{
-       u16 mask;
-       int err;
-       u8 outn;
-
-       mask = channel->output_mask;
-       outn = 0;
-
-       while (mask) {
-               if (mask & 0x1) {
-                       err = idtcm_output_enable(channel, enable, outn);
-                       if (err)
-                               return err;
-               }
-
-               mask >>= 0x1;
-               outn++;
-       }
-
-       return 0;
-}
-
 static int idtcm_perout_enable(struct idtcm_channel *channel,
                               struct ptp_perout_request *perout,
                               bool enable)
 {
        struct idtcm *idtcm = channel->idtcm;
-       unsigned int flags = perout->flags;
        struct timespec64 ts = {0, 0};
        int err;
 
-       if (flags == PEROUT_ENABLE_OUTPUT_MASK)
-               err = idtcm_output_mask_enable(channel, enable);
-       else
-               err = idtcm_output_enable(channel, enable, perout->index);
+       err = idtcm_output_enable(channel, enable, perout->index);
 
        if (err) {
                dev_err(idtcm->dev, "Unable to set output enable");
@@ -1892,7 +1864,7 @@ static int idtcm_adjtime(struct ptp_clock_info *ptp, s64 delta)
        int err;
 
        if (channel->phase_pull_in == true)
-               return 0;
+               return -EBUSY;
 
        mutex_lock(idtcm->lock);
 
index 43796508031f1b02b1a8187ace4055f46016d4dd..bf1e49409844041d1743cd6d2d9047eacb155dba 100644 (file)
@@ -54,8 +54,6 @@
 #define LOCK_TIMEOUT_MS                        (2000)
 #define LOCK_POLL_INTERVAL_MS          (10)
 
-#define PEROUT_ENABLE_OUTPUT_MASK      (0xdeadbeef)
-
 #define IDTCM_MAX_WRITE_COUNT          (512)
 
 #define PHASE_PULL_IN_MAX_PPB          (144000)