Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp2239807ybd; Mon, 24 Jun 2019 03:07:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqwXqoID0nOrEEx/0LNODwfX4XAl6jt4cANs3Cl4dHu9RYdrnNbkFISECYBZdMxh/DrYgAqw X-Received: by 2002:a17:902:e512:: with SMTP id ck18mr39193737plb.53.1561370868022; Mon, 24 Jun 2019 03:07:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561370868; cv=none; d=google.com; s=arc-20160816; b=rGMqSBcaytzQyVAuZBjTk9aoIdhbV4gVWh5aB6UWdPeYEQlg65kzbuPU5wCoYDb6jn P3FteoRx//kWTt8g5UQP6Ui8jVdjOBb8xRLx7gFP2Lkb4jM1MMdB456A5Saz5vigRurh 0+1fZmKNa6/y+5pR3WqxSMm1T482hlYVDb9sExk0QUs/kDR4DoNqF6vSb8CRvJf39Byk YNDDLgbeKTsyB4+yRD/W9xYvlnR82ktLwMYIAVDoIClN25VVYeDBRgG/PvVnGysH22W8 OfoP+bj+l3mg5YS78XgBLkPN602Hdsm9vd6vyOukynawc4fbWxmPVCkTTD1InXjs84qK 16AQ== 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=PDDnqVyBeBT2hYM/o5LEdXRo56OL2o4nQivDCjPj5sA=; b=FJN2dJ4iZEENFiM2M85lqNSJq5jpWzbMthjE+98Bd31TONCJIoVQ/H2M/I/BQmsUxW FWLwrOpdGMdaYr8PHA2tNmL+/KPDvhtTzu5IYGU2hCGqB1xFMR6h1NdNOZhpLDFkVRdv DTU9XBlG7z7vE8WogkPxv5xFRXZ55Zkcdg3JsVqcFjQ4tJtGrmOSTBe3csvJJQLI15MU bb1uyUt+qIzkRPlJexWon6go1KhVJ8TQN0+k3oNjLuQaD/4S0UZqwy8oh3Yfw57gHaKh aEz5cStp/s2MfE7R++3gCHCSERnpr7sXucZuGp9rXNI2EbiFRckiOIlUZ4NX4lf9K0UV zOyQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=r0yZl9iH; 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 d12si9438788plo.68.2019.06.24.03.07.32; Mon, 24 Jun 2019 03:07:48 -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=r0yZl9iH; 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 S1729946AbfFXKFe (ORCPT + 99 others); Mon, 24 Jun 2019 06:05:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:37480 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729799AbfFXKFc (ORCPT ); Mon, 24 Jun 2019 06:05:32 -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 7ED8421473; Mon, 24 Jun 2019 10:05:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1561370731; bh=BnKe2Vzp/DnR05sQo+fFICmAFN43Hbabh+9cFbkNPF0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r0yZl9iHpJiiYCplwxm3ygYPAIm3ybFYbKYG164OHCAKnEa+Dma5+focvmVpp3iwG I77FNqkyr3a8h3SINUyRhQOxs3tzDMNNLgjfnLTlScd2isSlukJsbvtOaTHB3+TrSI keOa/kkPrfccvMBKzgw46te4kdhZx+38VRbf5R8Y= 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.19 70/90] can: flexcan: fix timeout when set small bitrate Date: Mon, 24 Jun 2019 17:57:00 +0800 Message-Id: <20190624092318.619100282@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190624092313.788773607@linuxfoundation.org> References: <20190624092313.788773607@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 @@ -165,7 +165,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 *