All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hussein Alasadi <alasadi@arecs.eu>
To: "mkl@pengutronix.de" <mkl@pengutronix.de>
Cc: "linux-can@vger.kernel.org" <linux-can@vger.kernel.org>
Subject: [PATCH] m_can: fixed typo in m_can_set_bittiming() causing corrupt DBTP register content
Date: Mon, 9 Aug 2021 17:36:52 +0000	[thread overview]
Message-ID: <FRYP281MB06140984ABD9994C0AAF7433D1F69@FRYP281MB0614.DEUP281.PROD.OUTLOOK.COM> (raw)

Hello everyone,

Fixed M_CAN_DBTP corrupt register contents:
* NBTP_xxx defines were being used instead of DBTP_xxx.
* reg_btp was not getting ORed with the possibly-existing DBTP_TDC flag.

------------------
Hussein Alasadi
ARECS GmbH


diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index 0cffaad905c2..f3809f4cfc7b 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -1168,10 +1168,10 @@ static int m_can_set_bittiming(struct net_device *dev)
                                    FIELD_PREP(TDCR_TDCO_MASK, tdco));
                }

-               reg_btp = FIELD_PREP(NBTP_NBRP_MASK, brp) |
-                         FIELD_PREP(NBTP_NSJW_MASK, sjw) |
-                         FIELD_PREP(NBTP_NTSEG1_MASK, tseg1) |
-                         FIELD_PREP(NBTP_NTSEG2_MASK, tseg2);
+               reg_btp |= FIELD_PREP(DBTP_DBRP_MASK, brp) |
+                         FIELD_PREP(DBTP_DSJW_MASK, sjw) |
+                         FIELD_PREP(DBTP_DTSEG1_MASK, tseg1) |
+                         FIELD_PREP(DBTP_DTSEG2_MASK, tseg2);

                m_can_write(cdev, M_CAN_DBTP, reg_btp);
        }

             reply	other threads:[~2021-08-09 17:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-09 17:36 Hussein Alasadi [this message]
2021-08-09 18:10 ` [PATCH] m_can: fixed typo in m_can_set_bittiming() causing corrupt DBTP register content Marc Kleine-Budde
2021-08-09 20:25   ` Hussein Alasadi
2021-08-10  6:14     ` Marc Kleine-Budde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=FRYP281MB06140984ABD9994C0AAF7433D1F69@FRYP281MB0614.DEUP281.PROD.OUTLOOK.COM \
    --to=alasadi@arecs.eu \
    --cc=linux-can@vger.kernel.org \
    --cc=mkl@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.