Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3320912pxf; Mon, 15 Mar 2021 07:06:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJww8htTA7bLLBpsHslbHq6hdqdcZfMJbfThW8ywZ+2GOYCaSozqTwGQt6jBcKGQbo/tF3PF X-Received: by 2002:a17:906:1e4f:: with SMTP id i15mr23318759ejj.349.1615817160770; Mon, 15 Mar 2021 07:06:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615817160; cv=none; d=google.com; s=arc-20160816; b=bumxsxEjWApfBHwFqMnh5ASRlfGnfpkKFBA/enW8Cqn7hJ4DN/Jb1CZ73CXE3rSt4C G3anseNY/yU5BqjGO0hU90n82aiMw/FylnQzIKfTHWPqOy8AqxxkSOwiW0ReXchc9zlj os5Hq9qugpw695qYdYSqc6gQzGb5zJ3fu0OEGzO5BmI6CzdV0i+Om6VJMm3COvPRmvYc JviUmyza1izCy0oW+wk71qiM8hhSMfgguvvpQ5Dw9vlqKDvE9711HMI7QIBdCuesPpak 8TSpjP6HNJRoTQ+LV27nvMG7OFAfJCn2oVpApXB+lW0UussNs/bduNaGtrjUMcLrSktW inBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4XkHbTpOEWg6T/7HkkpjC8fhOZkwhYjv88Mc85on9Rw=; b=ezINbfwSKp4CurUSfRMOYOen1YpKbDDNYybpE7FsL/xr1HQttks8UDVkzscXX8FXEa SSDPZrybJJAbmy/XO0/S7Jk+td8+eZRnLabrgzZm9RjYbDig3TTYtg62+MoCkwM+rGK2 jAXIQJZWeTiNKemn4nDYg62Ag6+EAp2JvjoTV9x/WHfEchY7YqMXtHOcfxSJVRGL6RPg Kp6htB4Ft4zGHZr8+7Hc/aT2bUdI08xCjP/Wyfe7i/lBENgzBsY094OhmZNeiquMUbc7 gvXgCDMpHP9lvKc2uIHW5u4HHRCKBU4yjiqA+bP3Pclj2eET8Jk+K60uuA/9Vp9EgiD0 /6FQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H6zY2EYr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k24si11951448eja.161.2021.03.15.07.05.36; Mon, 15 Mar 2021 07:06:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H6zY2EYr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234564AbhCOOEV (ORCPT + 99 others); Mon, 15 Mar 2021 10:04:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:34114 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231921AbhCON5U (ORCPT ); Mon, 15 Mar 2021 09:57:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 503CA64EF9; Mon, 15 Mar 2021 13:57:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816625; bh=GHWPrKkjs+Ig7xn4jmmEy1KgITn56omBYTry/y42Vqs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H6zY2EYrKWlRAEFySGZ3ge9H8NErWEfRQSn3VcqOCSDwbprZUGab7KPDlBXww9EiU K1uEpGSul/DTBODp9LV9iIQzUL9ZAQxH6us30p2PIp+kKU4a7IxfMNMP5OcRRn8J6L zNt9lNouyyVW+bSULPMHE2V6257pC+ufzCQTRH8Q= From: gregkh@linuxfoundation.org To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Joakim Zhang , Marc Kleine-Budde Subject: [PATCH 5.4 011/168] can: flexcan: enable RX FIFO after FRZ/HALT valid Date: Mon, 15 Mar 2021 14:54:03 +0100 Message-Id: <20210315135550.713280166@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135550.333963635@linuxfoundation.org> References: <20210315135550.333963635@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Greg Kroah-Hartman From: Joakim Zhang commit ec15e27cc8904605846a354bb1f808ea1432f853 upstream. RX FIFO enable failed could happen when do system reboot stress test: [ 0.303958] flexcan 5a8d0000.can: 5a8d0000.can supply xceiver not found, using dummy regulator [ 0.304281] flexcan 5a8d0000.can (unnamed net_device) (uninitialized): Could not enable RX FIFO, unsupported core [ 0.314640] flexcan 5a8d0000.can: registering netdev failed [ 0.320728] flexcan 5a8e0000.can: 5a8e0000.can supply xceiver not found, using dummy regulator [ 0.320991] flexcan 5a8e0000.can (unnamed net_device) (uninitialized): Could not enable RX FIFO, unsupported core [ 0.331360] flexcan 5a8e0000.can: registering netdev failed [ 0.337444] flexcan 5a8f0000.can: 5a8f0000.can supply xceiver not found, using dummy regulator [ 0.337716] flexcan 5a8f0000.can (unnamed net_device) (uninitialized): Could not enable RX FIFO, unsupported core [ 0.348117] flexcan 5a8f0000.can: registering netdev failed RX FIFO should be enabled after the FRZ/HALT are valid. But the current code enable RX FIFO and FRZ/HALT at the same time. Fixes: e955cead03117 ("CAN: Add Flexcan CAN controller driver") Link: https://lore.kernel.org/r/20210218110037.16591-3-qiangqing.zhang@nxp.com Signed-off-by: Joakim Zhang Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/flexcan.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -1432,10 +1432,14 @@ static int register_flexcandev(struct ne if (err) goto out_chip_disable; - /* set freeze, halt and activate FIFO, restrict register access */ + /* set freeze, halt */ + err = flexcan_chip_freeze(priv); + if (err) + goto out_chip_disable; + + /* activate FIFO, restrict register access */ reg = priv->read(®s->mcr); - reg |= FLEXCAN_MCR_FRZ | FLEXCAN_MCR_HALT | - FLEXCAN_MCR_FEN | FLEXCAN_MCR_SUPV; + reg |= FLEXCAN_MCR_FEN | FLEXCAN_MCR_SUPV; priv->write(reg, ®s->mcr); /* Currently we only support newer versions of this core