Skip to content

Commit 2b2a9a0

Browse files
Merge patch series "can: rockchip_canfd: rework delay calculation and decoding of error code register"
Marc Kleine-Budde <[email protected]> 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.de Signed-off-by: Marc Kleine-Budde <[email protected]>
2 parents 709cbd5 + a63e104 commit 2b2a9a0

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

drivers/net/can/rockchip/rockchip_canfd-core.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -491,11 +491,9 @@ rkcanfd_handle_error_int_reg_ec(struct rkcanfd_priv *priv, struct can_frame *cf,
491491
else if (reg_ec & RKCANFD_REG_ERROR_CODE_TX_CRC)
492492
cf->data[3] = CAN_ERR_PROT_LOC_CRC_SEQ;
493493
else if (reg_ec & RKCANFD_REG_ERROR_CODE_TX_ACK_EOF)
494-
cf->data[3] = CAN_ERR_PROT_LOC_ACK;
494+
cf->data[3] = CAN_ERR_PROT_LOC_ACK_DEL;
495495
else if (reg_ec & RKCANFD_REG_ERROR_CODE_TX_ACK)
496496
cf->data[3] = CAN_ERR_PROT_LOC_ACK;
497-
else if (reg_ec & RKCANFD_REG_ERROR_CODE_TX_ACK_EOF)
498-
cf->data[3] = CAN_ERR_PROT_LOC_ACK_DEL;
499497
/* RKCANFD_REG_ERROR_CODE_TX_ERROR */
500498
else if (reg_ec & RKCANFD_REG_ERROR_CODE_TX_OVERLOAD)
501499
cf->data[2] |= CAN_ERR_PROT_OVERLOAD;

drivers/net/can/rockchip/rockchip_canfd-timestamp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ void rkcanfd_timestamp_init(struct rkcanfd_priv *priv)
7171

7272
max_cycles = div_u64(ULLONG_MAX, cc->mult);
7373
max_cycles = min(max_cycles, cc->mask);
74-
work_delay_ns = div_u64(clocksource_cyc2ns(max_cycles, cc->mult, cc->shift), 3);
75-
priv->work_delay_jiffies = nsecs_to_jiffies(work_delay_ns);
74+
work_delay_ns = clocksource_cyc2ns(max_cycles, cc->mult, cc->shift);
75+
priv->work_delay_jiffies = div_u64(work_delay_ns, 3u * NSEC_PER_SEC / HZ);
7676
INIT_DELAYED_WORK(&priv->timestamp, rkcanfd_timestamp_work);
7777

7878
netdev_dbg(priv->ndev, "clock=%lu.%02luMHz bitrate=%lu.%02luMBit/s div=%u rate=%lu.%02luMHz mult=%u shift=%u delay=%lus\n",

0 commit comments

Comments
 (0)