can: rcar_canfd: Fix controller mode setting

Driver configures register to choose controller mode before
setting all channels to reset mode leading to failure.
The patch corrects operation of mode setting.

Signed-off-by: Duy Nguyen <duy.nguyen.rh@renesas.com>
Signed-off-by: Tranh Ha <tranh.ha.xb@renesas.com>
Link: https://patch.msgid.link/TYWPR01MB87434739F83E27EDCD23DF44B416A@TYWPR01MB8743.jpnprd01.prod.outlook.com
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
This commit is contained in:
Duy Nguyen 2025-09-18 07:03:45 +00:00 committed by Marc Kleine-Budde
parent 6b69680847
commit 5cff263606
1 changed files with 4 additions and 3 deletions

View File

@ -823,9 +823,6 @@ static int rcar_canfd_reset_controller(struct rcar_canfd_global *gpriv)
/* Reset Global error flags */ /* Reset Global error flags */
rcar_canfd_write(gpriv->base, RCANFD_GERFL, 0x0); rcar_canfd_write(gpriv->base, RCANFD_GERFL, 0x0);
/* Set the controller into appropriate mode */
rcar_canfd_set_mode(gpriv);
/* Transition all Channels to reset mode */ /* Transition all Channels to reset mode */
for_each_set_bit(ch, &gpriv->channels_mask, gpriv->info->max_channels) { for_each_set_bit(ch, &gpriv->channels_mask, gpriv->info->max_channels) {
rcar_canfd_clear_bit(gpriv->base, rcar_canfd_clear_bit(gpriv->base,
@ -844,6 +841,10 @@ static int rcar_canfd_reset_controller(struct rcar_canfd_global *gpriv)
return err; return err;
} }
} }
/* Set the controller into appropriate mode */
rcar_canfd_set_mode(gpriv);
return 0; return 0;
} }