Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3319832pxf; Mon, 15 Mar 2021 07:04:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxWy5E25bgPKp3gHn9jiVBSeQ9AYRsIP64MH0O6I1Rmt0kSFQpT3HlUQ9AILnLNIGoaLw2M X-Received: by 2002:a17:906:c007:: with SMTP id e7mr24297947ejz.518.1615817090886; Mon, 15 Mar 2021 07:04:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615817090; cv=none; d=google.com; s=arc-20160816; b=C1xNO9O+HdOr4ZazUJUxoGZO77S+eAePMLXHGklybAR+SeLEAwrqHN+WYM+OHq/csx 9U1jU2B5ArxcovKVhenL/SExzX+Gq7+2hWA9zdFJJwxWmWS6vSB9fIbYfiBOwA2dOloc 0Nb74bw1LbLb8VxH4j8/JQZI8A2IGv5yveb703kJC0n5gIaKMpcGZuqQVHuBwWMWNw74 BHfO5MKEYs7lmZZ3mgDGXleqNMlc6Zx0/PA1XApQGfJZL38TgFykDikuXJZxnMRRgN3v Sqdr9UbanrH8VYjwWfJcsYpdGkZdwo2FZ0ydLzVqnrVaWMfuJC3TOAf8BA6RO19CVaIp /6Xw== 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=o2SK2lx655UpOa3f9yw3dnLDBBA0FnPUX4OYklZt7o0=; b=Z4JyN1MvdoFiK11gmroqIkG71ppjkAky/oBOcNhyP0IT4CzY5WNvqSgNsObSg52xSt uNsmlBq6XotsD+wXRKdaEVXMORxjtnGvwgfIYSWU4nrmD7Uz27epBXS7mp7shfJFpDPe MQhU4dXgLLKjlfta4aERKz69TelNuLarIgD5FdW+wVv1vd1YxDgAFl8QlHD1NT11e4JM vZLWnLEVeYAD3TvLgGOfOayiBe/X1s2KyNQ7K1LZE3KqOBpOci8ImCpyUAO/EPM7RRyM s64yZjcYZDRucmR8Tdp2zinGCbvpbjXhpYKYvOfb4u2hE1nKpoknAwdwpQaKRe4i/aeR Bpkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=IqcgpEjv; 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 p8si11374035edm.44.2021.03.15.07.04.22; Mon, 15 Mar 2021 07:04:50 -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=IqcgpEjv; 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 S233958AbhCOOCj (ORCPT + 99 others); Mon, 15 Mar 2021 10:02:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:33716 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231793AbhCON4x (ORCPT ); Mon, 15 Mar 2021 09:56:53 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 3393664F05; Mon, 15 Mar 2021 13:56:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1615816613; bh=GX7TRr9Aru9vNLq9Z/G5bt7nZMGG5L96RFQ3gaIhgkw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IqcgpEjvAWXqakUoGApjNIjofjPWv7oGM9mE6hFwdd4Zu5cEOfjvYHTgvM/a6yFcG 1AQTcZptKeUKXefLDZ7o4wCkG3pwQQFcehvShi4FeI92ydCvJtCGZ8NnQFo3VeLmc9 dNQkjXTTsF5lya95EbR2EnZ/BjtlKTspTjHP+2GI= 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.10 013/290] can: flexcan: enable RX FIFO after FRZ/HALT valid Date: Mon, 15 Mar 2021 14:51:46 +0100 Message-Id: <20210315135542.399374375@linuxfoundation.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210315135541.921894249@linuxfoundation.org> References: <20210315135541.921894249@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 @@ -1800,10 +1800,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