canbus: rename zephyr,can-primary chosen property to zephyr,canbus

Rename the Zephyr chosen property for specifying the default CAN bus
controller from "zephyr,can-primary" to "zephyr,canbus".

The "zephyr,can-primary" property name was selected in antipation of
adding support for redundant CAN networks, which we have yet to
add. Meanwhile, the "primary" term causes confusion for non-redundant
CAN bus configurations (and the "can" term doesn't match the name of the
Zephyr CAN bus subsystem).

The CAN in Automation (CiA) 302-6, which deals with CANopen network
redundancy, uses the terms "default interface" and "redundant
interface". If/when we add support for redundant CAN networks, the
"zephyr,canbus" chosen property can be supplemented with a
"zephyr,canbus-redundant" chosen property.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
This commit is contained in:
Henrik Brix Andersen 2021-11-02 16:49:04 +01:00 committed by Anas Nashif
commit c817a09b0a
41 changed files with 50 additions and 50 deletions

View file

@ -18,7 +18,7 @@
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,ccm = &ccm0;
zephyr,can-primary = &can2;
zephyr,canbus = &can2;
};
leds {

View file

@ -18,7 +18,7 @@
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,ccm = &ccm0;
zephyr,can-primary = &can2;
zephyr,canbus = &can2;
};
leds {

View file

@ -23,7 +23,7 @@
zephyr,console = &uart0;
zephyr,shell-uart = &uart0;
zephyr,uart-pipe = &uart0;
zephyr,can-primary = &flexcan0;
zephyr,canbus = &flexcan0;
};
leds {

View file

@ -27,7 +27,7 @@
zephyr,dtcm = &dtcm;
zephyr,console = &lpuart1;
zephyr,shell-uart = &lpuart1;
zephyr,can-primary = &flexcan1;
zephyr,canbus = &flexcan1;
};
sdram0: memory@80000000 {

View file

@ -28,7 +28,7 @@
zephyr,dtcm = &dtcm;
zephyr,console = &lpuart1;
zephyr,shell-uart = &lpuart1;
zephyr,can-primary = &flexcan2;
zephyr,canbus = &flexcan2;
};
sdram0: memory@80000000 {

View file

@ -29,7 +29,7 @@
zephyr,dtcm = &dtcm;
zephyr,console = &lpuart1;
zephyr,shell-uart = &lpuart1;
zephyr,can-primary = &flexcan2;
zephyr,canbus = &flexcan2;
};
sdram0: memory@80000000 {

View file

@ -18,7 +18,7 @@
zephyr,dtcm = &dtcm;
zephyr,console = &lpuart1;
zephyr,shell-uart = &lpuart1;
zephyr,can-primary = &flexcan3;
zephyr,canbus = &flexcan3;
};
sdram0: memory@80000000 {

View file

@ -17,7 +17,7 @@
zephyr,sram = &sram1;
zephyr,console = &lpuart1;
zephyr,shell-uart = &lpuart1;
zephyr,can-primary = &flexcan2;
zephyr,canbus = &flexcan2;
};
sdram0: memory@80000000 {

View file

@ -18,7 +18,7 @@
zephyr,dtcm = &dtcm;
zephyr,console = &lpuart1;
zephyr,shell-uart = &lpuart1;
zephyr,can-primary = &flexcan3;
zephyr,canbus = &flexcan3;
};
sdram0: memory@80000000 {

View file

@ -18,7 +18,7 @@
zephyr,shell-uart = &usart2;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,can-primary = &can1;
zephyr,canbus = &can1;
};
leds {

View file

@ -18,7 +18,7 @@
zephyr,shell-uart = &usart2;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,can-primary = &can1;
zephyr,canbus = &can1;
};
leds {

View file

@ -18,7 +18,7 @@
zephyr,shell-uart = &usart3;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,can-primary = &can1;
zephyr,canbus = &can1;
};
leds {

View file

@ -26,7 +26,7 @@
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,dtcm = &dtcm;
zephyr,can-primary = &can1;
zephyr,canbus = &can1;
};
leds {

View file

@ -27,7 +27,7 @@
zephyr,flash = &flash0;
zephyr,code-partition = &slot0_partition;
zephyr,dtcm = &dtcm;
zephyr,can-primary = &can1;
zephyr,canbus = &can1;
};
leds {

View file

@ -18,7 +18,7 @@
zephyr,shell-uart = &lpuart1;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,can-primary = &can1;
zephyr,canbus = &can1;
};
leds {

View file

@ -17,7 +17,7 @@
zephyr,shell-uart = &usart2;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,can-primary = &can1;
zephyr,canbus = &can1;
};
leds {

View file

@ -18,7 +18,7 @@
zephyr,shell-uart = &lpuart1;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,can-primary = &can1;
zephyr,canbus = &can1;
};
leds {

View file

@ -18,7 +18,7 @@
zephyr,shell-uart = &usart2;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,can-primary = &can1;
zephyr,canbus = &can1;
};
gpio_keys {

View file

@ -18,7 +18,7 @@
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,ccm = &ccm0;
zephyr,can-primary = &can1;
zephyr,canbus = &can1;
};
leds {

View file

@ -17,7 +17,7 @@
zephyr,shell-uart = &usart1;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,can-primary = &can1;
zephyr,canbus = &can1;
};
leds {

View file

@ -16,7 +16,7 @@
zephyr,sram = &sram0;
zephyr,console = &scif1;
zephyr,shell-uart = &scif1;
zephyr,can-primary = &can0;
zephyr,canbus = &can0;
};
leds {

View file

@ -28,7 +28,7 @@
zephyr,console = &lpuart0;
zephyr,shell-uart = &lpuart0;
zephyr,uart-pipe = &lpuart0;
zephyr,can-primary = &flexcan0;
zephyr,canbus = &flexcan0;
};
leds {

View file

@ -17,7 +17,7 @@
zephyr,shell-uart = &usart1;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,can-primary = &can1;
zephyr,canbus = &can1;
};
leds {

View file

@ -17,7 +17,7 @@
zephyr,shell-uart = &usart1;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,can-primary = &can1;
zephyr,canbus = &can1;
};
leds {

View file

@ -18,7 +18,7 @@
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,ccm = &ccm0;
zephyr,can-primary = &can2;
zephyr,canbus = &can2;
};
leds {

View file

@ -21,7 +21,7 @@
zephyr,itcm = &itcm;
zephyr,dtcm = &dtcm;
zephyr,console = &lpuart6; /* Teensy Pins 0(RX1) 1(TX1) */
zephyr,can-primary = &flexcan1; /* Teensy Pins 23(CRX1) 22(CTX1) */
zephyr,canbus = &flexcan1; /* Teensy Pins 23(CRX1) 22(CTX1) */
};
leds {

View file

@ -40,7 +40,7 @@
zephyr,console = &lpuart0;
zephyr,shell-uart = &lpuart0;
zephyr,uart-pipe = &lpuart0;
zephyr,can-primary = &flexcan0;
zephyr,canbus = &flexcan0;
};
leds {

View file

@ -17,7 +17,7 @@
zephyr,shell-uart = &usart1;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,can-primary = &can1;
zephyr,canbus = &can1;
};
leds {

View file

@ -28,6 +28,6 @@
/ {
chosen {
zephyr,can-primary = &can1;
zephyr,canbus = &can1;
};
};

View file

@ -341,8 +341,8 @@ device.
- Sets UART device used for the Bluetooth monitor logging
* - zephyr,bt-uart
- Sets UART device used by Bluetooth
* - zephyr,can-primary
- Sets the primary CAN controller
* - zephyr,canbus
- Sets the default CAN controller
* - zephyr,ccm
- Core-Coupled Memory node on some STM32 SoCs
* - zephyr,code-partition

View file

@ -380,7 +380,7 @@ static int net_can_init(const struct device *dev)
const struct device *can_dev;
struct net_can_context *ctx = dev->data;
can_dev = device_get_binding(DT_CHOSEN_ZEPHYR_CAN_PRIMARY_LABEL);
can_dev = device_get_binding(DT_CHOSEN_ZEPHYR_CANBUS_LABEL);
ctx->recv_filter_id = CAN_NET_FILTER_NOT_SET;
#ifdef CONFIG_NET_L2_CANBUS_ETH_TRANSLATOR
@ -390,7 +390,7 @@ static int net_can_init(const struct device *dev)
if (!can_dev) {
NET_ERR("Can't get binding to CAN device %s",
DT_CHOSEN_ZEPHYR_CAN_PRIMARY_LABEL);
DT_CHOSEN_ZEPHYR_CANBUS_LABEL);
return -EIO;
}

