Skip to content

Commit 3214fae

Browse files
Przekorbanguy11
authored andcommitted
ice: fix PHY timestamp extraction for ETH56G
Fix incorrect PHY timestamp extraction for ETH56G. It's better to use FIELD_PREP() than manual shift. Fixes: 7cab44f ("ice: Introduce ETH56G PHY model for E825C products") Reviewed-by: Przemek Kitszel <[email protected]> Reviewed-by: Simon Horman <[email protected]> Signed-off-by: Przemyslaw Korba <[email protected]> Tested-by: Pucha Himasekhar Reddy <[email protected]> (A Contingent worker at Intel) Signed-off-by: Tony Nguyen <[email protected]>
1 parent 01fd68e commit 3214fae

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

drivers/net/ethernet/intel/ice/ice_ptp_hw.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1518,7 +1518,8 @@ static int ice_read_ptp_tstamp_eth56g(struct ice_hw *hw, u8 port, u8 idx,
15181518
* lower 8 bits in the low register, and the upper 32 bits in the high
15191519
* register.
15201520
*/
1521-
*tstamp = ((u64)hi) << TS_PHY_HIGH_S | ((u64)lo & TS_PHY_LOW_M);
1521+
*tstamp = FIELD_PREP(TS_PHY_HIGH_M, hi) |
1522+
FIELD_PREP(TS_PHY_LOW_M, lo);
15221523

15231524
return 0;
15241525
}

drivers/net/ethernet/intel/ice/ice_ptp_hw.h

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -682,9 +682,8 @@ static inline bool ice_is_dual(struct ice_hw *hw)
682682
#define TS_HIGH_M 0xFF
683683
#define TS_HIGH_S 32
684684

685-
#define TS_PHY_LOW_M 0xFF
686-
#define TS_PHY_HIGH_M 0xFFFFFFFF
687-
#define TS_PHY_HIGH_S 8
685+
#define TS_PHY_LOW_M GENMASK(7, 0)
686+
#define TS_PHY_HIGH_M GENMASK_ULL(39, 8)
688687

689688
#define BYTES_PER_IDX_ADDR_L_U 8
690689
#define BYTES_PER_IDX_ADDR_L 4

0 commit comments

Comments
 (0)