drivers/can/rcar: Add delay to mode switching
Fix issue #45168. When setting high bit timing, the controller is timing out when trying to switch from an internal mode to another. To fix this issue, we add some delay when switching modes. Signed-off-by: Aymeric Aillet <aymeric.aillet@iot.bzh>
This commit is contained in:
parent
f2a039e8bb
commit
b6701c0c45
1 changed files with 7 additions and 0 deletions
|
@ -530,6 +530,10 @@ static int can_rcar_enter_halt_mode(const struct can_rcar_cfg *config)
|
|||
ctlr &= ~RCAR_CAN_CTLR_CANM_MASK;
|
||||
ctlr |= RCAR_CAN_CTLR_CANM_HALT;
|
||||
can_rcar_write16(config, RCAR_CAN_CTLR, ctlr);
|
||||
|
||||
/* Wait for controller to apply high bit timing settings */
|
||||
k_usleep(1);
|
||||
|
||||
for (i = 0; i < MAX_STR_READS; i++) {
|
||||
if (can_rcar_read16(config, RCAR_CAN_STR) & RCAR_CAN_STR_HLTST) {
|
||||
return 0;
|
||||
|
@ -548,6 +552,9 @@ static int can_rcar_enter_operation_mode(const struct can_rcar_cfg *config)
|
|||
ctlr &= ~RCAR_CAN_CTLR_CANM_MASK;
|
||||
can_rcar_write16(config, RCAR_CAN_CTLR, ctlr);
|
||||
|
||||
/* Wait for controller to apply high bit timing settings */
|
||||
k_usleep(1);
|
||||
|
||||
for (i = 0; i < MAX_STR_READS; i++) {
|
||||
str = can_rcar_read16(config, RCAR_CAN_STR);
|
||||
if (!(str & RCAR_CAN_CTLR_CANM_MASK)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue