Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2249890ybd; Mon, 24 Jun 2019 03:17:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqx+fFhW5R5H5+uqQXHMOh0T453fJmXVGIPT7dgorMhscIImM+vNl1iaK+Yb2ynTk8A5Qywh X-Received: by 2002:a17:902:7448:: with SMTP id e8mr138401547plt.222.1561371473703; Mon, 24 Jun 2019 03:17:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561371473; cv=none; d=google.com; s=arc-20160816; b=h7GIreefPNplYwLBn2IAX2U5+RviN72sey9KijAtfldxxzUReVrz31Ik+2DX/DKLYt D80n91trPVzF92kHzZ8nQMAsKySf4mGN5Ngu4z0SMdjEDqe+QnJJIJ4E9K02/e6Tg3N8 pV2X5cTb4O4+Iye2g2A8wJRP7bo4QOHyKxGO4tnjik+ZSftG6RV/7+5p6nozGjNLJOPt 53tV9i28ZNqoKxLTTvsHAqStb7Qwx80nA6diHr5KdBXtY4ZBI79W43kW2qx/hDgBGRYy A4nkRHZskwtwSvTBe1sIQbMs6ogfXutXHuzg9XS/2c5WpMg4Me0mzLlemiwbgQ1vIYvQ qVdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=Om9yXZ718UcEtfuhz1iBGLC1kNqyc5wzc1ipfwv3ckE=; b=YiiEG27Lsd1scAvX51GkQoRseaNEje4BfJTLgwzHpdtvKc/B9rgF5TwTDjSiSfk9XF J1+yJskC4NBeJAUdFuspFXl6oKGWg8HOcaiMhhDmIarJq1oXusuz2hVRJTP/7QwYjckB J5ImAbCZKjY0W53F78dGzV9Yl0MQ6hZXsyMUQ9vGnFqz5uYt0l9eeq1JvcJnzTa4Mbd7 iLpnivVkCa2uK9MStBtNm8ENeU6CVTtGwXUBCzvjUE+++v1faUqOjsQQ2DeepreTVU2J QaFCdim/8itGnz2BxxJEuLqhMVzJ44tTX7kqxrl69owB+k5U/nBVRmwimayxwFCFpNCa smgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VLi20MqG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a25si10701069pfo.234.2019.06.24.03.17.38; Mon, 24 Jun 2019 03:17:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=VLi20MqG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730848AbfFXKQ6 (ORCPT + 99 others); Mon, 24 Jun 2019 06:16:58 -0400 Received: from mail.kernel.org ([198.145.29.99]:54492 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730824AbfFXKQz (ORCPT ); Mon, 24 Jun 2019 06:16:55 -0400 Received: from localhost (f4.8f.5177.ip4.static.sl-reverse.com [119.81.143.244]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8513F205C9; Mon, 24 Jun 2019 10:16:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561371414; bh=aRhkgb5S/u+8oZ/KpUkEYewDKFzT6/mr7blE20Y2cvg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VLi20MqGP2vdnDLpbiIcizM1J1YEiaB12qR64ewTKKS7rdg2W4OHYrkLyOAQ7bgW1 6Rq9umkCvHLAtpqlfJlStGxo/LNdtna27sQFeVufdQBID+ObpvAN8FcHRgL608/8kj vftyVcFWH9wXxZDCdtFf+weJjkroeHRKcrK3VBz0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joakim Zhang , Dong Aisheng , Marc Kleine-Budde Subject: [PATCH 5.1 094/121] can: flexcan: fix timeout when set small bitrate Date: Mon, 24 Jun 2019 17:57:06 +0800 Message-Id: <20190624092325.579672385@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190624092320.652599624@linuxfoundation.org> References: <20190624092320.652599624@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Joakim Zhang commit 247e5356a709eb49a0d95ff2a7f07dac05c8252c upstream. Current we can meet timeout issue when setting a small bitrate like 10000 as follows on i.MX6UL EVK board (ipg clock = 66MHZ, per clock = 30MHZ): | root@imx6ul7d:~# ip link set can0 up type can bitrate 10000 A link change request failed with some changes committed already. Interface can0 may have been left with an inconsistent configuration, please check. | RTNETLINK answers: Connection timed out It is caused by calling of flexcan_chip_unfreeze() timeout. Originally the code is using usleep_range(10, 20) for unfreeze operation, but the patch (8badd65 can: flexcan: avoid calling usleep_range from interrupt context) changed it into udelay(10) which is only a half delay of before, there're also some other delay changes. After double to FLEXCAN_TIMEOUT_US to 100 can fix the issue. Meanwhile, Rasmus Villemoes reported that even with a timeout of 100, flexcan_probe() fails on the MPC8309, which requires a value of at least 140 to work reliably. 250 works for everyone. Signed-off-by: Joakim Zhang Reviewed-by: Dong Aisheng Cc: linux-stable Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/flexcan.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -166,7 +166,7 @@ #define FLEXCAN_MB_CNT_LENGTH(x) (((x) & 0xf) << 16) #define FLEXCAN_MB_CNT_TIMESTAMP(x) ((x) & 0xffff) -#define FLEXCAN_TIMEOUT_US (50) +#define FLEXCAN_TIMEOUT_US (250) /* FLEXCAN hardware feature flags *