Netdev List
 help / color / mirror / Atom feed
From: Marc Kleine-Budde <mkl@pengutronix.de>
To: netdev@vger.kernel.org
Cc: davem@davemloft.net, linux-can@vger.kernel.org,
	kernel@pengutronix.de, Dong Aisheng <b29396@freescale.com>,
	Marc Kleine-Budde <mkl@pengutronix.de>
Subject: [PATCH 15/17] can: m_can: add missing delay after setting CCCR_INIT bit
Date: Tue, 18 Nov 2014 21:37:45 +0100	[thread overview]
Message-ID: <1416343067-9810-16-git-send-email-mkl@pengutronix.de> (raw)
In-Reply-To: <1416343067-9810-1-git-send-email-mkl@pengutronix.de>

From: Dong Aisheng <b29396@freescale.com>

The spec mentions there may be a delay until the value written to INIT can be
read back due to the synchronization mechanism between the two clock domains.
But it does not indicate the exact clock cycles needed. The 5us delay is a
test value and seems ok.

Without the delay, CCCR.CCE bit may fail to be set and then the initialization
fail sometimes when do repeatly up and down.

Signed-off-by: Dong Aisheng <b29396@freescale.com>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
---
 drivers/net/can/m_can/m_can.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/can/m_can/m_can.c b/drivers/net/can/m_can/m_can.c
index 98f7e0ea7f6a..3ad7d88720b7 100644
--- a/drivers/net/can/m_can/m_can.c
+++ b/drivers/net/can/m_can/m_can.c
@@ -296,6 +296,7 @@ static inline void m_can_config_endisable(const struct m_can_priv *priv,
 	if (enable) {
 		/* enable m_can configuration */
 		m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT);
+		udelay(5);
 		/* CCCR.CCE can only be set/reset while CCCR.INIT = '1' */
 		m_can_write(priv, M_CAN_CCCR, cccr | CCCR_INIT | CCCR_CCE);
 	} else {
-- 
2.1.3


  parent reply	other threads:[~2014-11-18 20:37 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-18 20:37 pull-request: can 2014-11-18 Marc Kleine-Budde
2014-11-18 20:37 ` [PATCH 01/17] can: dev: avoid calling kfree_skb() from interrupt context Marc Kleine-Budde
2014-11-18 20:37 ` [PATCH 02/17] can: dev: fix typo CIA -> CiA, CAN in Automation Marc Kleine-Budde
2014-11-18 20:37 ` [PATCH 03/17] can: dev: add can_is_canfd_skb() API Marc Kleine-Budde
2014-11-18 20:37 ` [PATCH 04/17] can: esd_usb2: fix memory leak on disconnect Marc Kleine-Budde
2014-11-18 20:37 ` [PATCH 05/17] can: remove unused variable Marc Kleine-Budde
2014-11-18 20:37 ` [PATCH 06/17] can: xilinx_can: fix comparison of unsigned variable Marc Kleine-Budde
2014-11-18 20:37 ` [PATCH 07/17] can: xilinx_can: add .ndo_change_mtu function Marc Kleine-Budde
2014-11-18 20:37 ` [PATCH 08/17] can: rcar_can: " Marc Kleine-Budde
2014-11-18 20:37 ` [PATCH 09/17] can: gs_usb: " Marc Kleine-Budde
2014-11-18 20:37 ` [PATCH 10/17] can: m_can: " Marc Kleine-Budde
2014-11-18 20:37 ` [PATCH 11/17] can: m_can: add CONFIG_HAS_IOMEM dependence Marc Kleine-Budde
2014-11-18 20:37 ` [PATCH 12/17] can: m_can: add missing message RAM initialization Marc Kleine-Budde
2014-11-18 20:37 ` [PATCH 13/17] can: m_can: fix possible sleep in napi poll Marc Kleine-Budde
2014-11-18 20:37 ` [PATCH 14/17] can: m_can: fix not set can_dlc for remote frame Marc Kleine-Budde
2014-11-18 20:37 ` Marc Kleine-Budde [this message]
2014-11-18 20:37 ` [PATCH 16/17] can: m_can: fix incorrect error messages Marc Kleine-Budde
2014-11-18 20:37 ` [PATCH 17/17] can: m_can: update to support CAN FD features Marc Kleine-Budde
2014-11-19 20:29 ` pull-request: can 2014-11-18 David Miller

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=1416343067-9810-16-git-send-email-mkl@pengutronix.de \
    --to=mkl@pengutronix.de \
    --cc=b29396@freescale.com \
    --cc=davem@davemloft.net \
    --cc=kernel@pengutronix.de \
    --cc=linux-can@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox