dts: bindings: can: rename bus-speed/bus-speed-data properties

Deprecate the CAN controller bus-speed/bus-speed-data properties and rename
them to bitrate/bitrate-data to match the terminology used in other CAN
devicetree properties and the CAN subsystem API.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
This commit is contained in:
Henrik Brix Andersen 2024-06-01 22:28:09 +00:00 committed by Fabio Baltieri
commit 695e704b5d
8 changed files with 33 additions and 11 deletions

View file

@ -101,7 +101,7 @@ stopping the processing of CAN frames.
.. note:: .. note::
The CAN controller mode and timing can only be changed while the CAN controller is stopped, which The CAN controller mode and timing can only be changed while the CAN controller is stopped, which
is the initial setting upon boot-up. The initial CAN controller mode is set to ``normal`` and the is the initial setting upon boot-up. The initial CAN controller mode is set to ``normal`` and the
initial timing is set according to the ``bus-speed``, ``sample-point``, ``bus-speed-data``, and initial timing is set according to the ``bitrate``, ``sample-point``, ``bitrate-data``, and
``sample-point-data`` :ref:`devicetree` properties. ``sample-point-data`` :ref:`devicetree` properties.
Timing Timing

View file

@ -247,8 +247,9 @@ Controller Area Network (CAN)
============================= =============================
* Removed the following deprecated CAN controller devicetree properties. Out-of-tree boards using * Removed the following deprecated CAN controller devicetree properties. Out-of-tree boards using
these properties need to switch to using the ``bus-speed``, ``sample-point``, ``bus-speed-data``, these properties can switch to using the ``bitrate``, ``sample-point``, ``bitrate-data``, and
and ``sample-point-data`` devicetree properties for specifying the initial CAN bitrate: ``sample-point-data`` devicetree properties (or rely on :kconfig:option:`CAN_DEFAULT_BITRATE` and
:kconfig:option:`CAN_DEFAULT_BITRATE_DATA`) for specifying the initial CAN bitrate:
* ``sjw`` * ``sjw``
* ``prop-seg`` * ``prop-seg``
@ -259,6 +260,9 @@ Controller Area Network (CAN)
* ``phase-seg1-data`` * ``phase-seg1-data``
* ``phase-seg1-data`` * ``phase-seg1-data``
The ``bus-speed`` and ``bus-speed-data`` CAN controller devicetree properties have been
deprecated.
(:github:`68714`) (:github:`68714`)
* Support for manual bus-off recovery was reworked (:github:`69460`): * Support for manual bus-off recovery was reworked (:github:`69460`):

View file

@ -28,7 +28,7 @@ config CAN_DEFAULT_BITRATE
default 125000 default 125000
help help
Default initial CAN bitrate in bits/s. This can be overridden per CAN controller using the Default initial CAN bitrate in bits/s. This can be overridden per CAN controller using the
"bus-speed" devicetree property. "bitrate" devicetree property.
config CAN_DEFAULT_BITRATE_DATA config CAN_DEFAULT_BITRATE_DATA
int "Default CAN data phase bitrate" int "Default CAN data phase bitrate"
@ -36,7 +36,7 @@ config CAN_DEFAULT_BITRATE_DATA
depends on CAN_FD_MODE depends on CAN_FD_MODE
help help
Default initial CAN data phase bitrate in bits/s. This can be overridden per CAN controller Default initial CAN data phase bitrate in bits/s. This can be overridden per CAN controller
using the "bus-speed-data" devicetree property. using the "bitrate-data" devicetree property.
config CAN_SHELL config CAN_SHELL
bool "CAN shell" bool "CAN shell"

View file

@ -4,6 +4,14 @@ include: base.yaml
properties: properties:
bus-speed: bus-speed:
type: int
deprecated: true
description: |
Deprecated. This property has been renamed to bitrate.
Initial bitrate in bit/s. If this is unset, the initial bitrate is set to
CONFIG_CAN_DEFAULT_BITRATE.
bitrate:
type: int type: int
description: | description: |
Initial bitrate in bit/s. If this is unset, the initial bitrate is set to Initial bitrate in bit/s. If this is unset, the initial bitrate is set to

View file

@ -4,6 +4,14 @@ include: can-controller.yaml
properties: properties:
bus-speed-data: bus-speed-data:
type: int
deprecated: true
description: |
Deprecated. This property has been renamed to bitrate-data.
Initial data phase bitrate in bit/s. If this is unset, the initial data phase bitrate is set
to CONFIG_CAN_DEFAULT_BITRATE_DATA.
bitrate-data:
type: int type: int
description: | description: |
Initial data phase bitrate in bit/s. If this is unset, the initial data phase bitrate is set Initial data phase bitrate in bit/s. If this is unset, the initial data phase bitrate is set

View file

@ -374,11 +374,12 @@ struct can_driver_config {
.phy = DEVICE_DT_GET_OR_NULL(DT_PHANDLE(node_id, phys)), \ .phy = DEVICE_DT_GET_OR_NULL(DT_PHANDLE(node_id, phys)), \
.min_bitrate = DT_CAN_TRANSCEIVER_MIN_BITRATE(node_id, _min_bitrate), \ .min_bitrate = DT_CAN_TRANSCEIVER_MIN_BITRATE(node_id, _min_bitrate), \
.max_bitrate = DT_CAN_TRANSCEIVER_MAX_BITRATE(node_id, _max_bitrate), \ .max_bitrate = DT_CAN_TRANSCEIVER_MAX_BITRATE(node_id, _max_bitrate), \
.bus_speed = DT_PROP_OR(node_id, bus_speed, CONFIG_CAN_DEFAULT_BITRATE), \ .bus_speed = DT_PROP_OR(node_id, bitrate, \
DT_PROP_OR(node_id, bus_speed, CONFIG_CAN_DEFAULT_BITRATE)), \
.sample_point = DT_PROP_OR(node_id, sample_point, 0), \ .sample_point = DT_PROP_OR(node_id, sample_point, 0), \
IF_ENABLED(CONFIG_CAN_FD_MODE, \ IF_ENABLED(CONFIG_CAN_FD_MODE, \
(.bus_speed_data = DT_PROP_OR(node_id, bus_speed_data, \ (.bus_speed_data = DT_PROP_OR(node_id, bitrate_data, \
CONFIG_CAN_DEFAULT_BITRATE_DATA), \ DT_PROP_OR(node_id, bus_speed_data, CONFIG_CAN_DEFAULT_BITRATE_DATA)), \
.sample_point_data = DT_PROP_OR(node_id, sample_point_data, 0),)) \ .sample_point_data = DT_PROP_OR(node_id, sample_point_data, 0),)) \
} }

View file

@ -15,8 +15,9 @@
LOG_MODULE_REGISTER(app); LOG_MODULE_REGISTER(app);
#define CAN_INTERFACE DEVICE_DT_GET(DT_CHOSEN(zephyr_canbus)) #define CAN_INTERFACE DEVICE_DT_GET(DT_CHOSEN(zephyr_canbus))
#define CAN_BITRATE (DT_PROP_OR(DT_CHOSEN(zephyr_canbus), bus_speed, \ #define CAN_BITRATE (DT_PROP_OR(DT_CHOSEN(zephyr_canbus), bitrate, \
CONFIG_CAN_DEFAULT_BITRATE) / 1000) DT_PROP_OR(DT_CHOSEN(zephyr_canbus), bus_speed, \
CONFIG_CAN_DEFAULT_BITRATE)) / 1000)
static struct gpio_dt_spec led_green_gpio = GPIO_DT_SPEC_GET_OR( static struct gpio_dt_spec led_green_gpio = GPIO_DT_SPEC_GET_OR(
DT_ALIAS(green_led), gpios, {0}); DT_ALIAS(green_led), gpios, {0});

View file

@ -22,7 +22,7 @@ The Zephyr end of the CAN fixture can be configured as follows:
* The CAN controller to be used is set using the ``zephyr,canbus`` chosen devicetree node. * The CAN controller to be used is set using the ``zephyr,canbus`` chosen devicetree node.
* The CAN bitrates are set using :kconfig:option:`CONFIG_CAN_DEFAULT_BITRATE` and * The CAN bitrates are set using :kconfig:option:`CONFIG_CAN_DEFAULT_BITRATE` and
:kconfig:option:`CONFIG_CAN_DEFAULT_BITRATE_DATA`, but can be overridden on a board level using :kconfig:option:`CONFIG_CAN_DEFAULT_BITRATE_DATA`, but can be overridden on a board level using
the ``bus-speed`` and ``bus-speed-data`` CAN controller devicetree properties if needed. Default the ``bitrate`` and ``bitrate-data`` CAN controller devicetree properties if needed. Default
bitrates are 125 kbits/s for the arbitration phase/CAN classic and 1 Mbit/s for the CAN FD data bitrates are 125 kbits/s for the arbitration phase/CAN classic and 1 Mbit/s for the CAN FD data
phase when using bitrate switching (BRS). phase when using bitrate switching (BRS).