Skip to content

drivers/can: add support for Bosch C_CAN controller

Dario Binacchi xenomai 5 versions – Applied

Status from this message: Thanks, applied with the changes mentioned in patch 1.

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v5 Latest8 patches 3 repliesApplied
  2. v48 patches 5 repliesApplied
  3. v37 patches 1 replySuperseded
Earlier versions · 2
VersionPostedPatchesRepliesStatus
v26 patches3 repliesSuperseded
v16 patches11 repliesSuperseded

Changes in v5 from the cover letter

- Add the `drivers/can: add corectl to retrieve configuration' patch to the series.
- smokey_modprobe(): check the `name' parameter.
- smokey_modprobe(): return `err' instead of 0 in case of no error.
- smokey_rmmod(): set smokey_modules[midx] to NULL after freeing the pointed string.
- Check _CC_COBALT_GET_CAN_CONFIG through cobalt_corectl call.
- Don't check modprobe return code. In case the modules are builtin the test would be improperly terminated with an error, since the modprobe does not check if a module is builtin.

Patches in v5 Applied

#Subject and filesSizeRepliesApplied
1/8drivers/can: add corectl to retrieve configurationinclude/cobalt/uapi/corectl.h kernel/drivers/can/Makefile kernel/drivers/can/corectl.c +1 more+51 -21 reply
2/8lib/smokey: add smokey_{modprobe,rmmod} helpersinclude/smokey/smokey.h lib/smokey/helpers.c testsuite/smokey/net_common/setup.c+110 -670 replies
3/8testsuite/smokey: add virtual CAN testsuiteconfigure.ac testsuite/smokey/Makefile.am testsuite/smokey/can-virt/Makefile.am +1 more+381 -00 replies
4/8drivers/can: add multi message support to sendmsgkernel/drivers/can/rtcan_raw.c+128 -1110 replies
5/8drivers/can: add CAN_ERR_CRTL_ACTIVE info statusinclude/rtdm/uapi/can.h+1 -00 replies
6/8drivers/can: add len field to can frame structuresinclude/rtdm/uapi/can.h kernel/drivers/can/rtcan_socket.h+8 -20 replies
7/8drivers/can: add a minimal support to ethtool APIkernel/drivers/can/Makefile kernel/drivers/can/rtcan_dev.h kernel/drivers/can/rtcan_ethtool.c +2 more+123 -20 replies
8/8drivers/can: add support for Bosch C_CAN controller.gitlab-ci.yml kernel/drivers/can/Kconfig kernel/drivers/can/Makefile +7 more+2089 -11 reply

Reviews trailers per patch

None of the 8 patches has a Reviewed-by or Acked-by.

PatchGianluca Falavigna
1/8
2/8
3/8
4/8
5/8
6/8
7/8
8/8T-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v5 thread

Cover letter [PATCH v5 0/8] drivers/can: add support for Bosch C_CAN controller

The series was created to optimize the use of the C_CAN controller (maximum number of message objects, use of FIFO, ...) to get the best possible RX/TX throughput from hardware.

To emphasize the purpose of the series I also added the patch which adds multi-message support to `sendmsg ', rather than' submitting it separately. In fact, it too has contributed to increasing transmission throughput.

The patches prior to the one adding the BOSCH C_CAN controller driver, are a backporting of commits from the linux kernel that also impacted on the driver itself and I found it necessary to add to the series.

The latest patch, as described in its commit, modified Stephen Battazzo's patch [1] with bug fixes, backporting of commits from the linux kernel, extension of message objects to 64 and improvements in FIFO handling. This series was in fact preceded by the creation of patches which I sent to the Linux kernel and which were then accepted:

387da6bc7a82 ("can: c_can: cache frames to operate as a true FIFO") 28e86e9ab522 ("can: c_can: support tx ring algorithm")
a54cdbba9dee ("can: c_can: exit c_can_do_tx() early if no frames have been sent") 5064e40596f4 ("can: c_can: remove struct c_can_priv::priv field") 06fc143b2ede dt-bindings: net: can: c_can: convert to json-schema 132f2d45fb23 ("can: c_can: add support to 64 message objects") 13831ce69c77 ("can: c_can: prepare to up the message objects number") fcbded019855 ("can: c_can: use 32-bit write to set arbitration register") eddf67115040 ("can: c_can: add a comment about IF_RX interface's use") c8a6b44388cb ("can: c_can: fix indentation")
f65735c203d5 ("can: c_can: remove unused code")

