diff --git a/doc/releases/migration-guide-3.7.rst b/doc/releases/migration-guide-3.7.rst index 88e148aa8ea0..282822b3796e 100644 --- a/doc/releases/migration-guide-3.7.rst +++ b/doc/releases/migration-guide-3.7.rst @@ -45,6 +45,19 @@ Bluetooth HCI Controller Area Network (CAN) ============================= +* 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``, + and ``sample-point-data`` devicetree properties for specifying the initial CAN bitrate: + + * ``sjw`` + * ``prop-seg`` + * ``phase-seg1`` + * ``phase-seg1`` + * ``sjw-data`` + * ``prop-seg-data`` + * ``phase-seg1-data`` + * ``phase-seg1-data`` + Display ======= diff --git a/drivers/can/can_mcan.c b/drivers/can/can_mcan.c index 93e370201c8b..df77962232c8 100644 --- a/drivers/can/can_mcan.c +++ b/drivers/can/can_mcan.c @@ -1457,46 +1457,25 @@ int can_mcan_init(const struct device *dev) return err; } - if (config->common.sample_point) { - err = can_calc_timing(dev, &timing, config->common.bus_speed, - config->common.sample_point); - if (err == -EINVAL) { - LOG_ERR("Can't find timing for given param"); - return -EIO; - } - LOG_DBG("Presc: %d, TS1: %d, TS2: %d", timing.prescaler, timing.phase_seg1, - timing.phase_seg2); - LOG_DBG("Sample-point err : %d", err); - } else if (config->prop_ts1) { - timing.sjw = config->sjw; - timing.prop_seg = 0U; - timing.phase_seg1 = config->prop_ts1; - timing.phase_seg2 = config->ts2; - err = can_calc_prescaler(dev, &timing, config->common.bus_speed); - if (err != 0) { - LOG_WRN("Bitrate error: %d", err); - } + err = can_calc_timing(dev, &timing, config->common.bus_speed, + config->common.sample_point); + if (err == -EINVAL) { + LOG_ERR("Can't find timing for given param"); + return -EIO; } -#ifdef CONFIG_CAN_FD_MODE - if (config->common.sample_point_data) { - err = can_calc_timing_data(dev, &timing_data, config->common.bus_speed_data, - config->common.sample_point_data); - if (err == -EINVAL) { - LOG_ERR("Can't find timing for given dataphase param"); - return -EIO; - } - LOG_DBG("Sample-point err data phase: %d", err); - } else if (config->prop_ts1_data) { - timing_data.sjw = config->sjw_data; - timing_data.prop_seg = 0U; - timing_data.phase_seg1 = config->prop_ts1_data; - timing_data.phase_seg2 = config->ts2_data; - err = can_calc_prescaler(dev, &timing_data, config->common.bus_speed_data); - if (err != 0) { - LOG_WRN("Dataphase bitrate error: %d", err); - } + LOG_DBG("Presc: %d, TS1: %d, TS2: %d", timing.prescaler, timing.phase_seg1, + timing.phase_seg2); + LOG_DBG("Sample-point err : %d", err); +#ifdef CONFIG_CAN_FD_MODE + err = can_calc_timing_data(dev, &timing_data, config->common.bus_speed_data, + config->common.sample_point_data); + if (err == -EINVAL) { + LOG_ERR("Can't find timing for given dataphase param"); + return -EIO; } + + LOG_DBG("Sample-point err data phase: %d", err); #endif /* CONFIG_CAN_FD_MODE */ err = can_set_timing(dev, &timing); diff --git a/drivers/can/can_mcp2515.c b/drivers/can/can_mcp2515.c index 750273fc7154..13693f69c774 100644 --- a/drivers/can/can_mcp2515.c +++ b/drivers/can/can_mcp2515.c @@ -17,23 +17,6 @@ LOG_MODULE_REGISTER(can_mcp2515, CONFIG_CAN_LOG_LEVEL); #include "can_mcp2515.h" -#define SP_IS_SET(inst) DT_INST_NODE_HAS_PROP(inst, sample_point) || - -/* Macro to exclude the sample point algorithm from compilation if not used - * Without the macro, the algorithm would always waste ROM - */ -#define USE_SP_ALGO (DT_INST_FOREACH_STATUS_OKAY(SP_IS_SET) 0) - -#define SP_AND_TIMING_NOT_SET(inst) \ - (!DT_INST_NODE_HAS_PROP(inst, sample_point) && \ - !(DT_INST_NODE_HAS_PROP(inst, prop_seg) && \ - DT_INST_NODE_HAS_PROP(inst, phase_seg1) && \ - DT_INST_NODE_HAS_PROP(inst, phase_seg2))) || - -#if DT_INST_FOREACH_STATUS_OKAY(SP_AND_TIMING_NOT_SET) 0 -#error You must either set a sampling-point or timings (phase-seg* and prop-seg) -#endif - /* Timeout for changing mode */ #define MCP2515_MODE_CHANGE_TIMEOUT_USEC 1000 #define MCP2515_MODE_CHANGE_RETRIES 100 @@ -1009,27 +992,17 @@ static int mcp2515_init(const struct device *dev) (void)memset(dev_data->filter, 0, sizeof(dev_data->filter)); dev_data->old_state = CAN_STATE_ERROR_ACTIVE; - if (dev_cfg->common.sample_point && USE_SP_ALGO) { - ret = can_calc_timing(dev, &timing, dev_cfg->common.bus_speed, - dev_cfg->common.sample_point); - if (ret == -EINVAL) { - LOG_ERR("Can't find timing for given param"); - return -EIO; - } - LOG_DBG("Presc: %d, BS1: %d, BS2: %d", - timing.prescaler, timing.phase_seg1, timing.phase_seg2); - LOG_DBG("Sample-point err : %d", ret); - } else { - timing.sjw = dev_cfg->tq_sjw; - timing.prop_seg = dev_cfg->tq_prop; - timing.phase_seg1 = dev_cfg->tq_bs1; - timing.phase_seg2 = dev_cfg->tq_bs2; - ret = can_calc_prescaler(dev, &timing, dev_cfg->common.bus_speed); - if (ret) { - LOG_WRN("Bitrate error: %d", ret); - } + ret = can_calc_timing(dev, &timing, dev_cfg->common.bus_speed, + dev_cfg->common.sample_point); + if (ret == -EINVAL) { + LOG_ERR("Can't find timing for given param"); + return -EIO; } + LOG_DBG("Presc: %d, BS1: %d, BS2: %d", + timing.prescaler, timing.phase_seg1, timing.phase_seg2); + LOG_DBG("Sample-point err : %d", ret); + k_usleep(MCP2515_OSC_STARTUP_US); ret = can_set_timing(dev, &timing); @@ -1058,14 +1031,10 @@ static int mcp2515_init(const struct device *dev) .int_gpio = GPIO_DT_SPEC_INST_GET(inst, int_gpios), \ .int_thread_stack_size = CONFIG_CAN_MCP2515_INT_THREAD_STACK_SIZE, \ .int_thread_priority = CONFIG_CAN_MCP2515_INT_THREAD_PRIO, \ - .tq_sjw = DT_INST_PROP(inst, sjw), \ - .tq_prop = DT_INST_PROP_OR(inst, prop_seg, 0), \ - .tq_bs1 = DT_INST_PROP_OR(inst, phase_seg1, 0), \ - .tq_bs2 = DT_INST_PROP_OR(inst, phase_seg2, 0), \ .osc_freq = DT_INST_PROP(inst, osc_freq), \ }; \ \ - CAN_DEVICE_DT_INST_DEFINE(inst, mcp2515_init, NULL, &mcp2515_data_##inst, \ + CAN_DEVICE_DT_INST_DEFINE(inst, mcp2515_init, NULL, &mcp2515_data_##inst, \ &mcp2515_config_##inst, POST_KERNEL, CONFIG_CAN_INIT_PRIORITY, \ &can_api_funcs); diff --git a/drivers/can/can_mcp2515.h b/drivers/can/can_mcp2515.h index 2582e19daa3c..f242e7238936 100644 --- a/drivers/can/can_mcp2515.h +++ b/drivers/can/can_mcp2515.h @@ -59,10 +59,6 @@ struct mcp2515_config { int int_thread_priority; /* CAN timing */ - uint8_t tq_sjw; - uint8_t tq_prop; - uint8_t tq_bs1; - uint8_t tq_bs2; uint32_t osc_freq; }; diff --git a/drivers/can/can_mcp251xfd.c b/drivers/can/can_mcp251xfd.c index 81d2820f1f74..97e16bf0652d 100644 --- a/drivers/can/can_mcp251xfd.c +++ b/drivers/can/can_mcp251xfd.c @@ -19,14 +19,6 @@ #include LOG_MODULE_REGISTER(can_mcp251xfd, CONFIG_CAN_LOG_LEVEL); -#define SP_IS_SET(inst) DT_INST_NODE_HAS_PROP(inst, sample_point) || - -/* - * Macro to exclude the sample point algorithm from compilation if not used - * Without the macro, the algorithm would always waste ROM - */ -#define USE_SP_ALGO (DT_INST_FOREACH_STATUS_OKAY(SP_IS_SET) 0) - static void mcp251xfd_canframe_to_txobj(const struct can_frame *src, int mailbox_idx, struct mcp251xfd_txobj *dst) { @@ -1296,68 +1288,6 @@ static void mcp251xfd_tef_fifo_handler(const struct device *dev, void *data) k_sem_give(&dev_data->tx_sem); } -#if defined(CONFIG_CAN_FD_MODE) -static int mcp251xfd_init_timing_struct_data(struct can_timing *timing, - const struct device *dev, - const struct mcp251xfd_timing_params *timing_params) -{ - const struct mcp251xfd_config *dev_cfg = dev->config; - int ret; - - if (USE_SP_ALGO && dev_cfg->common.sample_point_data > 0) { - ret = can_calc_timing_data(dev, timing, dev_cfg->common.bus_speed_data, - dev_cfg->common.sample_point_data); - if (ret < 0) { - return ret; - } - LOG_DBG("Data phase Presc: %d, BS1: %d, BS2: %d", timing->prescaler, - timing->phase_seg1, timing->phase_seg2); - LOG_DBG("Data phase Sample-point err : %d", ret); - } else { - timing->sjw = timing_params->sjw; - timing->prop_seg = timing_params->prop_seg; - timing->phase_seg1 = timing_params->phase_seg1; - timing->phase_seg2 = timing_params->phase_seg2; - ret = can_calc_prescaler(dev, timing, dev_cfg->common.bus_speed_data); - if (ret > 0) { - LOG_WRN("Data phase Bitrate error: %d", ret); - } - } - - return ret; -} -#endif - -static int mcp251xfd_init_timing_struct(struct can_timing *timing, - const struct device *dev, - const struct mcp251xfd_timing_params *timing_params) -{ - const struct mcp251xfd_config *dev_cfg = dev->config; - int ret; - - if (USE_SP_ALGO && dev_cfg->common.sample_point > 0) { - ret = can_calc_timing(dev, timing, dev_cfg->common.bus_speed, - dev_cfg->common.sample_point); - if (ret < 0) { - return ret; - } - LOG_DBG("Presc: %d, BS1: %d, BS2: %d", timing->prescaler, timing->phase_seg1, - timing->phase_seg2); - LOG_DBG("Sample-point err : %d", ret); - } else { - timing->sjw = timing_params->sjw; - timing->prop_seg = timing_params->prop_seg; - timing->phase_seg1 = timing_params->phase_seg1; - timing->phase_seg2 = timing_params->phase_seg2; - ret = can_calc_prescaler(dev, timing, dev_cfg->common.bus_speed); - if (ret > 0) { - LOG_WRN("Bitrate error: %d", ret); - } - } - - return ret; -} - static inline int mcp251xfd_init_con_reg(const struct device *dev) { uint32_t *reg; @@ -1593,18 +1523,28 @@ static int mcp251xfd_init(const struct device *dev) goto done; } - ret = mcp251xfd_init_timing_struct(&timing, dev, &dev_cfg->timing_params); + ret = can_calc_timing(dev, &timing, dev_cfg->common.bus_speed, + dev_cfg->common.sample_point); if (ret < 0) { LOG_ERR("Can't find timing for given param"); goto done; } + LOG_DBG("Presc: %d, BS1: %d, BS2: %d", timing.prescaler, timing.phase_seg1, + timing.phase_seg2); + LOG_DBG("Sample-point err : %d", ret); + #if defined(CONFIG_CAN_FD_MODE) - ret = mcp251xfd_init_timing_struct_data(&timing_data, dev, &dev_cfg->timing_params_data); + ret = can_calc_timing_data(dev, &timing_data, dev_cfg->common.bus_speed_data, + dev_cfg->common.sample_point_data); if (ret < 0) { LOG_ERR("Can't find data timing for given param"); goto done; } + + LOG_DBG("Data phase Presc: %d, BS1: %d, BS2: %d", timing_data.prescaler, + timing_data.phase_seg1, timing_data.phase_seg2); + LOG_DBG("Data phase Sample-point err : %d", ret); #endif reg = mcp251xfd_read_crc(dev, MCP251XFD_REG_CON, MCP251XFD_REG_SIZE); @@ -1745,23 +1685,6 @@ static const struct can_driver_api mcp251xfd_api_funcs = { #endif }; -#define MCP251XFD_SET_TIMING_MACRO(inst, type) \ - .timing_params##type = { \ - .sjw = DT_INST_PROP(inst, sjw##type), \ - .prop_seg = DT_INST_PROP_OR(inst, prop_seg##type, 0), \ - .phase_seg1 = DT_INST_PROP_OR(inst, phase_seg1##type, 0), \ - .phase_seg2 = DT_INST_PROP_OR(inst, phase_seg2##type, 0), \ - } - -#if defined(CONFIG_CAN_FD_MODE) -#define MCP251XFD_SET_TIMING(inst) \ - MCP251XFD_SET_TIMING_MACRO(inst,), \ - MCP251XFD_SET_TIMING_MACRO(inst, _data) -#else -#define MCP251XFD_SET_TIMING(inst) \ - MCP251XFD_SET_TIMING_MACRO(inst,) -#endif - #define MCP251XFD_SET_CLOCK(inst) \ COND_CODE_1(DT_INST_NODE_HAS_PROP(inst, clocks), \ (.clk_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(inst)), \ @@ -1786,7 +1709,7 @@ static const struct can_driver_api mcp251xfd_api_funcs = { .timestamp_prescaler = DT_INST_PROP(inst, timestamp_prescaler), \ \ .osc_freq = DT_INST_PROP(inst, osc_freq), \ - MCP251XFD_SET_TIMING(inst), \ + \ .rx_fifo = {.ram_start_addr = MCP251XFD_RX_FIFO_START_ADDR, \ .reg_fifocon_addr = MCP251XFD_REG_FIFOCON(MCP251XFD_RX_FIFO_IDX), \ .capacity = MCP251XFD_RX_FIFO_ITEMS, \ diff --git a/drivers/can/can_mcp251xfd.h b/drivers/can/can_mcp251xfd.h index 475f91583c2b..0fb834746695 100644 --- a/drivers/can/can_mcp251xfd.h +++ b/drivers/can/can_mcp251xfd.h @@ -511,13 +511,6 @@ struct mcp251xfd_data { }; -struct mcp251xfd_timing_params { - uint8_t sjw; - uint8_t prop_seg; - uint8_t phase_seg1; - uint8_t phase_seg2; -}; - struct mcp251xfd_config { const struct can_driver_config common; @@ -534,12 +527,6 @@ struct mcp251xfd_config { uint16_t timestamp_prescaler; - /* CAN Timing */ - struct mcp251xfd_timing_params timing_params; -#if defined(CONFIG_CAN_FD_MODE) - struct mcp251xfd_timing_params timing_params_data; -#endif - const struct device *clk_dev; uint8_t clk_id; diff --git a/drivers/can/can_mcux_flexcan.c b/drivers/can/can_mcux_flexcan.c index cf09ef23ec7a..6f41e6dbb8b2 100644 --- a/drivers/can/can_mcux_flexcan.c +++ b/drivers/can/can_mcux_flexcan.c @@ -24,23 +24,6 @@ LOG_MODULE_REGISTER(can_mcux_flexcan, CONFIG_CAN_LOG_LEVEL); -#define SP_IS_SET(inst) DT_INST_NODE_HAS_PROP(inst, sample_point) || - -/* Macro to exclude the sample point algorithm from compilation if not used - * Without the macro, the algorithm would always waste ROM - */ -#define USE_SP_ALGO (DT_INST_FOREACH_STATUS_OKAY(SP_IS_SET) 0) - -#define SP_AND_TIMING_NOT_SET(inst) \ - (!DT_INST_NODE_HAS_PROP(inst, sample_point) && \ - !(DT_INST_NODE_HAS_PROP(inst, prop_seg) && \ - DT_INST_NODE_HAS_PROP(inst, phase_seg1) && \ - DT_INST_NODE_HAS_PROP(inst, phase_seg2))) || - -#if DT_INST_FOREACH_STATUS_OKAY(SP_AND_TIMING_NOT_SET) 0 -#error You must either set a sampling-point or timings (phase-seg* and prop-seg) -#endif - #if ((defined(FSL_FEATURE_FLEXCAN_HAS_ERRATA_5641) && FSL_FEATURE_FLEXCAN_HAS_ERRATA_5641) || \ (defined(FSL_FEATURE_FLEXCAN_HAS_ERRATA_5829) && FSL_FEATURE_FLEXCAN_HAS_ERRATA_5829)) /* the first valid MB should be occupied by ERRATA 5461 or 5829. */ @@ -90,16 +73,8 @@ struct mcux_flexcan_config { const struct device *clock_dev; clock_control_subsys_t clock_subsys; int clk_source; - uint32_t sjw; - uint32_t prop_seg; - uint32_t phase_seg1; - uint32_t phase_seg2; #ifdef CONFIG_CAN_MCUX_FLEXCAN_FD bool flexcan_fd; - uint32_t sjw_data; - uint32_t prop_seg_data; - uint32_t phase_seg1_data; - uint32_t phase_seg2_data; #endif /* CONFIG_CAN_MCUX_FLEXCAN_FD */ void (*irq_config_func)(const struct device *dev); void (*irq_enable_func)(void); @@ -1146,28 +1121,16 @@ static int mcux_flexcan_init(const struct device *dev) k_sem_init(&data->tx_allocs_sem, MCUX_FLEXCAN_MAX_TX, MCUX_FLEXCAN_MAX_TX); - data->timing.sjw = config->sjw; - if (config->common.sample_point && USE_SP_ALGO) { - err = can_calc_timing(dev, &data->timing, config->common.bus_speed, - config->common.sample_point); - if (err == -EINVAL) { - LOG_ERR("Can't find timing for given param"); - return -EIO; - } - LOG_DBG("Presc: %d, Seg1S1: %d, Seg2: %d", - data->timing.prescaler, data->timing.phase_seg1, - data->timing.phase_seg2); - LOG_DBG("Sample-point err : %d", err); - } else { - data->timing.sjw = config->sjw; - data->timing.prop_seg = config->prop_seg; - data->timing.phase_seg1 = config->phase_seg1; - data->timing.phase_seg2 = config->phase_seg2; - err = can_calc_prescaler(dev, &data->timing, config->common.bus_speed); - if (err) { - LOG_WRN("Bitrate error: %d", err); - } + err = can_calc_timing(dev, &data->timing, config->common.bus_speed, + config->common.sample_point); + if (err == -EINVAL) { + LOG_ERR("Can't find timing for given param"); + return -EIO; } + LOG_DBG("Presc: %d, Seg1S1: %d, Seg2: %d", + data->timing.prescaler, data->timing.phase_seg1, + data->timing.phase_seg2); + LOG_DBG("Sample-point err : %d", err); /* Validate initial timing parameters */ err = can_set_timing(dev, &data->timing); @@ -1178,39 +1141,25 @@ static int mcux_flexcan_init(const struct device *dev) #ifdef CONFIG_CAN_MCUX_FLEXCAN_FD if (config->flexcan_fd) { - data->timing_data.sjw = config->sjw_data; - if (config->common.sample_point_data && USE_SP_ALGO) { - err = can_calc_timing_data(dev, &data->timing_data, - config->common.bus_speed_data, - config->common.sample_point_data); - if (err == -EINVAL) { - LOG_ERR("Can't find timing for given param"); - return -EIO; - } - LOG_DBG("Presc: %d, Seg1S1: %d, Seg2: %d", - data->timing_data.prescaler, data->timing_data.phase_seg1, - data->timing_data.phase_seg2); - LOG_DBG("Sample-point err : %d", err); - } else { - data->timing_data.sjw = config->sjw_data; - data->timing_data.prop_seg = config->prop_seg_data; - data->timing_data.phase_seg1 = config->phase_seg1_data; - data->timing_data.phase_seg2 = config->phase_seg2_data; - err = can_calc_prescaler(dev, &data->timing_data, - config->common.bus_speed_data); - if (err) { - LOG_WRN("Bitrate error: %d", err); - } + err = can_calc_timing_data(dev, &data->timing_data, + config->common.bus_speed_data, + config->common.sample_point_data); + if (err == -EINVAL) { + LOG_ERR("Can't find timing for given param"); + return -EIO; } - } + LOG_DBG("Presc: %d, Seg1S1: %d, Seg2: %d", + data->timing_data.prescaler, data->timing_data.phase_seg1, + data->timing_data.phase_seg2); + LOG_DBG("Sample-point err : %d", err); - /* Validate initial data phase timing parameters */ - err = can_set_timing_data(dev, &data->timing_data); - if (err != 0) { - LOG_ERR("failed to set data phase timing (err %d)", err); - return -ENODEV; + /* Validate initial data phase timing parameters */ + err = can_set_timing_data(dev, &data->timing_data); + if (err != 0) { + LOG_ERR("failed to set data phase timing (err %d)", err); + return -ENODEV; + } } - #endif /* CONFIG_CAN_MCUX_FLEXCAN_FD */ err = pinctrl_apply_state(config->pincfg, PINCTRL_STATE_DEFAULT); @@ -1436,16 +1385,8 @@ static const struct can_driver_api mcux_flexcan_fd_driver_api = { .clock_subsys = (clock_control_subsys_t) \ DT_INST_CLOCKS_CELL(id, name), \ .clk_source = DT_INST_PROP(id, clk_source), \ - .sjw = DT_INST_PROP(id, sjw), \ - .prop_seg = DT_INST_PROP_OR(id, prop_seg, 0), \ - .phase_seg1 = DT_INST_PROP_OR(id, phase_seg1, 0), \ - .phase_seg2 = DT_INST_PROP_OR(id, phase_seg2, 0), \ IF_ENABLED(CONFIG_CAN_MCUX_FLEXCAN_FD, ( \ .flexcan_fd = DT_NODE_HAS_COMPAT(DT_DRV_INST(id), FLEXCAN_FD_DRV_COMPAT), \ - .sjw_data = DT_INST_PROP_OR(id, sjw_data, 0), \ - .prop_seg_data = DT_INST_PROP_OR(id, prop_seg_data, 0), \ - .phase_seg1_data = DT_INST_PROP_OR(id, phase_seg1_data, 0), \ - .phase_seg2_data = DT_INST_PROP_OR(id, phase_seg2_data, 0), \ )) \ .irq_config_func = mcux_flexcan_irq_config_##id, \ .irq_enable_func = mcux_flexcan_irq_enable_##id, \ diff --git a/drivers/can/can_nxp_s32_canxl.c b/drivers/can/can_nxp_s32_canxl.c index 2076429e2792..50464ac7a6a6 100644 --- a/drivers/can/can_nxp_s32_canxl.c +++ b/drivers/can/can_nxp_s32_canxl.c @@ -56,29 +56,6 @@ LOG_MODULE_REGISTER(nxp_s32_canxl, CONFIG_CAN_LOG_LEVEL); -#define SP_AND_TIMING_NOT_SET(inst) \ - (!DT_INST_NODE_HAS_PROP(inst, sample_point) && \ - !(DT_INST_NODE_HAS_PROP(inst, prop_seg) && \ - DT_INST_NODE_HAS_PROP(inst, phase_seg1) && \ - DT_INST_NODE_HAS_PROP(inst, phase_seg2))) || - -#if DT_INST_FOREACH_STATUS_OKAY(SP_AND_TIMING_NOT_SET) 0 -#error You must either set a sampling-point or timings (phase-seg* and prop-seg) -#endif - -#ifdef CAN_NXP_S32_FD_MODE - -#define SP_AND_TIMING_DATA_NOT_SET(inst) \ - (!DT_INST_NODE_HAS_PROP(inst, sample_point_data) && \ - !(DT_INST_NODE_HAS_PROP(inst, prop_seg_data) && \ - DT_INST_NODE_HAS_PROP(inst, phase_seg1_data) && \ - DT_INST_NODE_HAS_PROP(inst, phase_seg2_data))) || - -#if DT_INST_FOREACH_STATUS_OKAY(SP_AND_TIMING_DATA_NOT_SET) 0 -#error You must either set a sampling-point-data or timings (phase-seg-data* and prop-seg-data) -#endif -#endif - struct can_nxp_s32_config { const struct can_driver_config common; CANXL_SIC_Type *base_sic; @@ -91,16 +68,6 @@ struct can_nxp_s32_config { uint8 instance; const struct device *clock_dev; clock_control_subsys_t clock_subsys; - uint32_t sjw; - uint32_t prop_seg; - uint32_t phase_seg1; - uint32_t phase_seg2; -#ifdef CAN_NXP_S32_FD_MODE - uint32_t sjw_data; - uint32_t prop_seg_data; - uint32_t phase_seg1_data; - uint32_t phase_seg2_data; -#endif const struct pinctrl_dev_config *pin_cfg; Canexcel_Ip_ConfigType *can_cfg; void (*irq_config_func)(void); @@ -971,50 +938,30 @@ static int can_nxp_s32_init(const struct device *dev) IP_MC_RGM->PRST_0[0].PRST_0 &= ~(MC_RGM_PRST_0_PERIPH_16_RST_MASK | MC_RGM_PRST_0_PERIPH_24_RST_MASK); - data->timing.sjw = config->sjw; - if (config->common.sample_point) { - err = can_calc_timing(dev, &data->timing, config->common.bus_speed, - config->common.sample_point); - if (err == -EINVAL) { - LOG_ERR("Can't find timing for given param"); - return -EIO; - } - if (err > 0) { - LOG_WRN("Sample-point error : %d", err); - } - } else { - data->timing.prop_seg = config->prop_seg; - data->timing.phase_seg1 = config->phase_seg1; - data->timing.phase_seg2 = config->phase_seg2; - err = can_calc_prescaler(dev, &data->timing, config->common.bus_speed); - if (err) { - LOG_WRN("Bitrate error: %d", err); - } + err = can_calc_timing(dev, &data->timing, config->common.bus_speed, + config->common.sample_point); + if (err == -EINVAL) { + LOG_ERR("Can't find timing for given param"); + return -EIO; + } + + if (err > 0) { + LOG_WRN("Sample-point error : %d", err); } LOG_DBG("Setting CAN bitrate %d:", config->common.bus_speed); nxp_s32_zcan_timing_to_canxl_timing(&data->timing, &config->can_cfg->bitrate); #ifdef CAN_NXP_S32_FD_MODE - data->timing_data.sjw = config->sjw_data; - if (config->common.sample_point_data) { - err = can_calc_timing_data(dev, &data->timing_data, config->common.bus_speed_data, - config->common.sample_point_data); - if (err == -EINVAL) { - LOG_ERR("Can't find timing data for given param"); - return -EIO; - } - if (err > 0) { - LOG_WRN("Sample-point-data err : %d", err); - } - } else { - data->timing_data.prop_seg = config->prop_seg_data; - data->timing_data.phase_seg1 = config->phase_seg1_data; - data->timing_data.phase_seg2 = config->phase_seg2_data; - err = can_calc_prescaler(dev, &data->timing_data, config->common.bus_speed_data); - if (err) { - LOG_WRN("Bitrate data error: %d", err); - } + err = can_calc_timing_data(dev, &data->timing_data, config->common.bus_speed_data, + config->common.sample_point_data); + if (err == -EINVAL) { + LOG_ERR("Can't find timing data for given param"); + return -EIO; + } + + if (err > 0) { + LOG_WRN("Sample-point-data err : %d", err); } LOG_DBG("Setting CAN FD bitrate %d:", config->common.bus_speed_data); @@ -1150,14 +1097,8 @@ static const struct can_driver_api can_nxp_s32_driver_api = { } #if defined(CAN_NXP_S32_FD_MODE) -#define CAN_NXP_S32_TIMING_DATA_CONFIG(n) \ - .sjw_data = DT_INST_PROP(n, sjw_data), \ - .prop_seg_data = DT_INST_PROP_OR(n, prop_seg_data, 0), \ - .phase_seg1_data = DT_INST_PROP_OR(n, phase_seg1_data, 0), \ - .phase_seg2_data = DT_INST_PROP_OR(n, phase_seg2_data, 0), #define CAN_NXP_S32_BRS 1 #else -#define CAN_NXP_S32_TIMING_DATA_CONFIG(n) #define CAN_NXP_S32_BRS 0 #endif @@ -1234,11 +1175,6 @@ static const struct can_driver_api can_nxp_s32_driver_api = { .clock_dev = DEVICE_DT_GET(DT_INST_CLOCKS_CTLR(n)), \ .clock_subsys = (clock_control_subsys_t) \ DT_INST_CLOCKS_CELL(n, name), \ - .sjw = DT_INST_PROP(n, sjw), \ - .prop_seg = DT_INST_PROP_OR(n, prop_seg, 0), \ - .phase_seg1 = DT_INST_PROP_OR(n, phase_seg1, 0), \ - .phase_seg2 = DT_INST_PROP_OR(n, phase_seg2, 0), \ - CAN_NXP_S32_TIMING_DATA_CONFIG(n) \ .pin_cfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ .can_cfg = (Canexcel_Ip_ConfigType *)&can_nxp_s32_default_config##n, \ .irq_config_func = can_irq_config_##n \ diff --git a/drivers/can/can_rcar.c b/drivers/can/can_rcar.c index 55bbdb981d9d..8ed931c4d105 100644 --- a/drivers/can/can_rcar.c +++ b/drivers/can/can_rcar.c @@ -173,10 +173,6 @@ struct can_rcar_cfg { const struct device *clock_dev; struct rcar_cpg_clk mod_clk; struct rcar_cpg_clk bus_clk; - uint8_t sjw; - uint8_t prop_seg; - uint8_t phase_seg1; - uint8_t phase_seg2; const struct pinctrl_dev_config *pcfg; }; @@ -1059,27 +1055,17 @@ static int can_rcar_init(const struct device *dev) return ret; } - if (config->common.sample_point) { - ret = can_calc_timing(dev, &timing, config->common.bus_speed, - config->common.sample_point); - if (ret == -EINVAL) { - LOG_ERR("Can't find timing for given param"); - return -EIO; - } - LOG_DBG("Presc: %d, TS1: %d, TS2: %d", - timing.prescaler, timing.phase_seg1, timing.phase_seg2); - LOG_DBG("Sample-point err : %d", ret); - } else { - timing.sjw = config->sjw; - timing.prop_seg = config->prop_seg; - timing.phase_seg1 = config->phase_seg1; - timing.phase_seg2 = config->phase_seg2; - ret = can_calc_prescaler(dev, &timing, config->common.bus_speed); - if (ret) { - LOG_WRN("Bitrate error: %d", ret); - } + ret = can_calc_timing(dev, &timing, config->common.bus_speed, + config->common.sample_point); + if (ret == -EINVAL) { + LOG_ERR("Can't find timing for given param"); + return -EIO; } + LOG_DBG("Presc: %d, TS1: %d, TS2: %d", + timing.prescaler, timing.phase_seg1, timing.phase_seg2); + LOG_DBG("Sample-point err : %d", ret); + ret = can_set_timing(dev, &timing); if (ret) { return ret; @@ -1197,10 +1183,6 @@ static const struct can_driver_api can_rcar_driver_api = { .bus_clk.domain = \ DT_INST_CLOCKS_CELL_BY_IDX(n, 1, domain), \ .bus_clk.rate = 40000000, \ - .sjw = DT_INST_PROP(n, sjw), \ - .prop_seg = DT_INST_PROP_OR(n, prop_seg, 0), \ - .phase_seg1 = DT_INST_PROP_OR(n, phase_seg1, 0), \ - .phase_seg2 = DT_INST_PROP_OR(n, phase_seg2, 0), \ .pcfg = PINCTRL_DT_INST_DEV_CONFIG_GET(n), \ }; \ static struct can_rcar_data can_rcar_data_##n; \ diff --git a/drivers/can/can_sja1000.c b/drivers/can/can_sja1000.c index c764251f6284..39d823d0137d 100644 --- a/drivers/can/can_sja1000.c +++ b/drivers/can/can_sja1000.c @@ -770,27 +770,15 @@ int can_sja1000_init(const struct device *dev) can_sja1000_write_reg(dev, CAN_SJA1000_AMR2, 0xFF); can_sja1000_write_reg(dev, CAN_SJA1000_AMR3, 0xFF); - if (config->common.sample_point != 0) { - err = can_calc_timing(dev, &timing, config->common.bus_speed, - config->common.sample_point); - if (err == -EINVAL) { - LOG_ERR("bitrate/sample point cannot be met (err %d)", err); - return err; - } - - LOG_DBG("initial sample point error: %d", err); - } else { - timing.sjw = config->sjw; - timing.prop_seg = 0; - timing.phase_seg1 = config->phase_seg1; - timing.phase_seg2 = config->phase_seg2; - - err = can_calc_prescaler(dev, &timing, config->common.bus_speed); - if (err != 0) { - LOG_WRN("initial bitrate error: %d", err); - } + err = can_calc_timing(dev, &timing, config->common.bus_speed, + config->common.sample_point); + if (err == -EINVAL) { + LOG_ERR("bitrate/sample point cannot be met (err %d)", err); + return err; } + LOG_DBG("initial sample point error: %d", err); + /* Configure timing */ err = can_set_timing(dev, &timing); if (err != 0) { diff --git a/drivers/can/can_stm32_bxcan.c b/drivers/can/can_stm32_bxcan.c index 557079e2e3c7..7d8de00d4e6c 100644 --- a/drivers/can/can_stm32_bxcan.c +++ b/drivers/can/can_stm32_bxcan.c @@ -24,23 +24,6 @@ LOG_MODULE_REGISTER(can_stm32, CONFIG_CAN_LOG_LEVEL); #define DT_DRV_COMPAT st_stm32_bxcan -#define SP_IS_SET(inst) DT_INST_NODE_HAS_PROP(inst, sample_point) || - -/* Macro to exclude the sample point algorithm from compilation if not used - * Without the macro, the algorithm would always waste ROM - */ -#define USE_SP_ALGO (DT_INST_FOREACH_STATUS_OKAY(SP_IS_SET) 0) - -#define SP_AND_TIMING_NOT_SET(inst) \ - (!DT_INST_NODE_HAS_PROP(inst, sample_point) && \ - !(DT_INST_NODE_HAS_PROP(inst, prop_seg) && \ - DT_INST_NODE_HAS_PROP(inst, phase_seg1) && \ - DT_INST_NODE_HAS_PROP(inst, phase_seg2))) || - -#if DT_INST_FOREACH_STATUS_OKAY(SP_AND_TIMING_NOT_SET) 0 -#error You must either set a sampling-point or timings (phase-seg* and prop-seg) -#endif - #define CAN_STM32_NUM_FILTER_BANKS (14) #define CAN_STM32_MAX_FILTER_ID \ (CONFIG_CAN_MAX_EXT_ID_FILTER + CONFIG_CAN_MAX_STD_ID_FILTER * 2) @@ -82,9 +65,6 @@ struct can_stm32_config { const struct can_driver_config common; CAN_TypeDef *can; /*!< CAN Registers*/ CAN_TypeDef *master_can; /*!< CAN Registers for shared filter */ - uint8_t sjw; - uint8_t prop_ts1; - uint8_t ts2; struct stm32_pclken pclken; void (*config_irq)(CAN_TypeDef *can); const struct pinctrl_dev_config *pcfg; @@ -660,26 +640,15 @@ static int can_stm32_init(const struct device *dev) #ifdef CONFIG_CAN_AUTO_BUS_OFF_RECOVERY can->MCR |= CAN_MCR_ABOM; #endif - if (cfg->common.sample_point && USE_SP_ALGO) { - ret = can_calc_timing(dev, &timing, cfg->common.bus_speed, - cfg->common.sample_point); - if (ret == -EINVAL) { - LOG_ERR("Can't find timing for given param"); - return -EIO; - } - LOG_DBG("Presc: %d, TS1: %d, TS2: %d", - timing.prescaler, timing.phase_seg1, timing.phase_seg2); - LOG_DBG("Sample-point err : %d", ret); - } else { - timing.sjw = cfg->sjw; - timing.prop_seg = 0; - timing.phase_seg1 = cfg->prop_ts1; - timing.phase_seg2 = cfg->ts2; - ret = can_calc_prescaler(dev, &timing, cfg->common.bus_speed); - if (ret) { - LOG_WRN("Bitrate error: %d", ret); - } + ret = can_calc_timing(dev, &timing, cfg->common.bus_speed, + cfg->common.sample_point); + if (ret == -EINVAL) { + LOG_ERR("Can't find timing for given param"); + return -EIO; } + LOG_DBG("Presc: %d, TS1: %d, TS2: %d", + timing.prescaler, timing.phase_seg1, timing.phase_seg2); + LOG_DBG("Sample-point err : %d", ret); ret = can_set_timing(dev, &timing); if (ret) { @@ -1152,10 +1121,6 @@ static const struct can_stm32_config can_stm32_cfg_##inst = { \ .can = (CAN_TypeDef *)DT_INST_REG_ADDR(inst), \ .master_can = (CAN_TypeDef *)DT_INST_PROP_OR(inst, \ master_can_reg, DT_INST_REG_ADDR(inst)), \ - .sjw = DT_INST_PROP_OR(inst, sjw, 1), \ - .prop_ts1 = DT_INST_PROP_OR(inst, prop_seg, 0) + \ - DT_INST_PROP_OR(inst, phase_seg1, 0), \ - .ts2 = DT_INST_PROP_OR(inst, phase_seg2, 0), \ .pclken = { \ .enr = DT_INST_CLOCKS_CELL(inst, bits), \ .bus = DT_INST_CLOCKS_CELL(inst, bus), \ diff --git a/drivers/can/can_xmc4xxx.c b/drivers/can/can_xmc4xxx.c index b6c578595eae..b2b96bf2b3ce 100644 --- a/drivers/can/can_xmc4xxx.c +++ b/drivers/can/can_xmc4xxx.c @@ -19,14 +19,6 @@ #include LOG_MODULE_REGISTER(can_xmc4xxx, CONFIG_CAN_LOG_LEVEL); -#define SP_IS_SET(inst) DT_INST_NODE_HAS_PROP(inst, sample_point) || - -/* - * Macro to exclude the sample point algorithm from compilation if not used - * Without the macro, the algorithm would always waste ROM - */ -#define USE_SP_ALGO (DT_INST_FOREACH_STATUS_OKAY(SP_IS_SET) 0) - #define CAN_XMC4XXX_MULTICAN_NODE DT_INST(0, infineon_xmc4xxx_can) #define CAN_XMC4XXX_NUM_MESSAGE_OBJECTS DT_PROP(CAN_XMC4XXX_MULTICAN_NODE, message_objects) @@ -88,11 +80,6 @@ struct can_xmc4xxx_config { CAN_NODE_TypeDef *can; bool clock_div8; - uint8_t sjw; - uint8_t prop_seg; - uint8_t phase_seg1; - uint8_t phase_seg2; - uint8_t service_request; void (*irq_config_func)(void); @@ -812,34 +799,6 @@ static int can_xmc4xxx_stop(const struct device *dev) return 0; } -static int can_xmc4xxx_init_timing_struct(struct can_timing *timing, const struct device *dev) -{ - int ret; - const struct can_xmc4xxx_config *dev_cfg = dev->config; - - if (USE_SP_ALGO && dev_cfg->common.sample_point > 0) { - ret = can_calc_timing(dev, timing, dev_cfg->common.bus_speed, - dev_cfg->common.sample_point); - if (ret < 0) { - return ret; - } - LOG_DBG("Presc: %d, BS1: %d, BS2: %d", timing->prescaler, timing->phase_seg1, - timing->phase_seg2); - LOG_DBG("Sample-point err : %d", ret); - } else { - timing->sjw = dev_cfg->sjw; - timing->prop_seg = dev_cfg->prop_seg; - timing->phase_seg1 = dev_cfg->phase_seg1; - timing->phase_seg2 = dev_cfg->phase_seg2; - ret = can_calc_prescaler(dev, timing, dev_cfg->common.bus_speed); - if (ret > 0) { - LOG_WRN("Bitrate error: %d", ret); - } - } - - return ret; -} - static int can_xmc4xxx_init(const struct device *dev) { struct can_xmc4xxx_data *dev_data = dev->data; @@ -927,11 +886,16 @@ static int can_xmc4xxx_init(const struct device *dev) } #endif - ret = can_xmc4xxx_init_timing_struct(&timing, dev); + ret = can_calc_timing(dev, &timing, dev_cfg->common.bus_speed, + dev_cfg->common.sample_point); if (ret < 0) { return ret; } + LOG_DBG("Presc: %d, BS1: %d, BS2: %d", timing.prescaler, timing.phase_seg1, + timing.phase_seg2); + LOG_DBG("Sample-point err : %d", ret); + return can_set_timing(dev, &timing); } @@ -982,10 +946,6 @@ static const struct can_driver_api can_xmc4xxx_api_funcs = { .common = CAN_DT_DRIVER_CONFIG_INST_GET(inst, 1000000), \ .can = (CAN_NODE_TypeDef *)DT_INST_REG_ADDR(inst), \ .clock_div8 = DT_INST_PROP(inst, clock_div8), \ - .sjw = DT_INST_PROP(inst, sjw), \ - .prop_seg = DT_INST_PROP_OR(inst, prop_seg, 0), \ - .phase_seg1 = DT_INST_PROP_OR(inst, phase_seg1, 0), \ - .phase_seg2 = DT_INST_PROP_OR(inst, phase_seg2, 0), \ .irq_config_func = can_xmc4xxx_irq_config_##inst, \ .service_request = DT_INST_IRQN(inst) - CAN_XMC4XXX_IRQ_MIN, \ .input_src = DT_INST_ENUM_IDX(inst, input_src), \ diff --git a/dts/bindings/can/can-controller.yaml b/dts/bindings/can/can-controller.yaml index b2502dce1c37..6c5cbe822ae2 100644 --- a/dts/bindings/can/can-controller.yaml +++ b/dts/bindings/can/can-controller.yaml @@ -10,43 +10,9 @@ properties: Initial bitrate in bit/s. sample-point: type: int + required: true description: | Initial sample point in per mille (e.g. 875 equals 87.5%). - - This property is required unless the timing is specified using time quanta based properties - (`sjw`, `prop-seg`, `phase-seg1`, and `phase-seg2`). - - If this property is present, the time quanta based timing properties are ignored. - sjw: - type: int - deprecated: true - default: 1 - description: | - Initial time quanta of resynchronization jump width (ISO 11898-1). - - Deprecated in favor of automatic calculation of a suitable default SJW based on existing - timing parameters. Default of 1 matches the default value previously used for all in-tree CAN - controller devicetree instances. - - Applications can still manually set the SJW using the CAN timing APIs. - prop-seg: - type: int - deprecated: true - description: | - Initial time quanta of propagation segment (ISO 11898-1). Deprecated in favor of setting - advanced timing parameters from the application. - phase-seg1: - type: int - deprecated: true - description: | - Initial time quanta of phase buffer 1 segment (ISO 11898-1). Deprecated in favor of setting - advanced timing parameters from the application. - phase-seg2: - type: int - deprecated: true - description: | - Initial time quanta of phase buffer 2 segment (ISO 11898-1). Deprecated in favor of setting - advanced timing parameters from the application. phys: type: phandle description: | diff --git a/dts/bindings/can/can-fd-controller.yaml b/dts/bindings/can/can-fd-controller.yaml index 3882518d6262..cbef3b1ac9ee 100644 --- a/dts/bindings/can/can-fd-controller.yaml +++ b/dts/bindings/can/can-fd-controller.yaml @@ -10,43 +10,9 @@ properties: Initial data phase bitrate in bit/s. sample-point-data: type: int + required: true description: | Initial data phase sample point in per mille (e.g. 875 equals 87.5%). - - This property is required unless the timing is specified using time quanta based properties - (`sjw-data`, `prop-seg-data`, `phase-seg1-data`, and `phase-seg2-data`). - - If this property is present, the time quanta based timing properties are ignored. - sjw-data: - type: int - deprecated: true - default: 1 - description: | - Initial time quanta of resynchronization jump width for the data phase (ISO11898-1:2015). - - Deprecated in favor of automatic calculation of a suitable default SJW based on existing - timing parameters. Default of 1 matches the default value previously used for all in-tree CAN - controller devicetree instances. - - Applications can still manually set the SJW using the CAN timing APIs. - prop-seg-data: - type: int - deprecated: true - description: | - Initial time quanta of propagation segment for the data phase (ISO11898-1:2015). Deprecated in - favor of setting advanced timing parameters from the application. - phase-seg1-data: - type: int - deprecated: true - description: | - Initial time quanta of phase buffer 1 segment for the data phase (ISO11898-1:2015). Deprecated - in favor of setting advanced timing parameters from the application. - phase-seg2-data: - type: int - deprecated: true - description: | - Initial time quanta of phase buffer 2 segment for the data phase (ISO11898-1:2015). Deprecated - in favor of setting advanced timing parameters from the application. tx-delay-comp-offset: type: int default: 0 diff --git a/include/zephyr/drivers/can/can_mcan.h b/include/zephyr/drivers/can/can_mcan.h index a20f98648806..4df3754a2af8 100644 --- a/include/zephyr/drivers/can/can_mcan.h +++ b/include/zephyr/drivers/can/can_mcan.h @@ -1237,13 +1237,7 @@ struct can_mcan_config { uint16_t mram_elements[CAN_MCAN_MRAM_CFG_NUM_CELLS]; uint16_t mram_offsets[CAN_MCAN_MRAM_CFG_NUM_CELLS]; size_t mram_size; - uint16_t sjw; - uint16_t prop_ts1; - uint16_t ts2; #ifdef CONFIG_CAN_FD_MODE - uint8_t sjw_data; - uint8_t prop_ts1_data; - uint8_t ts2_data; uint8_t tx_delay_comp_offset; #endif const void *custom; @@ -1306,13 +1300,6 @@ struct can_mcan_config { .mram_elements = CAN_MCAN_DT_MRAM_ELEMENTS_GET(node_id), \ .mram_offsets = CAN_MCAN_DT_MRAM_OFFSETS_GET(node_id), \ .mram_size = CAN_MCAN_DT_MRAM_ELEMENTS_SIZE(node_id), \ - .sjw = DT_PROP(node_id, sjw), \ - .prop_ts1 = DT_PROP_OR(node_id, prop_seg, 0) + DT_PROP_OR(node_id, phase_seg1, 0), \ - .ts2 = DT_PROP_OR(node_id, phase_seg2, 0), \ - .sjw_data = DT_PROP(node_id, sjw_data), \ - .prop_ts1_data = DT_PROP_OR(node_id, prop_seg_data, 0) + \ - DT_PROP_OR(node_id, phase_seg1_data, 0), \ - .ts2_data = DT_PROP_OR(node_id, phase_seg2_data, 0), \ .tx_delay_comp_offset = DT_PROP(node_id, tx_delay_comp_offset), \ .custom = _custom, \ } @@ -1325,9 +1312,6 @@ struct can_mcan_config { .mram_elements = CAN_MCAN_DT_MRAM_ELEMENTS_GET(node_id), \ .mram_offsets = CAN_MCAN_DT_MRAM_OFFSETS_GET(node_id), \ .mram_size = CAN_MCAN_DT_MRAM_ELEMENTS_SIZE(node_id), \ - .sjw = DT_PROP(node_id, sjw), \ - .prop_ts1 = DT_PROP_OR(node_id, prop_seg, 0) + DT_PROP_OR(node_id, phase_seg1, 0), \ - .ts2 = DT_PROP_OR(node_id, phase_seg2, 0), \ .custom = _custom, \ } #endif /* !CONFIG_CAN_FD_MODE */ diff --git a/include/zephyr/drivers/can/can_sja1000.h b/include/zephyr/drivers/can/can_sja1000.h index a3a316c26b89..b4a3c5e4da22 100644 --- a/include/zephyr/drivers/can/can_sja1000.h +++ b/include/zephyr/drivers/can/can_sja1000.h @@ -105,9 +105,6 @@ struct can_sja1000_config { const struct can_driver_config common; can_sja1000_read_reg_t read_reg; can_sja1000_write_reg_t write_reg; - uint32_t sjw; - uint32_t phase_seg1; - uint32_t phase_seg2; uint8_t ocr; uint8_t cdr; const void *custom; @@ -128,9 +125,6 @@ struct can_sja1000_config { .common = CAN_DT_DRIVER_CONFIG_GET(node_id, 1000000), \ .read_reg = _read_reg, \ .write_reg = _write_reg, \ - .sjw = DT_PROP(node_id, sjw), \ - .phase_seg1 = DT_PROP_OR(node_id, phase_seg1, 0), \ - .phase_seg2 = DT_PROP_OR(node_id, phase_seg2, 0), \ .ocr = _ocr, \ .cdr = _cdr, \ .custom = _custom, \