Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp342096ybh; Mon, 9 Mar 2020 23:14:49 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtn2THOV9zp9Dk2MPMQcqQtxgeaq6AkBxEiLM/Own5no6E9YYN4yLwdzp04vadWIXJkGYYL X-Received: by 2002:a9d:48d:: with SMTP id 13mr14593690otm.249.1583820889291; Mon, 09 Mar 2020 23:14:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1583820889; cv=none; d=google.com; s=arc-20160816; b=ZjQyCAD5nYB4FOSJRYIZHCPMVNOzs/Li0UMblD2WaS6QstbGmr5LPDX9hA2wWy4ehS ZHNAt3rpR5EDSjGWaRBwncn7dLeq8roJPZRLS9fTW7/M2z+05+YaREf82VnJ+4LCli0I SczfTtqu9ZWHl7T33O+qVMOxachpZy8oiK+Dr26FdgeQDBsWXtnkCtVipolmKRJl9M0x f7iMAGLY2H/kx93Ty9i63T+1LsKXjCIKdgrPeWHxzonWuj6PXLjJYd+lL/bb/TFAbswP mz5786ETk+IKgBuuaic+fe8TV6GEAOJcapx+rwU1mcIpeo5j5NLj3qUfOOI0O6Gh2Na5 W3GQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=x/71cvOxVvagpdx4oakZK5kV6tHfoJ4fgyxJPzUXY6k=; b=PY32Dz+jFV6RM2RkYFPqrtSiO0glLUFdPLlbYHcd1aHt0nuQY5EPxx5fhlQodYmNGg PGZdW4ZYkhR693+rgyNiePwDlIlp/16umCUmaXi1itbPujlIwQ6LxrQcRdRKp8bXGMMG v1RfaWarCuO5Hg0GgqjC6UhMb3pDvknhnt3hi8JJR+TpFUOzNzeOX98gCTfhAwqXuNPR VikAwTqvMr1aYyhOOMnFI9Ny6EmkB6MpjTPdPtLj7qvMjmOjyUiUHQTZueTxs6ysYyaD XkPYK7actbrI7Tr9t7xmv1hBMHbzZxHb5OU0XcQc1rseve0EeE4G/Xi2KEZsNUNdRcTG Swuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=PDJj3pyX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e6si4710432oig.223.2020.03.09.23.14.37; Mon, 09 Mar 2020 23:14:49 -0700 (PDT) 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=PDJj3pyX; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726202AbgCJGNg (ORCPT + 99 others); Tue, 10 Mar 2020 02:13:36 -0400 Received: from mail.kernel.org ([198.145.29.99]:47542 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726156AbgCJGNg (ORCPT ); Tue, 10 Mar 2020 02:13:36 -0400 Received: from dragon (80.251.214.228.16clouds.com [80.251.214.228]) (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 3B9DD24673; Tue, 10 Mar 2020 06:13:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1583820815; bh=fSXsWsBt9Dpiq6m0xApVOrGE8qP/RuICGKsCO6DuD3w=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=PDJj3pyXtIEFr8bnNJC3SWe3F/LHSL8v7gsYOtJ5hrBXpCcBCxrKJ3DgKsUfRKIuh jRxG4g6jM8fJMIIMEv+sPmCDCNdjBA00KnxirI5cMx94av0V94B5ghGV3pNGXCLXJb JrcbgmWH+ZXCpVdHvJ7L2epmR6pOXr7T1QT4PCrc= Date: Tue, 10 Mar 2020 14:13:29 +0800 From: Shawn Guo To: peng.fan@nxp.com Cc: s.hauer@pengutronix.de, sboyd@kernel.org, robh+dt@kernel.org, viresh.kumar@linaro.org, rjw@rjwysocki.net, kernel@pengutronix.de, festevam@gmail.com, linux-imx@nxp.com, Anson.Huang@nxp.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, abel.vesa@nxp.com Subject: Re: [PATCH v2 09/14] ARM: imx: cpuidle-imx7ulp: Stop mode disallowed when HSRUN Message-ID: <20200310061328.GK15729@dragon> References: <1582099197-20327-1-git-send-email-peng.fan@nxp.com> <1582099197-20327-10-git-send-email-peng.fan@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1582099197-20327-10-git-send-email-peng.fan@nxp.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 19, 2020 at 03:59:52PM +0800, peng.fan@nxp.com wrote: > From: Peng Fan > > When cpu runs in HSRUN mode, cpuidle is not allowed to run into > Stop mode. So add imx7ulp_get_mode to get thr cpu run mode, > and use WAIT mode instead, when cpu in HSRUN mode. > > Signed-off-by: Peng Fan Why do you have cpuidle patches in a series titled as adding cpufreq support? Shawn > --- > arch/arm/mach-imx/common.h | 1 + > arch/arm/mach-imx/cpuidle-imx7ulp.c | 14 +++++++++++--- > arch/arm/mach-imx/pm-imx7ulp.c | 10 ++++++++++ > 3 files changed, 22 insertions(+), 3 deletions(-) > > diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h > index 5aa5796cff0e..db542da4fe67 100644 > --- a/arch/arm/mach-imx/common.h > +++ b/arch/arm/mach-imx/common.h > @@ -104,6 +104,7 @@ void imx6_set_int_mem_clk_lpm(bool enable); > void imx6sl_set_wait_clk(bool enter); > int imx_mmdc_get_ddr_type(void); > int imx7ulp_set_lpm(enum ulp_cpu_pwr_mode mode); > +u32 imx7ulp_get_mode(void); > > void imx_cpu_die(unsigned int cpu); > int imx_cpu_kill(unsigned int cpu); > diff --git a/arch/arm/mach-imx/cpuidle-imx7ulp.c b/arch/arm/mach-imx/cpuidle-imx7ulp.c > index ca86c967d19e..e7009d10b331 100644 > --- a/arch/arm/mach-imx/cpuidle-imx7ulp.c > +++ b/arch/arm/mach-imx/cpuidle-imx7ulp.c > @@ -15,10 +15,18 @@ > static int imx7ulp_enter_wait(struct cpuidle_device *dev, > struct cpuidle_driver *drv, int index) > { > - if (index == 1) > + u32 mode; > + > + if (index == 1) { > imx7ulp_set_lpm(ULP_PM_WAIT); > - else > - imx7ulp_set_lpm(ULP_PM_STOP); > + } else { > + mode = imx7ulp_get_mode(); > + > + if (mode == 3) > + imx7ulp_set_lpm(ULP_PM_WAIT); > + else > + imx7ulp_set_lpm(ULP_PM_STOP); > + } > > cpu_do_idle(); > > diff --git a/arch/arm/mach-imx/pm-imx7ulp.c b/arch/arm/mach-imx/pm-imx7ulp.c > index 393faf1e8382..1410ccfc71bd 100644 > --- a/arch/arm/mach-imx/pm-imx7ulp.c > +++ b/arch/arm/mach-imx/pm-imx7ulp.c > @@ -63,6 +63,16 @@ int imx7ulp_set_lpm(enum ulp_cpu_pwr_mode mode) > return 0; > } > > +u32 imx7ulp_get_mode(void) > +{ > + u32 mode; > + > + mode = readl_relaxed(smc1_base + SMC_PMCTRL) & BM_PMCTRL_RUNM; > + mode >>= BP_PMCTRL_RUNM; > + > + return mode; > +} > + > void __init imx7ulp_pm_init(void) > { > struct device_node *np; > -- > 2.16.4 >