Skip to content

Commit bd87dbc

Browse files
thenguyenyfkartben
authored andcommitted
driver: can: renesas: remove first can bus starting at init
Remove can bus starting at initial function Signed-off-by: The Nguyen <the.nguyen.yf@renesas.com>
1 parent 990b000 commit bd87dbc

File tree

1 file changed

+6
-20
lines changed

1 file changed

+6
-20
lines changed

drivers/can/can_renesas_ra.c

Lines changed: 6 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -451,10 +451,12 @@ static int can_renesas_ra_start(const struct device *dev)
451451
? &data->data_timing
452452
: &classic_can_data_timing_default);
453453

454-
if (FSP_SUCCESS != can_api->close(data->fsp_can.p_ctrl)) {
455-
LOG_DBG("CAN close failed");
456-
ret = -EIO;
457-
goto end;
454+
if (data->fsp_canfd_ctrl.open != 0) {
455+
if (FSP_SUCCESS != can_api->close(data->fsp_can.p_ctrl)) {
456+
LOG_DBG("CAN close failed");
457+
ret = -EIO;
458+
goto end;
459+
}
458460
}
459461

460462
if (FSP_SUCCESS != can_api->open(data->fsp_can.p_ctrl, data->fsp_can.p_cfg)) {
@@ -955,7 +957,6 @@ static int can_renesas_ra_init(const struct device *dev)
955957
{
956958
const struct can_renesas_ra_cfg *cfg = dev->config;
957959
struct can_renesas_ra_data *data = dev->data;
958-
const can_api_t *can_api = data->fsp_can.p_api;
959960
int ret = 0;
960961

961962
if (!device_is_ready(cfg->global_dev)) {
@@ -988,21 +989,6 @@ static int can_renesas_ra_init(const struct device *dev)
988989

989990
cfg->irq_configure();
990991

991-
ret = can_api->open(data->fsp_can.p_ctrl, data->fsp_can.p_cfg);
992-
if (ret != FSP_SUCCESS) {
993-
LOG_DBG("CAN bus initialize failed");
994-
return -EIO;
995-
}
996-
997-
/* Put CAN controller into stopped state */
998-
ret = can_api->modeTransition(data->fsp_can.p_ctrl, CAN_OPERATION_MODE_HALT,
999-
CAN_TEST_MODE_DISABLED);
1000-
if (ret != FSP_SUCCESS) {
1001-
can_api->close(data->fsp_can.p_ctrl);
1002-
LOG_DBG("CAN bus initialize failed");
1003-
return -EIO;
1004-
}
1005-
1006992
return 0;
1007993
}
1008994

0 commit comments

Comments
 (0)