51e102ec | 22-Oct-2024 |
Jean Delvare <jdelvare@suse.de> |
can: rockchip_canfd: Drop obsolete dependency on COMPILE_TEST
Since commit 0166dc11be91 ("of: make CONFIG_OF user selectable"), OF can be enabled on all architectures. Therefore depending on COMPILE
can: rockchip_canfd: Drop obsolete dependency on COMPILE_TEST
Since commit 0166dc11be91 ("of: make CONFIG_OF user selectable"), OF can be enabled on all architectures. Therefore depending on COMPILE_TEST as an alternative is no longer needed.
Signed-off-by: Jean Delvare <jdelvare@suse.de> Reviewed-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr> Link: https://patch.msgid.link/20241022130439.70d016e9@endymion.delvare Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
show more ...
|
a63e1046 | 11-Sep-2024 |
Marc Kleine-Budde <mkl@pengutronix.de> |
can: rockchip_canfd: rkcanfd_handle_error_int_reg_ec(): fix decoding of error code register
Probably due to a copy/paste error rkcanfd_handle_error_int_reg_ec() checks twice if the RKCANFD_REG_ERROR
can: rockchip_canfd: rkcanfd_handle_error_int_reg_ec(): fix decoding of error code register
Probably due to a copy/paste error rkcanfd_handle_error_int_reg_ec() checks twice if the RKCANFD_REG_ERROR_CODE_TX_ACK_EOF bit is set in reg_ec.
Keep the correct check for RKCANFD_REG_ERROR_CODE_TX_ACK_EOF and remove the superfluous one.
Reported-by: Dan Carpenter <dan.carpenter@linaro.org> Closes: https://patch.msgid.link/9a46d10d-e4e3-40a5-8fb6-f4637959f124@stanley.mountain Fixes: ff60bfbaf67f ("can: rockchip_canfd: add driver for Rockchip CAN-FD controller") Link: https://patch.msgid.link/20240911-can-rockchip_canfd-fixes-v1-2-5ce385b5ab10@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
show more ...
|
9c100bc3 | 08-Sep-2024 |
Marc Kleine-Budde <mkl@pengutronix.de> |
can: rockchip_canfd: rkcanfd_timestamp_init(): fix 64 bit division on 32 bit platforms
On some 32-bit platforms (at least on parisc), the compiler generates a call to __divdi3() from the u32 by 3 di
can: rockchip_canfd: rkcanfd_timestamp_init(): fix 64 bit division on 32 bit platforms
On some 32-bit platforms (at least on parisc), the compiler generates a call to __divdi3() from the u32 by 3 division in rkcanfd_timestamp_init(), which results in the following linker error:
| ERROR: modpost: "__divdi3" [drivers/net/can/rockchip/rockchip_canfd.ko] undefined!
As this code doesn't run in the hot path, a 64 bit by 32 bit division is OK, even on 32 bit platforms. Use an explicit call to div_u64() to fix linking.
Reported-by: kernel test robot <lkp@intel.com> Closes: https://lore.kernel.org/oe-kbuild-all/202409072304.lCQWyNLU-lkp@intel.com/ Link: https://patch.msgid.link/20240909-can-rockchip_canfd-fix-64-bit-division-v1-1-2748d9422b00@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
show more ...
|
e3b5fa0f | 19-Dec-2023 |
Marc Kleine-Budde <mkl@pengutronix.de> |
can: rockchip_canfd: add support for CAN_CTRLMODE_BERR_REPORTING
Add support for Bus Error Reporting.
Tested-by: Alibek Omarov <a1ba.omarov@gmail.com> Acked-by: Heiko Stuebner <heiko@sntech.de> Lin
can: rockchip_canfd: add support for CAN_CTRLMODE_BERR_REPORTING
Add support for Bus Error Reporting.
Tested-by: Alibek Omarov <a1ba.omarov@gmail.com> Acked-by: Heiko Stuebner <heiko@sntech.de> Link: https://patch.msgid.link/20240904-rockchip-canfd-v5-20-8ae22bcb27cc@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
show more ...
|
edf1dd18 | 25-Dec-2023 |
Marc Kleine-Budde <mkl@pengutronix.de> |
can: rockchip_canfd: add support for CAN_CTRLMODE_LOOPBACK
Add support for loopback mode.
Tested-by: Alibek Omarov <a1ba.omarov@gmail.com> Acked-by: Heiko Stuebner <heiko@sntech.de> Link: https://p
can: rockchip_canfd: add support for CAN_CTRLMODE_LOOPBACK
Add support for loopback mode.
Tested-by: Alibek Omarov <a1ba.omarov@gmail.com> Acked-by: Heiko Stuebner <heiko@sntech.de> Link: https://patch.msgid.link/20240904-rockchip-canfd-v5-19-8ae22bcb27cc@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
show more ...
|
a5605d61 | 18-Jan-2024 |
Marc Kleine-Budde <mkl@pengutronix.de> |
can: rockchip_canfd: enable full TX-FIFO depth of 2
The previous commit prepared the TX path to make use of the full TX-FIFO depth as much as possible. Increase the available TX-FIFO depth to the ha
can: rockchip_canfd: enable full TX-FIFO depth of 2
The previous commit prepared the TX path to make use of the full TX-FIFO depth as much as possible. Increase the available TX-FIFO depth to the hardware maximum of 2.
Tested-by: Alibek Omarov <a1ba.omarov@gmail.com> Acked-by: Heiko Stuebner <heiko@sntech.de> Link: https://patch.msgid.link/20240904-rockchip-canfd-v5-17-8ae22bcb27cc@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
show more ...
|
ae002cc3 | 17-Jan-2024 |
Marc Kleine-Budde <mkl@pengutronix.de> |
can: rockchip_canfd: prepare to use full TX-FIFO depth
So far the TX-FIFO is only used with a depth of 1, although the hardware offers a depth of 2.
The workaround for the chips that are affected b
can: rockchip_canfd: prepare to use full TX-FIFO depth
So far the TX-FIFO is only used with a depth of 1, although the hardware offers a depth of 2.
The workaround for the chips that are affected by erratum 6, i.e. EFF frames may be send as standard frames, is to re-send the EFF frame. This means the driver cannot queue the next frame for sending, as long ad the EFF frame has not been successfully send out.
Introduce rkcanfd_get_effective_tx_free() that returns "0" space in the TX-FIFO if an EFF frame is pending and the actual free space in the TX-FIFO otherwise. Then replace rkcanfd_get_tx_free() with rkcanfd_get_effective_tx_free() everywhere.
Tested-by: Alibek Omarov <a1ba.omarov@gmail.com> Acked-by: Heiko Stuebner <heiko@sntech.de> Link: https://patch.msgid.link/20240904-rockchip-canfd-v5-16-8ae22bcb27cc@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
show more ...
|
669904d1 | 14-Dec-2023 |
Marc Kleine-Budde <mkl@pengutronix.de> |
can: rockchip_canfd: add stats support for errata workarounds
The driver contains workarounds for some of the rk3568v2 errata. Add ethtool-based statistics ("ethtool -S") to track how often an errat
can: rockchip_canfd: add stats support for errata workarounds
The driver contains workarounds for some of the rk3568v2 errata. Add ethtool-based statistics ("ethtool -S") to track how often an erratum workaround was needed.
Tested-by: Alibek Omarov <a1ba.omarov@gmail.com> Acked-by: Heiko Stuebner <heiko@sntech.de> Link: https://patch.msgid.link/20240904-rockchip-canfd-v5-15-8ae22bcb27cc@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
show more ...
|
7ba7111b | 10-Dec-2023 |
Marc Kleine-Budde <mkl@pengutronix.de> |
can: rockchip_canfd: rkcanfd_get_berr_counter_corrected(): work around broken {RX,TX}ERRORCNT register
Tests show that sometimes both CAN bus error counters read 0x0, even if the controller is in wa
can: rockchip_canfd: rkcanfd_get_berr_counter_corrected(): work around broken {RX,TX}ERRORCNT register
Tests show that sometimes both CAN bus error counters read 0x0, even if the controller is in warning mode (RKCANFD_REG_STATE_ERROR_WARNING_STATE in RKCANFD_REG_STATE set).
To work around this issue, if both error counters read from hardware are 0x0, use the structure priv->bec, otherwise save the read value in priv->bec.
In rkcanfd_handle_rx_int_one() decrement the priv->bec.rxerr for successfully RX'ed CAN frames.
In rkcanfd_handle_tx_done_one() decrement the priv->bec.txerr for successfully TX'ed CAN frames.
Tested-by: Alibek Omarov <a1ba.omarov@gmail.com> Acked-by: Heiko Stuebner <heiko@sntech.de> Link: https://patch.msgid.link/20240904-rockchip-canfd-v5-14-8ae22bcb27cc@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
show more ...
|
83f9bd6b | 24-Nov-2023 |
Marc Kleine-Budde <mkl@pengutronix.de> |
can: rockchip_canfd: implement workaround for erratum 12
The rk3568 CAN-FD errata sheet as of Tue 07 Nov 2023 11:25:31 +08:00 says:
| A dominant bit at the third bit of the intermission may cause a
can: rockchip_canfd: implement workaround for erratum 12
The rk3568 CAN-FD errata sheet as of Tue 07 Nov 2023 11:25:31 +08:00 says:
| A dominant bit at the third bit of the intermission may cause a | transmission error. | | When sampling the third bit of the intermission as a dominant bit, if | tx_req is configured to transmit extended frames at this time, the | extended frame may be sent to the bus in the format of a standard | frame. The extended frame will be sent as a standard frame and will not | result in error frames
Turn on "Interframe Spaceing RX Mode" only during TX to work around erratum 12, according to rock-chip:
| Spaceing RX Mode = 1, the third Bit between frames cannot receive | and send, and the fourth Bit begins to receive and send. | | Spaceing RX Mode = 0, allowing the third Bit between frames to | receive and send.
Message-ID: <be72939f-0a9e-0608-dfff-7b0096a26eba@rock-chips.com> Tested-by: Alibek Omarov <a1ba.omarov@gmail.com> Acked-by: Heiko Stuebner <heiko@sntech.de> Link: https://patch.msgid.link/20240904-rockchip-canfd-v5-13-8ae22bcb27cc@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
show more ...
|
58d3cc65 | 24-Nov-2023 |
Marc Kleine-Budde <mkl@pengutronix.de> |
can: rockchip_canfd: implement workaround for erratum 6
The rk3568 CAN-FD errata sheet as of Tue 07 Nov 2023 11:25:31 +08:00 says:
| The CAN controller's transmission of extended frames may | inter
can: rockchip_canfd: implement workaround for erratum 6
The rk3568 CAN-FD errata sheet as of Tue 07 Nov 2023 11:25:31 +08:00 says:
| The CAN controller's transmission of extended frames may | intermittently change into standard frames. | | When using the CAN controller to send extended frames, if the | 'tx_req' is configured as 1 and coincides with the internal | transmission point, the extended frame will be transmitted onto the | bus in the format of a standard frame.
To work around Erratum 6, the driver is in self-receiving mode (RXSTX) and all received CAN frames are passed through rkcanfd_rxstx_filter().
Add a check in rkcanfd_rxstx_filter() whether the received frame corresponds to the current outgoing frame, but the extended CAN ID has been mangled to a standard ID. In this case re-send the original CAN frame.
Tested-by: Alibek Omarov <a1ba.omarov@gmail.com> Acked-by: Heiko Stuebner <heiko@sntech.de> Link: https://patch.msgid.link/20240904-rockchip-canfd-v5-12-8ae22bcb27cc@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
show more ...
|
b6661d73 | 24-Nov-2023 |
Marc Kleine-Budde <mkl@pengutronix.de> |
can: rockchip_canfd: add TX PATH
The IP core has a TX event FIFO. In other IP cores, this type of FIFO usually contains the events that a CAN frame has been successfully sent. However, the IP core o
can: rockchip_canfd: add TX PATH
The IP core has a TX event FIFO. In other IP cores, this type of FIFO usually contains the events that a CAN frame has been successfully sent. However, the IP core on the rk3568v2 the FIFO also holds events of unsuccessful transmission attempts.
It turned out that the best way to work around this problem is to set the IP core to self-receive mode (RXSTX), filter out the self-received frames and insert them into the complete TX path.
Add a pair new functions to check if 2 struct canfd_frame are equal. The 1st checks if the header of the CAN frames are equal, the 2nd checks if the data portion are equal:
- rkcanfd_can_frame_header_equal() - rkcanfd_can_frame_data_equal()
Tested-by: Alibek Omarov <a1ba.omarov@gmail.com> Acked-by: Heiko Stuebner <heiko@sntech.de> Link: https://patch.msgid.link/20240904-rockchip-canfd-v5-11-8ae22bcb27cc@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
show more ...
|
25e024c3 | 12-Dec-2023 |
Marc Kleine-Budde <mkl@pengutronix.de> |
can: rockchip_canfd: rkcanfd_register_done(): add warning for erratum 5
Tests on the rk3568v2 and rk3568v3 show that a reduced "baudclk" (e.g. 80MHz, compared to the standard 300MHz) significantly i
can: rockchip_canfd: rkcanfd_register_done(): add warning for erratum 5
Tests on the rk3568v2 and rk3568v3 show that a reduced "baudclk" (e.g. 80MHz, compared to the standard 300MHz) significantly increases the possibility of incorrect FIFO counters, i.e. erratum 5.
Print an info message if the clock is below the known good value of 300MHz.
Tested-by: Alibek Omarov <a1ba.omarov@gmail.com> Acked-by: Heiko Stuebner <heiko@sntech.de> Link: https://patch.msgid.link/20240904-rockchip-canfd-v5-10-8ae22bcb27cc@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
show more ...
|
65713542 | 04-Jan-2024 |
Marc Kleine-Budde <mkl@pengutronix.de> |
can: rockchip_canfd: rkcanfd_handle_rx_int_one(): implement workaround for erratum 5: check for empty FIFO
The rk3568 CAN-FD errata sheet as of Tue 07 Nov 2023 11:25:31 +08:00 says:
| Erratum 5: Co
can: rockchip_canfd: rkcanfd_handle_rx_int_one(): implement workaround for erratum 5: check for empty FIFO
The rk3568 CAN-FD errata sheet as of Tue 07 Nov 2023 11:25:31 +08:00 says:
| Erratum 5: Counters related to the TXFIFO and RXFIFO exhibit | abnormal counting behavior. | | Due to a bug in the cross-asynchronous logic of the enable signals | for rx_fifo_cnt and txe_fifo_frame_cnt counters, the counts of these | two counters become inaccurate. This issue has resulted in the | inability to use the TXFIFO and RXFIFO functions.
The errata sheet mentioned above states that only the rk3568v2 is affected by this erratum, but tests with the rk3568v2 and rk3568v3 show that the RX_FIFO_CNT is sometimes too high. This leads to CAN frames being read from the FIFO, which is then already empty.
Further tests on the rk3568v2 and rk3568v3 show that in this situation (i.e. empty FIFO) all elements of the FIFO header (frameinfo, id, ts) contain the same data.
On the rk3568v2 and rk3568v3, this problem only occurs extremely rarely with the standard clock of 300 MHz, but almost immediately at 80 MHz.
To workaround this problem, check for empty FIFO with rkcanfd_fifo_header_empty() in rkcanfd_handle_rx_int_one() and exit early.
Tested-by: Alibek Omarov <a1ba.omarov@gmail.com> Acked-by: Heiko Stuebner <heiko@sntech.de> Link: https://patch.msgid.link/20240904-rockchip-canfd-v5-9-8ae22bcb27cc@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
show more ...
|
fb999a5f | 28-Jul-2024 |
Marc Kleine-Budde <mkl@pengutronix.de> |
can: rockchip_canfd: add notes about known issues
Even the rk3568v3 has some known issues. Document them together with a reproducer.
Tested-by: Alibek Omarov <a1ba.omarov@gmail.com> Acked-by: Heiko
can: rockchip_canfd: add notes about known issues
Even the rk3568v3 has some known issues. Document them together with a reproducer.
Tested-by: Alibek Omarov <a1ba.omarov@gmail.com> Acked-by: Heiko Stuebner <heiko@sntech.de> Link: https://patch.msgid.link/20240904-rockchip-canfd-v5-8-8ae22bcb27cc@pengutronix.de Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
show more ...
|