Commit 2b2a9a08 authored by Marc Kleine-Budde's avatar Marc Kleine-Budde

Merge patch series "can: rockchip_canfd: rework delay calculation and decoding...

Merge patch series "can: rockchip_canfd: rework delay calculation and decoding of error code register"

Marc Kleine-Budde <mkl@pengutronix.de> says:

This series updates the delay calculation for the timekeeping delayed
work and fixes the decoding of the error code register.

Link: https://patch.msgid.link/20240911-can-rockchip_canfd-fixes-v1-0-5ce385b5ab10@pengutronix.deSigned-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parents 709cbd5b a63e1046
...@@ -491,11 +491,9 @@ rkcanfd_handle_error_int_reg_ec(struct rkcanfd_priv *priv, struct can_frame *cf, ...@@ -491,11 +491,9 @@ rkcanfd_handle_error_int_reg_ec(struct rkcanfd_priv *priv, struct can_frame *cf,
else if (reg_ec & RKCANFD_REG_ERROR_CODE_TX_CRC) else if (reg_ec & RKCANFD_REG_ERROR_CODE_TX_CRC)
cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ; cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
else if (reg_ec & RKCANFD_REG_ERROR_CODE_TX_ACK_EOF) else if (reg_ec & RKCANFD_REG_ERROR_CODE_TX_ACK_EOF)
cf->data[3] = CAN_ERR_PROT_LOC_ACK; cf->data[3] = CAN_ERR_PROT_LOC_ACK_DEL;
else if (reg_ec & RKCANFD_REG_ERROR_CODE_TX_ACK) else if (reg_ec & RKCANFD_REG_ERROR_CODE_TX_ACK)
cf->data[3] = CAN_ERR_PROT_LOC_ACK; cf->data[3] = CAN_ERR_PROT_LOC_ACK;
else if (reg_ec & RKCANFD_REG_ERROR_CODE_TX_ACK_EOF)
cf->data[3] = CAN_ERR_PROT_LOC_ACK_DEL;
/* RKCANFD_REG_ERROR_CODE_TX_ERROR */ /* RKCANFD_REG_ERROR_CODE_TX_ERROR */
else if (reg_ec & RKCANFD_REG_ERROR_CODE_TX_OVERLOAD) else if (reg_ec & RKCANFD_REG_ERROR_CODE_TX_OVERLOAD)
cf->data[2] |= CAN_ERR_PROT_OVERLOAD; cf->data[2] |= CAN_ERR_PROT_OVERLOAD;
......
...@@ -71,8 +71,8 @@ void rkcanfd_timestamp_init(struct rkcanfd_priv *priv) ...@@ -71,8 +71,8 @@ void rkcanfd_timestamp_init(struct rkcanfd_priv *priv)
max_cycles = div_u64(ULLONG_MAX, cc->mult); max_cycles = div_u64(ULLONG_MAX, cc->mult);
max_cycles = min(max_cycles, cc->mask); max_cycles = min(max_cycles, cc->mask);
work_delay_ns = div_u64(clocksource_cyc2ns(max_cycles, cc->mult, cc->shift), 3); work_delay_ns = clocksource_cyc2ns(max_cycles, cc->mult, cc->shift);
priv->work_delay_jiffies = nsecs_to_jiffies(work_delay_ns); priv->work_delay_jiffies = div_u64(work_delay_ns, 3u * NSEC_PER_SEC / HZ);
INIT_DELAYED_WORK(&priv->timestamp, rkcanfd_timestamp_work); INIT_DELAYED_WORK(&priv->timestamp, rkcanfd_timestamp_work);
netdev_dbg(priv->ndev, "clock=%lu.%02luMHz bitrate=%lu.%02luMBit/s div=%u rate=%lu.%02luMHz mult=%u shift=%u delay=%lus\n", netdev_dbg(priv->ndev, "clock=%lu.%02luMHz bitrate=%lu.%02luMBit/s div=%u rate=%lu.%02luMHz mult=%u shift=%u delay=%lus\n",
......
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