summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/ti/cpts.h
diff options
context:
space:
mode:
authorGrygorii Strashko <grygorii.strashko@ti.com>2020-04-23 17:20:14 +0300
committerDavid S. Miller <davem@davemloft.net>2020-04-23 12:50:20 -0700
commite66dccced0cfd59a4dc4c16409b713332b882fa6 (patch)
tree5e11f9b41ea862be8068ddb74efbfd2c2b2c2e6d /drivers/net/ethernet/ti/cpts.h
parent79d6e755a45486ffb14bf0ed752e6ace20334cda (diff)
net: ethernet: ti: cpts: separate hw counter read from timecounter
Now CPTS HW time reading code is implemented in timecounter->cyclecounter .read() callback and performs following operations: timecounter_read() ->cc.read() -> cpts_systim_read() - request current CPTS HW time CPTS_TS_PUSH.TS_PUSH = 1 - poll CPTS FIFO for CPTS_EV_PUSH event with current HW timestamp This approach need to be changed for the future switch to PTP PHC .gettimex64() callback, which require to separate requesting current CPTS HW time and processing CPTS FIFO. And for the follow up patch, which improves .adjfreq() implementation. This patch moves code accessing CPTS HW out of timecounter code as following: - convert HW timestamp of every CPTS event to PTP time (us) and store it as part struct cpts_event; - add CPTS context field to store current CPTS HW time (counter) value and update it on CPTS_EV_PUSH reception; - move code accessing CPTS HW out of timecounter code and use current CPTS HW time (counter) from CPTS context instead; - ensure timecounter->cycle_last is updated on CPTS_EV_PUSH reception. After this change CPTS timecounter will only perform timekeeper role without actually accessing CPTS HW. Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com> Acked-by: Richard Cochran <richardcochran@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/ti/cpts.h')
-rw-r--r--drivers/net/ethernet/ti/cpts.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/ethernet/ti/cpts.h b/drivers/net/ethernet/ti/cpts.h
index bb997c11ee15..32ecd1ce4d3b 100644
--- a/drivers/net/ethernet/ti/cpts.h
+++ b/drivers/net/ethernet/ti/cpts.h
@@ -94,6 +94,7 @@ struct cpts_event {
unsigned long tmo;
u32 high;
u32 low;
+ u64 timestamp;
};
struct cpts {
@@ -114,6 +115,7 @@ struct cpts {
struct cpts_event pool_data[CPTS_MAX_EVENTS];
unsigned long ov_check_period;
struct sk_buff_head txq;
+ u64 cur_timestamp;
};
void cpts_rx_timestamp(struct cpts *cpts, struct sk_buff *skb);