Commit aae32b78 authored by Hussein Alasadi's avatar Hussein Alasadi Committed by Marc Kleine-Budde

can: m_can: m_can_set_bittiming(): fix setting M_CAN_DBTP register

This patch fixes the setting of the M_CAN_DBTP register contents:
- use DBTP_ (the data bitrate macros) instead of NBTP_ which area used
  for the nominal bitrate
- do not overwrite possibly-existing DBTP_TDC flag by ORing reg_btp
  instead of overwriting

Link: https://lore.kernel.org/r/FRYP281MB06140984ABD9994C0AAF7433D1F69@FRYP281MB0614.DEUP281.PROD.OUTLOOK.COM
Fixes: 20779943 ("can: m_can: use bits.h macros for all regmasks")
Cc: Torin Cooper-Bennun <torin@maxiluxsystems.com>
Cc: Chandrasekar Ramakrishnan <rcsekar@samsung.com>
Signed-off-by: default avatarHussein Alasadi <alasadi@arecs.eu>
[mkl: update patch description, update indention]
Signed-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 7b637cd5
...@@ -1164,10 +1164,10 @@ static int m_can_set_bittiming(struct net_device *dev) ...@@ -1164,10 +1164,10 @@ static int m_can_set_bittiming(struct net_device *dev)
FIELD_PREP(TDCR_TDCO_MASK, tdco)); FIELD_PREP(TDCR_TDCO_MASK, tdco));
} }
reg_btp = FIELD_PREP(NBTP_NBRP_MASK, brp) | reg_btp |= FIELD_PREP(DBTP_DBRP_MASK, brp) |
FIELD_PREP(NBTP_NSJW_MASK, sjw) | FIELD_PREP(DBTP_DSJW_MASK, sjw) |
FIELD_PREP(NBTP_NTSEG1_MASK, tseg1) | FIELD_PREP(DBTP_DTSEG1_MASK, tseg1) |
FIELD_PREP(NBTP_NTSEG2_MASK, tseg2); FIELD_PREP(DBTP_DTSEG2_MASK, tseg2);
m_can_write(cdev, M_CAN_DBTP, reg_btp); m_can_write(cdev, M_CAN_DBTP, reg_btp);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment