net/ice/base: add accessors to get/set time reference
authorQi Zhang <qi.z.zhang@intel.com>
Tue, 10 Aug 2021 02:51:19 +0000 (10:51 +0800)
committerQi Zhang <qi.z.zhang@intel.com>
Wed, 11 Aug 2021 02:23:59 +0000 (04:23 +0200)
commit25c8802a2e1bd9184af58d139f0f19d213731623
treeb7e207ba5e829d051ad6d468d06beb816d7091b9
parent200df241d4c7a3a2fdeec8781a23d02f4f76a92a
net/ice/base: add accessors to get/set time reference

The E822 device clock might come from a variety of different sources,
called TIME_REFs. The firmware reports the current TIME_REF as part of
its function capabilities, which the driver caches when it loads.

Add an accessor function to look up the current TIME_REF from the
capabilities. This reduces line length significantly and also avoids
a tight coupling to the capabilities structure.

In some cases, TIME_REF might change at run time. This can occur in the
event that the CGU registers are updated. When this happens, its
possible that the capabilities structure can be out of date until the
capabilities are re-read.

Add a setter function to update the TIME_REF when this occurs. The
driver can call this function after updating the CGU to ensure that the
TIME_REF in the capabilities structure is up to date, without needing to
re-read the entire capabilities from firmware.

Signed-off-by: Jacob Keller <jacob.e.keller@intel.com>
Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Acked-by: Junfeng Guo <junfeng.guo@intel.com>
drivers/net/ice/base/ice_ptp_hw.h