mbox series

[can-next,v3,00/20] can: rockchip_canfd: add support for CAN-FD IP core found on Rockchip RK3568

Message ID 20240830-rockchip-canfd-v3-0-d426266453fa@pengutronix.de (mailing list archive)
Headers show
Series can: rockchip_canfd: add support for CAN-FD IP core found on Rockchip RK3568 | expand

Message

Marc Kleine-Budde Aug. 30, 2024, 7:25 p.m. UTC
This series adds support for the CAN-FD IP core found on the Rockchip
RK3568.

The IP core is a bit complicated and has several documented errata.
The driver is added in several stages, first the base driver including
the RX-path. Then several workarounds for errata and the TX-path, and
finally features like hardware time stamping, loop-back mode and
bus error reporting.

regards,
Marc

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
Changes in v3:
- dt-bindings: renamed file to rockchip,rk3568-canfd.yaml (thanks Rob)
- dt-bindings: reworked compatibles (thanks Rob)
- Link to v2: https://lore.kernel.org/all/20240731-rockchip-canfd-v2-0-d9604c5b4be8@pengutronix.de

Changes in v2:
- dt-bindings: remove redundant words from subject and patch
  description (thanks Rob)
- dt-bindings: clean up clock- and reset-names (thanks Rob)
- base driver: add missing bitfield.h header
- base driver: rkcanfd_handle_rx_int_one(): initialize header to avoid
  uninitialzied variable warning on m68k
- base driver: rkcanfd_get_berr_counter_raw(): don't add assigned only
  variable (bec_raw), move to 14/20 (thanks Simon)
- CAN-FD frame equal check + TX-path: squash, to avoid unused
  functions (thanks Simon)
- TX-path: rkcanfd_handle_tx_done_one(): don't add assigned only
  variable (skb), move to 18/20 (thanks Simon)
- HW-timetamping: add missing timecounter.h header (thanks Simon)
- Link to v1: https://lore.kernel.org/all/20240729-rockchip-canfd-v1-0-fa1250fd6be3@pengutronix.de

---
David Jander (2):
      arm64: dts: rockchip: add CAN-FD controller nodes to rk3568
      arm64: dts: rockchip: mecsbc: add CAN0 and CAN1 interfaces

Marc Kleine-Budde (18):
      dt-bindings: can: rockchip_canfd: add rockchip CAN-FD controller
      can: rockchip_canfd: add driver for Rockchip CAN-FD controller
      can: rockchip_canfd: add quirks for errata workarounds
      can: rockchip_canfd: add quirk for broken CAN-FD support
      can: rockchip_canfd: add support for rk3568v3
      can: rockchip_canfd: add notes about known issues
      can: rockchip_canfd: rkcanfd_handle_rx_int_one(): implement workaround for erratum 5: check for empty FIFO
      can: rockchip_canfd: rkcanfd_register_done(): add warning for erratum 5
      can: rockchip_canfd: add TX PATH
      can: rockchip_canfd: implement workaround for erratum 6
      can: rockchip_canfd: implement workaround for erratum 12
      can: rockchip_canfd: rkcanfd_get_berr_counter_corrected(): work around broken {RX,TX}ERRORCNT register
      can: rockchip_canfd: add stats support for errata workarounds
      can: rockchip_canfd: prepare to use full TX-FIFO depth
      can: rockchip_canfd: enable full TX-FIFO depth of 2
      can: rockchip_canfd: add hardware timestamping support
      can: rockchip_canfd: add support for CAN_CTRLMODE_LOOPBACK
      can: rockchip_canfd: add support for CAN_CTRLMODE_BERR_REPORTING

 .../bindings/net/can/rockchip,rk3568-canfd.yaml    |  74 ++
 MAINTAINERS                                        |   8 +
 arch/arm64/boot/dts/rockchip/rk3568-mecsbc.dts     |  14 +
 arch/arm64/boot/dts/rockchip/rk3568.dtsi           |  39 +
 drivers/net/can/Kconfig                            |   1 +
 drivers/net/can/Makefile                           |   1 +
 drivers/net/can/rockchip/Kconfig                   |   9 +
 drivers/net/can/rockchip/Makefile                  |  10 +
 drivers/net/can/rockchip/rockchip_canfd-core.c     | 969 +++++++++++++++++++++
 drivers/net/can/rockchip/rockchip_canfd-ethtool.c  |  73 ++
 drivers/net/can/rockchip/rockchip_canfd-rx.c       | 299 +++++++
 .../net/can/rockchip/rockchip_canfd-timestamp.c    | 105 +++
 drivers/net/can/rockchip/rockchip_canfd-tx.c       | 167 ++++
 drivers/net/can/rockchip/rockchip_canfd.h          | 553 ++++++++++++
 14 files changed, 2322 insertions(+)
