ice: exit bypass mode once hardware finishes timestamp calibration
authorJacob Keller <jacob.e.keller@intel.com>
Wed, 13 Oct 2021 15:56:58 +0000 (08:56 -0700)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Tue, 21 Dec 2021 17:11:40 +0000 (09:11 -0800)
commita69f1cb62aecedddaec445aff28f095793b1c28c
treeedbe5847f7a2b930c1cf1b72595eb2e85f6b16b2
parentb111ab5a11eb8f7261940c95ada9fbf5ca784731
ice: exit bypass mode once hardware finishes timestamp calibration

Once the E822 device has sent and received one packet, the hardware
computes the internal delay of the PHY using a process known as Vernier
calibration. This calibration calculates a more accurate offset for the
Tx and Rx timestamps. To make use of this offset, we need to exit the
bypass mode. This cannot be done until the PHY has completed offset
calibration, as indicated by the offset valid bits.

To handle this, introduce a kthread work item which will poll the offset
valid bits every few milliseconds seeing if it is safe to exit bypass
mode.

Once we have finished calibrating the offsets, we can program the total
Tx and Rx offset registers and turn off the bypass bit. This allows the
hardware to include the more precise vernier calibration offset, and
improves the timestamp precision.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/ice_ptp.c
drivers/net/ethernet/intel/ice/ice_ptp.h
drivers/net/ethernet/intel/ice/ice_ptp_hw.c
drivers/net/ethernet/intel/ice/ice_ptp_hw.h