The patch was tested on a custom board mounting an AM335x SOC for the next configurations:
- CONFIG_XENO_DRIVERS_CAN=m, CONFIG_XENO_DRIVERS_CAN_VIRT=m
- CONFIG_XENO_DRIVERS_CAN=y, CONFIG_XENO_DRIVERS_CAN_VIRT=m
- CONFIG_XENO_DRIVERS_CAN=y, CONFIG_XENO_DRIVERS_CAN_VIRT=y

PCI support has not been developed.

[1] http://xenomai.org/pipermail/xenomai/2015-July/034690.html

Changes in v5:
- Add the `drivers/can: add corectl to retrieve configuration' patch to the series.
- smokey_modprobe(): check the `name' parameter.
- smokey_modprobe(): return `err' instead of 0 in case of no error.
- smokey_rmmod(): set smokey_modules[midx] to NULL after freeing the pointed string.
- Check _CC_COBALT_GET_CAN_CONFIG through cobalt_corectl call.
- Don't check modprobe return code. In case the modules are builtin the test would be improperly terminated with an error, since the modprobe does not check if a module is builtin.

Changes in v4:
- Add the patch to the series.
- Load/unload the CAN drivers modules before/after running the test.
- Add setup/teardown function.

Changes in v3:
- Add the patch to the series.

Changes in v2:
- Expand the commit message to better describe the added API.
- Drop 'default n' Kconfig
- Enable the driver for Xenomai CI builds
- Drop commented code
- Drop power managemet (pm) code

Dario Binacchi (8):
drivers/can: add corectl to retrieve configuration lib/smokey: add smokey_{modprobe,rmmod} helpers testsuite/smokey: add virtual CAN testsuite drivers/can: add multi message support to sendmsg drivers/can: add CAN_ERR_CRTL_ACTIVE info status drivers/can: add len field to can frame structures drivers/can: add a minimal support to ethtool API drivers/can: add support for Bosch C_CAN controller

 .gitlab-ci.yml                                |    2 +
 configure.ac                                  |    1 +
 include/cobalt/uapi/corectl.h                 |    2 +
 include/rtdm/uapi/can.h                       |    6 +-
 include/smokey/smokey.h                       |    6 +-
 kernel/drivers/can/Kconfig                    |    1 +
 kernel/drivers/can/Makefile                   |    6 +-
 kernel/drivers/can/README                     |    1 +
 kernel/drivers/can/c_can/Kconfig              |   15 +
 kernel/drivers/can/c_can/Makefile             |    8 +
 kernel/drivers/can/c_can/rtcan_c_can.c        | 1298 +++++++++++++++++
 kernel/drivers/can/c_can/rtcan_c_can.h        |  255 ++++
 .../drivers/can/c_can/rtcan_c_can_ethtool.c   |   47 +
 .../drivers/can/c_can/rtcan_c_can_platform.c  |  461 ++++++
 kernel/drivers/can/corectl.c                  |   41 +
 kernel/drivers/can/rtcan_dev.h                |    4 +-
 kernel/drivers/can/rtcan_ethtool.c            |   75 +
 kernel/drivers/can/rtcan_ethtool.h            |   24 +
 kernel/drivers/can/rtcan_module.c             |    6 +
 kernel/drivers/can/rtcan_raw.c                |  239 +--
 kernel/drivers/can/rtcan_raw_dev.c            |   20 +
 kernel/drivers/can/rtcan_socket.h             |    5 +-
 lib/smokey/helpers.c                          |  103 ++
 testsuite/smokey/Makefile.am                  |    2 +
 testsuite/smokey/can-virt/Makefile.am         |    8 +
 testsuite/smokey/can-virt/virt.c              |  370 +++++
 testsuite/smokey/net_common/setup.c           |   68 +-
 27 files changed, 2890 insertions(+), 184 deletions(-)
 create mode 100644 kernel/drivers/can/c_can/Kconfig
 create mode 100644 kernel/drivers/can/c_can/Makefile
 create mode 100644 kernel/drivers/can/c_can/rtcan_c_can.c
 create mode 100644 kernel/drivers/can/c_can/rtcan_c_can.h
 create mode 100644 kernel/drivers/can/c_can/rtcan_c_can_ethtool.c
 create mode 100644 kernel/drivers/can/c_can/rtcan_c_can_platform.c
 create mode 100644 kernel/drivers/can/corectl.c
 create mode 100644 kernel/drivers/can/rtcan_ethtool.c
 create mode 100644 kernel/drivers/can/rtcan_ethtool.h
 create mode 100644 testsuite/smokey/can-virt/Makefile.am
 create mode 100644 testsuite/smokey/can-virt/virt.c
Signature · 1 line
2.17.1