Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6783069ybi; Mon, 8 Jul 2019 08:36:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqz76ipz6dM4h9jZxsA6gDi/ntTJcwAyAS+7MkOU70nPhqSoxJGxG4VxMwvMrYDy+fkx866M X-Received: by 2002:a17:902:9a06:: with SMTP id v6mr25263191plp.71.1562600161233; Mon, 08 Jul 2019 08:36:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562600161; cv=none; d=google.com; s=arc-20160816; b=ghwqEc8v3uYYwaoM5u7DfmOtES9MdPp0t7Po+cuTgSpphqc/5O+wHKBbuYBdjMzISq kpUoCGvutwoD9kaN37J6v0y9m/I4kDJ8VH+JPQzfxQraRNRDwoNRssiFPlBZE1ruleoZ GtjkC8dWNwV93MLKKhnAKa8xfQogVBtOGkcc3OE+lfV7d/r1phVfWuNz3PS24OHc31an dBmaJtQMolJ2gSo9IvWLx/s4eKWcZxhooW/ovcXil6zoo9Vhl3idYppmPAwCJZbh/vNq ZtOSHBnsfuKr21+2i2srBTRbiX096POchuMsq3nBditg8ar/N4j83vHYL9W/hhAVql8o pveg== 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=tI3D87Hm7GUi1jxjjeJvWuOsn27m2o0XTeGiEi4dyjA=; b=mIBH78U2bteQx/fFPRNNVY9ZOvZIwSGoMbCvWR86kcH+7jA+vmWgRx62PVqtqRmGdj 0iiA7SJ+W7NSRaOIAdczsqqQ3mydjrtrFdpLjNum+CkqN+dz3HqqZllxekxiIeoUO2+W shIK+4xyvnNgVolwzez/3Vz1LfFM8YVfhz34qJmTHRcBSZO4IqapuZnnlxzdB9Fe2l5o ToWIU/VgN71kHXuQ9wDcbDYudgMzFP3lTscc/Hd4TrD3MsRGybBWd+OYdcQw38IE4N2N LWUr+YsUWQyixjxjbaiIODjGsnK0DcAROdUYKg83A39+ROBvD9AOXjbL7xBCUcZn+DCk T2pA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=G+oQ6GiD; 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 n123si13355189pgn.151.2019.07.08.08.35.46; Mon, 08 Jul 2019 08:36:01 -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=G+oQ6GiD; 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 S2387560AbfGHPUB (ORCPT + 99 others); Mon, 8 Jul 2019 11:20:01 -0400 Received: from mail.kernel.org ([198.145.29.99]:43836 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729037AbfGHPT2 (ORCPT ); Mon, 8 Jul 2019 11:19:28 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 672F6216E3; Mon, 8 Jul 2019 15:19:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562599167; bh=2VdFkdk9SIaAdzepBOAW1EfUckj2mgK2DM94z7kTn2A=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G+oQ6GiDxlOVcjsMYGss0P7+YM2q63aMt5lSHdcvxAQ/PQD7iTZ9qFYw65hPqw4/w gu2HzWbPtCLKTCD6NQ4KK/rMokJ9nvvcCQd1QGtHnqqtC2xfR+IwI36mXHHGc5agsr YDyEJ+0xd72EElih9MUrSFjygHxwOvemsaADVtlE= 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 4.9 027/102] can: flexcan: fix timeout when set small bitrate Date: Mon, 8 Jul 2019 17:12:20 +0200 Message-Id: <20190708150527.701988108@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190708150525.973820964@linuxfoundation.org> References: <20190708150525.973820964@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 @@ -171,7 +171,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 *