Received: by 2002:a25:824b:0:0:0:0:0 with SMTP id d11csp1195365ybn; Wed, 2 Oct 2019 12:15:37 -0700 (PDT) X-Google-Smtp-Source: APXvYqxt35lKyF/bx+vjZyYJiBRN6Up63oxqm0ElFyfrTrrIJDY3YqOGkt8++3G2NGZemMJ6T2by X-Received: by 2002:aa7:d995:: with SMTP id u21mr5583701eds.271.1570043737792; Wed, 02 Oct 2019 12:15:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570043737; cv=none; d=google.com; s=arc-20160816; b=trDsOfiZn5EjW/9CmPDwki3slbHEcKm2ESG9memBoPksyUetOhPfQa1LH1yu5I6zGA qR3OBOVrSpFfjrDLexcKodKTnUSrC1qYNEyx0loJPa4OlwuNOP3Nhqs6YTVDsbdofDDi Vh5XP//pgvB63JPWmTdHezbEsa/yzu48HLBLwjgpr1pV1pxfQYs4Q8Y9+lkbhe9Jz+vF kA6YWOtP2n2isD6Il/yDJFAvgMecBh4ncIhZZHctuGvwm2k9JfZItqEnlMWYcljWoUcn D/SqsszbeTKCcRBLCHcXtmuSm3jzEQQT2MBBEYCGYd31aXMbz81S8Q+hGyIs1WvLIMR5 519g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:subject:message-id:date:cc:to :from:mime-version:content-transfer-encoding:content-disposition; bh=EA0GVCQje3S3zh2oSK1/kHws/Gv+He1dDInxS954KbY=; b=01MV7XSH/am7KorJsZPjugAVKEbd1QImmZHl7Iv3ZtPBmAJIS/X4Ybzs2UM24+xDS7 Czvp5jE0T9g1NkTVjUAIGWR2/n+Aw+RPJuhhUcEVD7mOmx6+47Nx/gq12Tann6qODf99 CW0B9t7cHdAmGCw31fY3uggvrf2LOTifTgcTacTPVFMW6jnlu9L9GM/4S48n6ZemxBb5 jPQYkBD2BxahfLpPyy3XqgtzzwyR4fJchnDL00ZvzhMA78O8FFw3zY1Zoi3FHzF/JPzo 8JwbpQ7Lwkxx8vszhuqexLZqCL20yJsifJyn3yMGqYVyDayHmRIU85HhXX7QAOJo7zFR 4ETQ== ARC-Authentication-Results: i=1; mx.google.com; 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 ni5si10954ejb.184.2019.10.02.12.15.13; Wed, 02 Oct 2019 12:15:37 -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; 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 S1730041AbfJBTL4 (ORCPT + 99 others); Wed, 2 Oct 2019 15:11:56 -0400 Received: from shadbolt.e.decadent.org.uk ([88.96.1.126]:35582 "EHLO shadbolt.e.decadent.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729194AbfJBTIM (ORCPT ); Wed, 2 Oct 2019 15:08:12 -0400 Received: from [192.168.4.242] (helo=deadeye) by shadbolt.decadent.org.uk with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iFjyr-00035r-Cv; Wed, 02 Oct 2019 20:08:09 +0100 Received: from ben by deadeye with local (Exim 4.92.1) (envelope-from ) id 1iFjyo-0003dn-Gr; Wed, 02 Oct 2019 20:08:06 +0100 Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, Denis Kirjanov , "Joakim Zhang" , "Dong Aisheng" , "Marc Kleine-Budde" Date: Wed, 02 Oct 2019 20:06:51 +0100 Message-ID: X-Mailer: LinuxStableQueue (scripts by bwh) X-Patchwork-Hint: ignore Subject: [PATCH 3.16 49/87] can: flexcan: fix timeout when set small bitrate In-Reply-To: X-SA-Exim-Connect-IP: 192.168.4.242 X-SA-Exim-Mail-From: ben@decadent.org.uk X-SA-Exim-Scanned: No (on shadbolt.decadent.org.uk); SAEximRunCond expanded to false Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 3.16.75-rc1 review patch. If anyone has any objections, please let me know. ------------------ 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 Signed-off-by: Marc Kleine-Budde [bwh: Backported to 3.16: adjust context] Signed-off-by: Ben Hutchings --- 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 @@ -157,7 +157,7 @@ #define FLEXCAN_MB_CODE_MASK (0xf0ffffff) -#define FLEXCAN_TIMEOUT_US (50) +#define FLEXCAN_TIMEOUT_US (250) /* * FLEXCAN hardware feature flags