---
base-commit: cff69f72d33318f4ccfe7d5ff6c5616d00dd45a7
change-id: 20240729-rockchip-canfd-4233c71f0cc6

Best regards,

Comments

Krzysztof Kozlowski Aug. 31, 2024, 6:02 a.m. UTC | #1
On Fri, Aug 30, 2024 at 09:25:57PM +0200, Marc Kleine-Budde wrote:
> This series adds support for the CAN-FD IP core found on the Rockchip
> RK3568.
> 
> The IP core is a bit complicated and has several documented errata.
> The driver is added in several stages, first the base driver including
> the RX-path. Then several workarounds for errata and the TX-path, and
> finally features like hardware time stamping, loop-back mode and
> bus error reporting.
> 
> regards,
> Marc
> 
> Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> ---
> Changes in v3:
> - dt-bindings: renamed file to rockchip,rk3568-canfd.yaml (thanks Rob)
> - dt-bindings: reworked compatibles (thanks Rob)

You never tested the patch before sending.

Best regards,
Krzysztof
Alibek Omarov Sept. 2, 2024, 3:28 a.m. UTC | #2
>The IP core is a bit complicated and has several documented errata.
>The driver is added in several stages, first the base driver including
>the RX-path. Then several workarounds for errata and the TX-path, and
>finally features like hardware time stamping, loop-back mode and
>bus error reporting.

We've tried this on v2, with a custom board with Radxa CM3I connected and
it's even more stable than BSP driver we backported ourselves.

Tested-by: Alibek Omarov <a1ba.omarov@gmail.com>

Cheers,
Alibek.
Marc Kleine-Budde Sept. 2, 2024, 7:01 a.m. UTC | #3
On 02.09.2024 06:28:37, Alibek Omarov wrote:
> >The IP core is a bit complicated and has several documented errata.
> >The driver is added in several stages, first the base driver including
> >the RX-path. Then several workarounds for errata and the TX-path, and
> >finally features like hardware time stamping, loop-back mode and
> >bus error reporting.
> 
> We've tried this on v2, with a custom board with Radxa CM3I connected and
> it's even more stable than BSP driver we backported ourselves.
> 
> Tested-by: Alibek Omarov <a1ba.omarov@gmail.com>

Thanks for testing.

Are you using the CAN in production devices? The driver runs quite good
on a v3 chip, but still not stable on the v2. But as our customer now
only uses v3, I don't have any more time left to fix v2 issues. Drop me
a note, if you have issues with the v2 chip.

regards,
Marc
Marc Kleine-Budde Sept. 2, 2024, 7:24 a.m. UTC | #4
On 02.09.2024 06:28:37, Alibek Omarov wrote:
> >The IP core is a bit complicated and has several documented errata.
> >The driver is added in several stages, first the base driver including
> >the RX-path. Then several workarounds for errata and the TX-path, and
> >finally features like hardware time stamping, loop-back mode and
> >bus error reporting.
> 
> We've tried this on v2, with a custom board with Radxa CM3I connected and
> it's even more stable than BSP driver we backported ourselves.
> 
> Tested-by: Alibek Omarov <a1ba.omarov@gmail.com>

Can you bounce or resend this message to the linux-can@vger.kernel.org
mailing list, as this is our primary review channel.

regards,
Marc
Alibek Omarov Sept. 2, 2024, 7:29 a.m. UTC | #5
> Are you using the CAN in production devices? The driver runs quite good
> on a v3 chip, but still not stable on the v2. But as our customer now
> only uses v3, I don't have any more time left to fix v2 issues. Drop me
> a note, if you have issues with the v2 chip.

