From 6d2a42c21e34b10b76712540901975464083097d Mon Sep 17 00:00:00 2001 From: Henrik Brix Andersen Date: Tue, 30 May 2023 19:29:11 +0200 Subject: [PATCH] drivers: can: sam: use bosch m_can timing parameter initializers The minimum/maximum CAN timing parameters for the Atmel SAM CAN driver uses the wrong values for the minimum, nominal phase segment values. The same goes for the maximum, nominal SJW value. Using the static initializers fixes these and aligns them to both the Bosch M_CAN manual and the Atmel SAM E70 family data sheet. Fixes: #58429 Signed-off-by: Henrik Brix Andersen --- drivers/can/can_sam.c | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) diff --git a/drivers/can/can_sam.c b/drivers/can/can_sam.c index 5d0e04f3951..679ca41cd5f 100644 --- a/drivers/can/can_sam.c +++ b/drivers/can/can_sam.c @@ -134,36 +134,12 @@ static const struct can_driver_api can_sam_driver_api = { .get_max_filters = can_mcan_get_max_filters, .get_max_bitrate = can_mcan_get_max_bitrate, .set_state_change_callback = can_mcan_set_state_change_callback, - .timing_min = { - .sjw = 0x1, - .prop_seg = 0x00, - .phase_seg1 = 0x01, - .phase_seg2 = 0x01, - .prescaler = 0x01 - }, - .timing_max = { - .sjw = 0x7f, - .prop_seg = 0x00, - .phase_seg1 = 0x100, - .phase_seg2 = 0x80, - .prescaler = 0x200 - }, + .timing_min = CAN_MCAN_TIMING_MIN_INITIALIZER, + .timing_max = CAN_MCAN_TIMING_MAX_INITIALIZER, #ifdef CONFIG_CAN_FD_MODE .set_timing_data = can_mcan_set_timing_data, - .timing_data_min = { - .sjw = 0x01, - .prop_seg = 0x00, - .phase_seg1 = 0x01, - .phase_seg2 = 0x01, - .prescaler = 0x01 - }, - .timing_data_max = { - .sjw = 0x10, - .prop_seg = 0x00, - .phase_seg1 = 0x20, - .phase_seg2 = 0x10, - .prescaler = 0x20 - } + .timing_data_min = CAN_MCAN_TIMING_DATA_MIN_INITIALIZER, + .timing_data_max = CAN_MCAN_TIMING_DATA_MAX_INITIALIZER, #endif /* CONFIG_CAN_FD_MODE */ };