View file

@ -46,12 +46,12 @@
#define DT_CHOSEN_ZEPHYR_FLASH_CONTROLLER_LABEL ""
/**
* @def DT_CHOSEN_ZEPHYR_CAN_PRIMARY_LABEL
* @def DT_CHOSEN_ZEPHYR_CANBUS_LABEL
*
* @brief If there is a chosen node zephyr,can-primary property which has
* @brief If there is a chosen node zephyr,canbus property which has
* a label property, that property's value. Undefined otherwise.
*/
#define DT_CHOSEN_ZEPHYR_CAN_PRIMARY_LABEL ""
#define DT_CHOSEN_ZEPHYR_CANBUS_LABEL ""
#endif /* DT_DOXYGEN */
@ -64,9 +64,9 @@
DT_LABEL(DT_CHOSEN(zephyr_flash_controller))
#endif
#if DT_NODE_HAS_PROP(DT_CHOSEN(zephyr_can_primary), label)
#define DT_CHOSEN_ZEPHYR_CAN_PRIMARY_LABEL \
DT_LABEL(DT_CHOSEN(zephyr_can_primary))
#if DT_NODE_HAS_PROP(DT_CHOSEN(zephyr_canbus), label)
#define DT_CHOSEN_ZEPHYR_CANBUS_LABEL \
DT_LABEL(DT_CHOSEN(zephyr_canbus))
#endif
/**
* @}

View file

@ -25,7 +25,7 @@
K_THREAD_STACK_DEFINE(rx_thread_stack, RX_THREAD_STACK_SIZE);
K_THREAD_STACK_DEFINE(poll_state_stack, STATE_POLL_THREAD_STACK_SIZE);
const struct device *can_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_can_primary));
const struct device *can_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_canbus));
struct gpio_dt_spec led = GPIO_DT_SPEC_GET_OR(DT_ALIAS(led0), gpios, {0});
struct k_thread rx_thread_data;

View file

@ -15,9 +15,9 @@
LOG_MODULE_REGISTER(app);
#define CAN_INTERFACE DT_CHOSEN_ZEPHYR_CAN_PRIMARY_LABEL
#define CAN_BITRATE (DT_PROP(DT_CHOSEN(zephyr_can_primary), bus_speed) / 1000)
#if !defined(DT_CHOSEN_ZEPHYR_CAN_PRIMARY_LABEL)
#define CAN_INTERFACE DT_CHOSEN_ZEPHYR_CANBUS_LABEL
#define CAN_BITRATE (DT_PROP(DT_CHOSEN(zephyr_canbus), bus_speed) / 1000)
#if !defined(DT_CHOSEN_ZEPHYR_CANBUS_LABEL)
#error CANopen CAN interface not set
#endif

View file

@ -148,7 +148,7 @@ void main(void)
static struct isotp_send_ctx send_ctx_0_5;
int ret = 0;
can_dev = device_get_binding(DT_CHOSEN_ZEPHYR_CAN_PRIMARY_LABEL);
can_dev = device_get_binding(DT_CHOSEN_ZEPHYR_CANBUS_LABEL);
if (!can_dev) {
printk("CAN: Device driver not found.\n");
return;

View file

@ -48,7 +48,7 @@
#if defined(CONFIG_CAN_LOOPBACK_DEV_NAME)
#define CAN_DEVICE_NAME CONFIG_CAN_LOOPBACK_DEV_NAME
#else
#define CAN_DEVICE_NAME DT_CHOSEN_ZEPHYR_CAN_PRIMARY_LABEL
#define CAN_DEVICE_NAME DT_CHOSEN_ZEPHYR_CANBUS_LABEL
#endif
CAN_DEFINE_MSGQ(can_msgq, 5);

View file

@ -32,7 +32,7 @@
#if defined(CONFIG_CAN_LOOPBACK_DEV_NAME)
#define CAN_DEVICE_NAME CONFIG_CAN_LOOPBACK_DEV_NAME
#else
#define CAN_DEVICE_NAME DT_CHOSEN_ZEPHYR_CAN_PRIMARY_LABEL
#define CAN_DEVICE_NAME DT_CHOSEN_ZEPHYR_CANBUS_LABEL
#endif
CAN_DEFINE_MSGQ(can_msgq, 5);

View file

@ -125,7 +125,7 @@ static void test_filter_handling(void)
int ret, filter_id_1, filter_id_2;
struct zcan_frame msg_buffer;
can_dev = device_get_binding(DT_CHOSEN_ZEPHYR_CAN_PRIMARY_LABEL);
can_dev = device_get_binding(DT_CHOSEN_ZEPHYR_CANBUS_LABEL);
ret = can_set_mode(can_dev, CAN_LOOPBACK_MODE);

View file

@ -25,7 +25,7 @@
#if defined(CONFIG_CAN_LOOPBACK_DEV_NAME)
#define CAN_DEVICE_NAME CONFIG_CAN_LOOPBACK_DEV_NAME
#else
#define CAN_DEVICE_NAME DT_CHOSEN_ZEPHYR_CAN_PRIMARY_LABEL
#define CAN_DEVICE_NAME DT_CHOSEN_ZEPHYR_CANBUS_LABEL
#endif
const struct device *can_dev;

View file

@ -52,7 +52,7 @@
#if defined(CONFIG_CAN_LOOPBACK_DEV_NAME)
#define CAN_DEVICE_NAME CONFIG_CAN_LOOPBACK_DEV_NAME
#else
#define CAN_DEVICE_NAME DT_CHOSEN_ZEPHYR_CAN_PRIMARY_LABEL
#define CAN_DEVICE_NAME DT_CHOSEN_ZEPHYR_CANBUS_LABEL
#endif
/*

View file

@ -15,7 +15,7 @@
#if defined(CONFIG_CAN_LOOPBACK_DEV_NAME)
#define CAN_DEVICE_NAME CONFIG_CAN_LOOPBACK_DEV_NAME
#else
#define CAN_DEVICE_NAME DT_CHOSEN_ZEPHYR_CAN_PRIMARY_LABEL
#define CAN_DEVICE_NAME DT_CHOSEN_ZEPHYR_CANBUS_LABEL
#endif
/*