Oh, I meant v2 patch set.

We're probably mostly running on v3 chips, since nobody so far
complained about CAN bus and you're also telling it more stable there.
:)
Alibek Omarov Sept. 2, 2024, 7:31 a.m. UTC | #6
Resent to include linux-can@vger.kernel.org by Marc's request.

>This series adds support for the CAN-FD IP core found on the Rockchip
>RK3568.

>The IP core is a bit complicated and has several documented errata.
>The driver is added in several stages, first the base driver including
>the RX-path. Then several workarounds for errata and the TX-path, and
>finally features like hardware time stamping, loop-back mode and
>bus error reporting.

We've tried this on v2 patch set, with a custom board with Radxa CM3I
connected and it's even more stable than BSP driver we backported ourselves.

Tested-by: Alibek Omarov <a1ba.omarov@gmail.com>

Cheers,
Alibek.
Marc Kleine-Budde Sept. 2, 2024, 7:40 a.m. UTC | #7
On 02.09.2024 10:29:38, Alibek Omarov wrote:
> > Are you using the CAN in production devices? The driver runs quite good
> > on a v3 chip, but still not stable on the v2. But as our customer now
> > only uses v3, I don't have any more time left to fix v2 issues. Drop me
> > a note, if you have issues with the v2 chip.
> 
> Oh, I meant v2 patch set.

Ok I see :) The difference between the patch series v2 and v3 was change
in the compatibles and DT bindings. I've added your Tested-by to the
upcoming v4, I thinks this is still OK, right?

> We're probably mostly running on v3 chips, since nobody so far
> complained about CAN bus and you're also telling it more stable there.
> :)

With the v3 SoC the CAN runs more stable than with the v2 SoC, but still
not 1000%. My basic idea was to get it mainline and thus a larger usage
and test coverage.

Nevertheless, I am very interested in any usage or test cases that break
the driver.

regards,
Marc
Marc Kleine-Budde Sept. 2, 2024, 7:41 a.m. UTC | #8
On 02.09.2024 10:31:17, Alibek Omarov wrote:
> Resent to include linux-can@vger.kernel.org by Marc's request.
> 
> >This series adds support for the CAN-FD IP core found on the Rockchip
> >RK3568.
> 
> >The IP core is a bit complicated and has several documented errata.
> >The driver is added in several stages, first the base driver including
> >the RX-path. Then several workarounds for errata and the TX-path, and
> >finally features like hardware time stamping, loop-back mode and
> >bus error reporting.
> 
> We've tried this on v2 patch set, with a custom board with Radxa CM3I
> connected and it's even more stable than BSP driver we backported ourselves.
> 
> Tested-by: Alibek Omarov <a1ba.omarov@gmail.com>

The difference between the v2 and v3 patch set was changes in DT
bindings and the yaml, so I added your Tested-by the upcoming v4.

Thanks again,
Marc
Marc Kleine-Budde Sept. 3, 2024, 9:17 a.m. UTC | #9
On 31.08.2024 08:02:00, Krzysztof Kozlowski wrote:
> On Fri, Aug 30, 2024 at 09:25:57PM +0200, Marc Kleine-Budde wrote:
> > This series adds support for the CAN-FD IP core found on the Rockchip
> > RK3568.
> > 
> > The IP core is a bit complicated and has several documented errata.
> > The driver is added in several stages, first the base driver including
> > the RX-path. Then several workarounds for errata and the TX-path, and
> > finally features like hardware time stamping, loop-back mode and
> > bus error reporting.
> > 
> > regards,
> > Marc
> > 
> > Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
> > ---
> > Changes in v3:
> > - dt-bindings: renamed file to rockchip,rk3568-canfd.yaml (thanks Rob)
> > - dt-bindings: reworked compatibles (thanks Rob)
> 
> You never tested the patch before sending.

Well yes, I forgot one of the tests. It seems I need to set up more
dt-bindings to get used to it. I will send a new series.

regards,
Marc