Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3511552pxf; Mon, 15 Mar 2021 11:09:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSZGqudPa+9EFOUZ+P5LjWmIioRLIqGBdYRvB85pSWZFGDrSw1CT2fmrpHQ+vZLKGE/4GN X-Received: by 2002:a17:907:9611:: with SMTP id gb17mr25686361ejc.325.1615831789625; Mon, 15 Mar 2021 11:09:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615831789; cv=none; d=google.com; s=arc-20160816; b=LLtODBNG0ZCaSwB5eWpdc8trez6ve59sbrLBmCCNTXC1W9FvcDkNCCnz+qY0SCLgIa VMJFd1vDdEsj2Y+Wf5dcIzR5rE7OMPUciRLV27t+qPhr3KjKhuxpYfOWdLRgR3LDg+ew dky5g2MNmuetfNjNK3hDst2CQCP0uU9cuhuQLArvHDeapvCCxqX1Yr16XmIHZXDvhKji hPbVzteDdRIQIqlGbU7yCkIGHvaz1Q5OkqNcoS920QQJtA9WhwpFGBtpBn5vi3z4V3Wy 9iR1HRceV4teUoHBNiZdb+ZHkp/t3nz5bIbvqVONz9G8WtLiEcY2l7WM33fTg2UkeJjp dXXQ== 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=/W3fMyr068pf6MNZVk+UU//muksLRTb31qrHH46n0EE=; b=svgCqrY4EmPI+jrZ6iDkowpxUxTpJqv7eLam89FdpC3O8fysfUvh2+yEahkJYrV3Gp QG32EWWXEWzYLjKkUz44d72MxCtHqWy4bE2c8B7dz/k19pkpTywabZtmMjPwc+zeYf/n Ic2vuK9s9VkpW65dWv20RBM6wlX6YmGB2Rfo17En7q+e7RhsLyTCLf0o03zPViZE6yJg kX7UecgwX/7KaMeiz196HD6bBJoYQyxGaI2hQZPCeQODgs7MNoLW7WIYTu7yYAm2vP00 FEi3uyawOKXAQHjRo13HVfN3kk68Eh4YVLJi9P7RMWjGial2VOXAFwz5q7fmLmmKlS89 2F+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qWysVVhI; 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 a7si13303161edb.607.2021.03.15.11.09.26; Mon, 15 Mar 2021 11:09:49 -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=qWysVVhI; 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 S231997AbhCOOKG (ORCPT + 99 others); Mon, 15 Mar 2021 10:10:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:36594 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232088AbhCON6U (ORCPT ); Mon, 15 Mar 2021 09:58:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8738864F22; Mon, 15 Mar 2021 13:58:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816689; bh=nRPmxLI0plrqbjwbmy1uJ8MfbXC/WIfazD4iHvJCgn4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qWysVVhImn9xr+NYAj8nyRaeHDhvcC23fywi3iTPNjzT6VadpnQpNPDZe0NwSz9xg yLfO8rp1r5FaX4Ggrr+oMkZ+kbTrV1aBIEAbi9D0B43EEUPzR73LIj3iM5i9Q+yRlX NyCvoxXq0BTbN4sADMK7qSDqyTF7S9XSpS/kZ4N8= 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 4.19 008/120] can: flexcan: enable RX FIFO after FRZ/HALT valid Date: Mon, 15 Mar 2021 14:55:59 +0100 Message-Id: <20210315135720.287126918@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135720.002213995@linuxfoundation.org> References: <20210315135720.002213995@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 @@ -1252,10 +1252,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