fm10k/base: fix ieee1588 adjustment direction
authorWang Xiao W <xiao.w.wang@intel.com>
Thu, 10 Sep 2015 04:38:22 +0000 (12:38 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 7 Oct 2015 11:35:48 +0000 (13:35 +0200)
The SYSTIME_CFG.Adjust field has a Direction bit to indicate whether the
adjustment is positive or negative. However, we incorrectly read the
documentation and the direction bit should be set 1 when positive, not
when negative.

Signed-off-by: Wang Xiao W <xiao.w.wang@intel.com>
drivers/net/fm10k/base/fm10k_pf.c
drivers/net/fm10k/base/fm10k_type.h

index 704ab16..6e6d71e 100644 (file)
@@ -1969,8 +1969,8 @@ STATIC s32 fm10k_adjust_systime_pf(struct fm10k_hw *hw, s32 ppb)
        if (systime_adjust > FM10K_SW_SYSTIME_ADJUST_MASK)
                return FM10K_ERR_PARAM;
 
-       if (ppb < 0)
-               systime_adjust |= FM10K_SW_SYSTIME_ADJUST_DIR_NEGATIVE;
+       if (ppb > 0)
+               systime_adjust |= FM10K_SW_SYSTIME_ADJUST_DIR_POSITIVE;
 
        FM10K_WRITE_SW_REG(hw, FM10K_SW_SYSTIME_ADJUST, (u32)systime_adjust);
 
index fed8cbe..39e4d15 100644 (file)
@@ -486,7 +486,7 @@ struct fm10k_hw;
 #define FM10K_SW_SYSTIME_CFG_ADJUST_MASK       0xFF000000
 #define FM10K_SW_SYSTIME_ADJUST        0x0224D
 #define FM10K_SW_SYSTIME_ADJUST_MASK           0x3FFFFFFF
-#define FM10K_SW_SYSTIME_ADJUST_DIR_NEGATIVE   0x80000000
+#define FM10K_SW_SYSTIME_ADJUST_DIR_POSITIVE   0x80000000
 #define FM10K_SW_SYSTIME_PULSE(_n)     ((_n) + 0x02252)
 
 #ifndef ETH_ALEN