Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp13476352ybl; Sun, 29 Dec 2019 12:49:53 -0800 (PST) X-Google-Smtp-Source: APXvYqwGNId4H3OK4W1teUQePHmLVLVA4BEnD+PYO5s4/VI9pNAzN1ifnIIgK7dzLNh2AJNuOMQ5 X-Received: by 2002:a9d:4e99:: with SMTP id v25mr72241943otk.363.1577652593464; Sun, 29 Dec 2019 12:49:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1577652593; cv=none; d=google.com; s=arc-20160816; b=uR8R9On6veVO7tx0Zg68UpwyEcMSjRB/+7wSdh6fMXoFHZvXX1inDWcxVcfLJ2uzNP /eodccxCglOPvf0WluSoQ6A/vsR1j1HrIKgcYAZuOcYF/nsDmfIbQs0/lbiMkjxiD7GA rcuKATRAr6jzCpV8BVGckjui+iUrH3oZpap36re+9gMFzS398fs5p6QHrwDqcWcB0BF1 X83OH4A/WKGBKlF9+KMQmfT1updqH7x8s8pgrUl2i6oNAGLSm+4Oou51DaJtwZey1baA YVmayNhzWuL22ghMTy3O5f6nUl/LCRsFZsBzFvK92DP9/XUlbD8AmSMCjmJrv3/qwhR4 Rq6w== 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=C0osHT5e1D/NaiLMmH98KuzRu7T83gCU4Z6vx+DT5Oo=; b=hAXhOJMXM88SmlK8/hvgOYVKgG/qzwhpfamved0tbVb5o9yQPuaIeFczNhqRGH1IVs k9GLj+uMskR8iCqJ15aYiREJQ7UyseKRNyTptU7MlLdTTX6rXJ2HK5Oj2T0HcBO0albk +tGs1FgZtqMMZ/nyJu4wWmuRCJHPAWetZ5nkp6MuCiDTavpzeuHQYMPOHQJzr6uzZAvW 9ATylcq0PeTPQ+4fY9Iv54l/C/TwJQP1V913/3ihVhKLl6zql8DfsY5sexVJp8Qgp+oN jdb3ONo5dc4aFz1CC70+HS2y+NS+ISouw+Uy8abOXPYFGItIp+gu4CzOi8VuV2HNafEd DETg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="WhdFDU/e"; 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 r10si22375842otn.241.2019.12.29.12.49.41; Sun, 29 Dec 2019 12:49:53 -0800 (PST) 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="WhdFDU/e"; 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 S2387465AbfL2R6I (ORCPT + 99 others); Sun, 29 Dec 2019 12:58:08 -0500 Received: from mail.kernel.org ([198.145.29.99]:49008 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387443AbfL2R6F (ORCPT ); Sun, 29 Dec 2019 12:58:05 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 C289A206A4; Sun, 29 Dec 2019 17:58:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577642285; bh=u1xUVPSbajSdVquSn0p+XxUCG3BSguvRB7U0kTOJMsk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WhdFDU/e8q2MpfZ/ZDjQNHFFeltDp8cauY89xL3kQiaCSfrjCiqCZQxAMu8r1Lfm8 P7I/SkwJL7hguYavDHztS5aitjg6A9JzpVB47/4n6kSohxlX9AgVwtiCQpoKwDFsua gEwocYziFbPZoQWwiM3cNh5nR4O9SptWn5wAnk14= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sean Nyekjaer , Joakim Zhang , Marc Kleine-Budde Subject: [PATCH 5.4 376/434] can: flexcan: poll MCR_LPM_ACK instead of GPR ACK for stop mode acknowledgment Date: Sun, 29 Dec 2019 18:27:09 +0100 Message-Id: <20191229172727.051447498@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20191229172702.393141737@linuxfoundation.org> References: <20191229172702.393141737@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 048e3a34a2e7669bf475eb56c7345ad9d8d2b8e3 upstream. Stop Mode is entered when Stop Mode is requested at chip level and MCR[LPM_ACK] is asserted by the FlexCAN. Double check with IP owner, the MCR[LPM_ACK] bit should be polled for stop mode acknowledgment, not the acknowledgment from chip level which is used to gate flexcan clocks. This patch depends on: b7603d080ffc ("can: flexcan: add low power enter/exit acknowledgment helper") Fixes: 5f186c257fa4 (can: flexcan: fix stop mode acknowledgment) Tested-by: Sean Nyekjaer Signed-off-by: Joakim Zhang Cc: linux-stable # >= v5.0 Signed-off-by: Marc Kleine-Budde Signed-off-by: Greg Kroah-Hartman --- drivers/net/can/flexcan.c | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) --- a/drivers/net/can/flexcan.c +++ b/drivers/net/can/flexcan.c @@ -407,7 +407,6 @@ static void flexcan_enable_wakeup_irq(st static inline int flexcan_enter_stop_mode(struct flexcan_priv *priv) { struct flexcan_regs __iomem *regs = priv->regs; - unsigned int ackval; u32 reg_mcr; reg_mcr = priv->read(®s->mcr); @@ -418,36 +417,24 @@ static inline int flexcan_enter_stop_mod regmap_update_bits(priv->stm.gpr, priv->stm.req_gpr, 1 << priv->stm.req_bit, 1 << priv->stm.req_bit); - /* get stop acknowledgment */ - if (regmap_read_poll_timeout(priv->stm.gpr, priv->stm.ack_gpr, - ackval, ackval & (1 << priv->stm.ack_bit), - 0, FLEXCAN_TIMEOUT_US)) - return -ETIMEDOUT; - - return 0; + return flexcan_low_power_enter_ack(priv); } static inline int flexcan_exit_stop_mode(struct flexcan_priv *priv) { struct flexcan_regs __iomem *regs = priv->regs; - unsigned int ackval; u32 reg_mcr; /* remove stop request */ regmap_update_bits(priv->stm.gpr, priv->stm.req_gpr, 1 << priv->stm.req_bit, 0); - /* get stop acknowledgment */ - if (regmap_read_poll_timeout(priv->stm.gpr, priv->stm.ack_gpr, - ackval, !(ackval & (1 << priv->stm.ack_bit)), - 0, FLEXCAN_TIMEOUT_US)) - return -ETIMEDOUT; reg_mcr = priv->read(®s->mcr); reg_mcr &= ~FLEXCAN_MCR_SLF_WAK; priv->write(reg_mcr, ®s->mcr); - return 0; + return flexcan_low_power_exit_ack(priv); } static inline void flexcan_error_irq_enable(const struct flexcan_priv *priv)