Commit dd50481f authored by Ille, Ondrej, Ing.'s avatar Ille, Ondrej, Ing.

driver: Add timestamp read-out function.

Implemented protection against overflow between read from
parent 8bbd5f8e
Pipeline #5994 canceled with stages
in 3 minutes and 46 seconds
......@@ -774,4 +774,21 @@ bool ctu_can_fd_insert_frame(struct ctucanfd_priv *priv,
return true;
static u64 ctu_can_fd_read_timestamp(struct ctucanfd_priv *priv)
union ctu_can_fd_timestamp_low ts_low;
union ctu_can_fd_timestamp_high ts_high;
union ctu_can_fd_timestamp_high ts_high_2;
ts_high.u32 = priv->read_reg(priv, CTU_CAN_FD_TIMESTAMP_HIGH);
ts_low.u32 = priv->read_reg(priv, CTU_CAN_FD_TIMESTAMP_LOW);
ts_high_2.u32 = priv->read_reg(priv, CTU_CAN_FD_TIMESTAMP_HIGH);
if (ts_high.u32 != ts_high_2.u32){
ts_low.u32 = priv->read_reg(priv, CTU_CAN_FD_TIMESTAMP_LOW);
return (( (u64) ts_high_2.u32) << 32) | ( (u64) ts_low.u32);
......@@ -955,6 +955,20 @@ static inline union ctu_can_fd_debug_register
return reg;
* Read timestamp value which is used internally by CTU CAN FD Core.
* Reads timestamp twice and checks consistency betwen upper and
* lower timestamp word.
* Arguments:
* priv Private info
* Returns:
* Value of timestamp in CTU CAN FD Core
static u64 ctu_can_fd_read_timestamp(struct ctucanfd_priv *priv);
extern const struct can_bittiming_const ctu_can_fd_bit_timing_max;
extern const struct can_bittiming_const ctu_can_fd_bit_timing_data_max;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment