Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3323334pxf; Mon, 15 Mar 2021 07:08:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwTkC2sVmhatf38AcsIqyiZCf5Kq19jCPwTWrudVaYYxTdfygMrl8kmj/MS8mhFSpqXP50Q X-Received: by 2002:a05:6402:382:: with SMTP id o2mr30870023edv.238.1615817304665; Mon, 15 Mar 2021 07:08:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615817304; cv=none; d=google.com; s=arc-20160816; b=byVwVGN7zYIYnMIQwa1t8rrTDg40DhlPTp8ShC+z4Ee2TXeB1cHWIRX86RFcI/a3TA er7cnKMfXK9nqEfNFwg+OOjvpXO2L8GV9GnXOoFCs+iAafelXFP9EkFn+sCA6ijOgLnS TmJHBwZmJ6AHgSigRGh6A1jXK4PS1O409ksY0GIc9gcW2BY0S2poVxpS2MiB8hbcuSNN PbIsSwXcFvKb/3+1bMCzhW+TOeU4pIhcLWXToDjXuXVIrjZX9viFc0aGG8bZNo7rZ9y9 DhLubMOjQrzqzOlZ7XlnKU/R9KBY6MGA2Q0TihaW/srjcnXsfNP0TwCyL19/t9y/Zr/j 5AfQ== 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=Dhwly/sZ+vR9lcqr38qf6Xi3alqyf+nWt3fGnIB48y0=; b=Qb/pY3UIv5jzZeUb+XG2cgRjwpBbZ7DKEprUd+Vnzq1ohgS1yCxllfzJAa+OuVxysf dABC1Ks0DTDjJA0yFV/31lsHdtr2O9jQiY5XTv61pZnV3GJn77tHxn5t4sDgGtg9ameC L9kdHv4SHaMIJB1gjKt6sF5fUQInhE/o5hMSbWA270PWpdA7Z4U9hqVfveOylsFb8mW8 6XeUKvZaNKAEdXgDKOhSvves9nIhTyx8v3BhwBiQolMpEsvadSbstWTeh+Vk6galm0TL LA+i9GsJIcAM7J0ETdtMGrLZCpBDkp2pbIViAD+SZHKPaCOdA9VM40Ggr7sb1pmP8EG5 0lJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=D9l9DrIr; 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 u4si1008319ejr.169.2021.03.15.07.08.01; Mon, 15 Mar 2021 07:08:24 -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=D9l9DrIr; 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 S233883AbhCOOCe (ORCPT + 99 others); Mon, 15 Mar 2021 10:02:34 -0400 Received: from mail.kernel.org ([198.145.29.99]:33964 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231769AbhCON4w (ORCPT ); Mon, 15 Mar 2021 09:56:52 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CDE4F64F01; Mon, 15 Mar 2021 13:56:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816612; bh=KGHQjxJBd9zAIgB5ToyD/wCfmUU61UCbM1eVEf9Fy7U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D9l9DrIrIHvsWW76bNUgb0xk3SrbOPxaskYb1u+CkC4sK85nw92gEow7TyjTWzC2E 7m/esPUTmW36ASZIS8Te4PIwnvgHuJ8GEsrL/uO/UUaHvfVavRiLzh1FUHNuLq36m8 t7vwp0sO9PYJ/V0WGmEHxOOMdFa2hXdIOkkUw/j4= 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.11 020/306] can: flexcan: enable RX FIFO after FRZ/HALT valid Date: Mon, 15 Mar 2021 14:51:23 +0100 Message-Id: <20210315135508.302097100@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135507.611436477@linuxfoundation.org> References: <20210315135507.611436477@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 @@ -1864,10 +1864,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