From: van.freenix@gmail.com (Peng Fan)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/2] ARM: imx: cpuidle-imx6q: configure CCM to RUN mode when CPU is active
Date: Wed, 24 Jan 2018 09:35:05 +0800 [thread overview]
Message-ID: <20180124013505.GB9401@shlinux2> (raw)
In-Reply-To: <1514641999-20521-2-git-send-email-peng.fan@nxp.com>
Hi,
For the two patch, ping..
On Sat, Dec 30, 2017 at 09:53:19PM +0800, Peng Fan wrote:
>There are two states in i.MX6Q cpuidle driver.
>state[1]: ARM WFI mode
>state[2]: i.MX6Q WAIT mode
>
>Take i.MX6DL as example, think out such a case:
>1. CPU0/1 both run at normal mode
>2. On CPU0, `sleep 1` is executed. And there are no workload on CPU1.
>3. CPU0 first runs into state[2] and 'wfi' instruction. Switched to use
> GPT broadcast.
>4. CPU1 runs into state[2] and configure CCM to WAIT MODE,
> then 'wfi' instruction. Now arm_clk and local timer clock are
> shutdown. Switched to use GPT broadcast
>5. GPT broadcast timer interrupt comes to GPC/GIC, then CPU0 wakes up.
> CPU0 switched to use arm local timer. CPU1 is still sleeping.
>6. No workload on CPU0, CPU0 runs into state[1]. But CCM register
> is still not restored to Normal RUN mode. 'wfi' + CCM WAIT will
> cause arm_clk and arm core clk.
> Now CPU0 stops, which is not correct.
>
>So, need to make sure CCM configured to RUN mode when any cpu exit
>state[2].
>
>In this patch,
>When CPU exits state[2], it configures CCM to RUN mode.
>When all CPUs enters state[2], the last CPU needs to check
>whether it's ok to configure CCM to WAIT mode or not.
>
>Signed-off-by: Peng Fan <peng.fan@nxp.com>
>---
>
>V1:
> This is to upstream patch:
> http://git.freescale.com/git/cgit.cgi/imx/linux-imx.git/commit/?h=imx_4.9.11_1.0.0_ga&id=0d980646ee068b92db71fd5e4e4efcbc33749cbd
>
> arch/arm/mach-imx/cpuidle-imx6q.c | 3 +++
> 1 file changed, 3 insertions(+)
>
>diff --git a/arch/arm/mach-imx/cpuidle-imx6q.c b/arch/arm/mach-imx/cpuidle-imx6q.c
>index bfeb25aaf9a2..4d342e2fdfe6 100644
>--- a/arch/arm/mach-imx/cpuidle-imx6q.c
>+++ b/arch/arm/mach-imx/cpuidle-imx6q.c
>@@ -30,6 +30,8 @@ static int imx6q_enter_wait(struct cpuidle_device *dev,
> if (!spin_trylock(&master_lock))
> goto idle;
> imx6_set_lpm(WAIT_UNCLOCKED);
>+ if (atomic_read(&master) != num_online_cpus())
>+ imx6_set_lpm(WAIT_CLOCKED);
> cpu_do_idle();
> imx6_set_lpm(WAIT_CLOCKED);
> spin_unlock(&master_lock);
>@@ -41,6 +43,7 @@ static int imx6q_enter_wait(struct cpuidle_device *dev,
> done:
> atomic_dec(&master);
>
>+ imx6_set_lpm(WAIT_CLOCKED);
> return index;
> }
>
>--
>2.14.1
>
Thanks,
Peng.
--
next prev parent reply other threads:[~2018-01-24 1:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-30 13:53 [PATCH 1/2] ARM: imx: no unmask/mask GINT for WAIT_CLOCKED Peng Fan
2017-12-30 13:53 ` [PATCH 2/2] ARM: imx: cpuidle-imx6q: configure CCM to RUN mode when CPU is active Peng Fan
2018-01-24 1:35 ` Peng Fan [this message]
2018-01-24 11:16 ` Lucas Stach
2018-01-25 2:19 ` Peng Fan
2018-01-25 11:52 ` Fabio Estevam
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180124013505.GB9401@shlinux2 \
--to=van.freenix@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).