| From 5838a151a5ecfdced0e22e03797f109ac7de2ab1 Mon Sep 17 00:00:00 2001 |
| From: Sasha Levin <sashal@kernel.org> |
| Date: Fri, 15 Nov 2024 13:25:37 +0100 |
| Subject: ice: fix PHY timestamp extraction for ETH56G |
| |
| From: Przemyslaw Korba <przemyslaw.korba@intel.com> |
| |
| [ Upstream commit 3214fae85e8336fe13e20cf78fc9b6a668bdedff ] |
| |
| Fix incorrect PHY timestamp extraction for ETH56G. |
| It's better to use FIELD_PREP() than manual shift. |
| |
| Fixes: 7cab44f1c35f ("ice: Introduce ETH56G PHY model for E825C products") |
| Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com> |
| Reviewed-by: Simon Horman <horms@kernel.org> |
| Signed-off-by: Przemyslaw Korba <przemyslaw.korba@intel.com> |
| Tested-by: Pucha Himasekhar Reddy <himasekharx.reddy.pucha@intel.com> (A Contingent worker at Intel) |
| Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com> |
| Signed-off-by: Sasha Levin <sashal@kernel.org> |
| --- |
| drivers/net/ethernet/intel/ice/ice_ptp_hw.c | 3 ++- |
| drivers/net/ethernet/intel/ice/ice_ptp_hw.h | 5 ++--- |
| 2 files changed, 4 insertions(+), 4 deletions(-) |
| |
| diff --git a/drivers/net/ethernet/intel/ice/ice_ptp_hw.c b/drivers/net/ethernet/intel/ice/ice_ptp_hw.c |
| index ec8db830ac73a..3816e45b6ab44 100644 |
| --- a/drivers/net/ethernet/intel/ice/ice_ptp_hw.c |
| +++ b/drivers/net/ethernet/intel/ice/ice_ptp_hw.c |
| @@ -1495,7 +1495,8 @@ static int ice_read_ptp_tstamp_eth56g(struct ice_hw *hw, u8 port, u8 idx, |
| * lower 8 bits in the low register, and the upper 32 bits in the high |
| * register. |
| */ |
| - *tstamp = ((u64)hi) << TS_PHY_HIGH_S | ((u64)lo & TS_PHY_LOW_M); |
| + *tstamp = FIELD_PREP(TS_PHY_HIGH_M, hi) | |
| + FIELD_PREP(TS_PHY_LOW_M, lo); |
| |
| return 0; |
| } |
| diff --git a/drivers/net/ethernet/intel/ice/ice_ptp_hw.h b/drivers/net/ethernet/intel/ice/ice_ptp_hw.h |
| index 6cedc1a906afb..4c8b845713442 100644 |
| --- a/drivers/net/ethernet/intel/ice/ice_ptp_hw.h |
| +++ b/drivers/net/ethernet/intel/ice/ice_ptp_hw.h |
| @@ -663,9 +663,8 @@ static inline u64 ice_get_base_incval(struct ice_hw *hw) |
| #define TS_HIGH_M 0xFF |
| #define TS_HIGH_S 32 |
| |
| -#define TS_PHY_LOW_M 0xFF |
| -#define TS_PHY_HIGH_M 0xFFFFFFFF |
| -#define TS_PHY_HIGH_S 8 |
| +#define TS_PHY_LOW_M GENMASK(7, 0) |
| +#define TS_PHY_HIGH_M GENMASK_ULL(39, 8) |
| |
| #define BYTES_PER_IDX_ADDR_L_U 8 |
| #define BYTES_PER_IDX_ADDR_L 4 |
| -- |
| 2.43.0 |
| |