Rockchip, RK3588内部集成的CAN总线控制器故障处理
CAN接收和发送异常,包括丢帧、错误计数增加、过滤错误等问题处理 陆续补充错误处理方法,注意基于RK3588,其它采用同样IP的瑞芯微SOC估计也都有这些问题 本帖最后由 gxliu08 于 2024-12-6 17:19 编辑History for kernel/drivers/net/can/rockchip/rockchip_canfd.c on develop-5.10
Commits on Nov 6, 2023
net: can: rockchip: use soft reset for bus off
on Nov 6, 2023
net: can: rockchip: fix rx stuck and timeout
on Nov 6, 2023
net: can: rockchip: support Listen-only mode
on Nov 6, 2023
net: can: rockchip: fix tx error in special application
on Nov 6, 2023
Commits on Aug 9, 2023
net: can: rockchip: support rk3568 can v2
on Aug 9, 2023
Commits on Oct 28, 2022
net: can: rockchip: canfd: Add delay work to check tx errors
on Oct 28, 2022
Commits on Sep 30, 2022
net: can: rockchip: canfd: Support extended frames transmit for rk3568
on Sep 30, 2022
Commits on Sep 1, 2022
net: can: rockchip: fix up the canfd/can BUS_OFF_INT error
on Sep 1, 2022
Commits on Dec 2, 2021
net: can: rockchip: fix up the canfd/can error
on Dec 2, 2021
Commits on Dec 1, 2021
net: can: rockchip: support can-2.0
on Dec 1, 2021
Commits on Aug 11, 2021
net: can: add rockchip CAN driver
on Aug 11, 2021
Commits on Mar 5, 2021
net: can: rockchip: fix up the receiving filter ID
on Mar 5, 2021
Commits on Jan 5, 2021
net: can: rockchip: canfd: fix up the bus error
on Jan 5, 2021
Commits on Aug 25, 2020
net: can: rockchip: modify the usleep to udelay
on Aug 25, 2020
Commits on Jul 16, 2020
net: can: add rockchip CANFD driver
on Jul 16, 2020
本帖最后由 gxliu08 于 2024-12-6 17:39 编辑
static int rockchip_canfd_err(struct net_device *ndev, u32 isr)
{
struct rockchip_canfd *rcan = netdev_priv(ndev);
struct net_device_stats *stats = &ndev->stats;
struct can_frame *cf;
struct sk_buff *skb;
unsigned int rxerr, txerr;
u32 sta_reg;
skb = alloc_can_err_skb(ndev, &cf);
rxerr = rockchip_canfd_read(rcan, CAN_RX_ERR_CNT);
txerr = rockchip_canfd_read(rcan, CAN_TX_ERR_CNT);
sta_reg = rockchip_canfd_read(rcan, CAN_STATE);
if (skb) {
cf->data = txerr;
cf->data = rxerr;
}
if (isr & BUS_OFF_INT) {
rcan->can.state = CAN_STATE_BUS_OFF;
rcan->can.can_stats.bus_off++;
cf->can_id |= CAN_ERR_BUSOFF;
} else if (isr & ERR_WARN_INT) {
rcan->can.can_stats.error_warning++;
rcan->can.state = CAN_STATE_ERROR_WARNING;
/* error warning state */
if (likely(skb)) {
cf->can_id |= CAN_ERR_CRTL;
cf->data = (txerr > rxerr) ?
CAN_ERR_CRTL_TX_WARNING :
CAN_ERR_CRTL_RX_WARNING;
cf->data = txerr;
cf->data = rxerr;
}
} else if (isr & PASSIVE_ERR_INT) {
rcan->can.can_stats.error_passive++;
rcan->can.state = CAN_STATE_ERROR_PASSIVE;
/* error passive state */
cf->can_id |= CAN_ERR_CRTL;
cf->data = (txerr > rxerr) ?
CAN_ERR_CRTL_TX_WARNING :
CAN_ERR_CRTL_RX_WARNING;
cf->data = txerr;
cf->data = rxerr;
}
if (rcan->can.state >= CAN_STATE_BUS_OFF ||
((sta_reg & CAN_BUSOFF_FLAG) == CAN_BUSOFF_FLAG)) {
cancel_delayed_work(&rcan->tx_err_work);
netif_stop_queue(ndev);
rockchip_canfd_stop(ndev);
can_free_echo_skb(ndev, 0);
rockchip_canfd_start(ndev);
netif_start_queue(ndev);
}
stats->rx_packets++;
stats->rx_bytes += cf->can_dlc;
netif_rx(skb);
return 0;
}
页:
[1]