From: Stephen Warren <swarren@wwwdotorg.org>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 09/12] tegra124: Add PSCI support for Tegra124
Date: Wed, 18 Feb 2015 09:34:53 -0700 [thread overview]
Message-ID: <54E4BF2D.3050103@wwwdotorg.org> (raw)
In-Reply-To: <54E42D93.2090809@siemens.com>
On 02/17/2015 11:13 PM, Jan Kiszka wrote:
> On 2015-02-17 22:03, Stephen Warren wrote:
>> On 02/16/2015 05:54 AM, Jan Kiszka wrote:
>>> This is based on Thierry Reding's work and uses Ian Campell's
>>> preparatory patches. It comes with full support for CPU_ON/OFF PSCI
>>> services. The algorithm used in this version for turning CPUs on and
>>> off was proposed by Thierry Reding in
>>> http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/210881. It
>>> consists of first enabling CPU1..3 via the PMC, just to powergate them
>>> again with the help of the Flow Controller. Once the Flow Controller is
>>> in place, we can leave the PMC alone while processing CPU_ON and CPU_OFF
>>> PSCI requests.
>>
>>> diff --git a/arch/arm/cpu/armv7/tegra124/ap.c
>>> b/arch/arm/cpu/armv7/tegra124/ap.c
>>
>>> +void ap_pm_init(void)
>>> +{
>>> + struct flow_ctlr *flow = (struct flow_ctlr *)NV_PA_FLOW_BASE;
>>> + struct pmc_ctlr *pmc = (struct pmc_ctlr *)NV_PA_PMC_BASE;
>>> +
>>> + writel((u32)park_cpu, EXCEP_VECTOR_CPU_RESET_VECTOR);
>>> +
>>> + tegra_powergate_power_on(TEGRA_POWERGATE_CPU1);
>>> + tegra_powergate_power_on(TEGRA_POWERGATE_CPU2);
>>> + tegra_powergate_power_on(TEGRA_POWERGATE_CPU3);
>>> +
>>> + writel((2 << CSR_WAIT_WFI_SHIFT) | CSR_ENABLE, &flow->cpu1_csr);
>>> + writel((4 << CSR_WAIT_WFI_SHIFT) | CSR_ENABLE, &flow->cpu2_csr);
>>> + writel((8 << CSR_WAIT_WFI_SHIFT) | CSR_ENABLE, &flow->cpu3_csr);
>>> +
>>> + writel(EVENT_MODE_STOP, &flow->halt_cpu1_events);
>>> + writel(EVENT_MODE_STOP, &flow->halt_cpu2_events);
>>> + writel(EVENT_MODE_STOP, &flow->halt_cpu3_events);
>>
>> I would expect to set up halt_cpu*_events before powering on the CPUs,
>> to make sure that they do the expected action on the very first WFI. So,
>> shouldn't the order above be:
>>
>> Write to halt_cpu*_events
>> Write to cpu*_csr
>> power_on
>
> Yeah, that was my original expectation as well. But
>
> diff --git a/arch/arm/cpu/armv7/tegra124/ap.c b/arch/arm/cpu/armv7/tegra124/ap.c
> index eebc0ea..240c71d 100644
> --- a/arch/arm/cpu/armv7/tegra124/ap.c
> +++ b/arch/arm/cpu/armv7/tegra124/ap.c
> @@ -25,10 +25,6 @@ void ap_pm_init(void)
>
> writel((u32)park_cpu, EXCEP_VECTOR_CPU_RESET_VECTOR);
>
> - tegra_powergate_power_on(TEGRA_POWERGATE_CPU1);
> - tegra_powergate_power_on(TEGRA_POWERGATE_CPU2);
> - tegra_powergate_power_on(TEGRA_POWERGATE_CPU3);
> -
> writel((2 << CSR_WAIT_WFI_SHIFT) | CSR_ENABLE, &flow->cpu1_csr);
> writel((4 << CSR_WAIT_WFI_SHIFT) | CSR_ENABLE, &flow->cpu2_csr);
> writel((8 << CSR_WAIT_WFI_SHIFT) | CSR_ENABLE, &flow->cpu3_csr);
> @@ -37,6 +33,10 @@ void ap_pm_init(void)
> writel(EVENT_MODE_STOP, &flow->halt_cpu2_events);
> writel(EVENT_MODE_STOP, &flow->halt_cpu3_events);
>
> + tegra_powergate_power_on(TEGRA_POWERGATE_CPU1);
> + tegra_powergate_power_on(TEGRA_POWERGATE_CPU2);
> + tegra_powergate_power_on(TEGRA_POWERGATE_CPU3);
> +
> while (readl(&pmc->pmc_pwrgate_status) & ((1 << TEGRA_POWERGATE_CPU1) |
> (1 << TEGRA_POWERGATE_CPU2) |
> (1 << TEGRA_POWERGATE_CPU3)))
>
> doesn't work in practice. I suspect the power-on overwrites what the
> flow controller configures in the PMC beforehand. But maybe someone can
> explain this better than me.
Thierry, Peter, can you comment on why that is, and whether the original
code sequence is safe; does it matter that the target CPU executes WFI
before the flow controller is configured what to do on WFI?
next prev parent reply other threads:[~2015-02-18 16:34 UTC|newest]
Thread overview: 55+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-02-16 12:54 [U-Boot] [PATCH v2 00/12] Add PSCI support for Jetson TK1/Tegra124 + CNTFRQ fix Jan Kiszka
2015-02-16 12:54 ` [U-Boot] [PATCH v2 01/12] ARM: Factor out reusable psci_cpu_off_common Jan Kiszka
2015-02-16 12:54 ` [U-Boot] [PATCH v2 02/12] ARM: Factor out reusable psci_cpu_entry Jan Kiszka
2015-02-16 12:54 ` [U-Boot] [PATCH v2 03/12] ARM: Factor out reusable psci_get_cpu_stack_top Jan Kiszka
2015-02-16 12:54 ` [U-Boot] [PATCH v2 04/12] ARM: Put target PC for PSCI CPU_ON on per-CPU stack Jan Kiszka
2015-02-16 12:54 ` [U-Boot] [PATCH v2 05/12] tegra124: Add more registers to struct mc_ctlr Jan Kiszka
2015-02-16 12:54 ` [U-Boot] [PATCH v2 06/12] virt-dt: Allow reservation of the secure region when it is in a RAM carveout Jan Kiszka
2015-02-16 13:42 ` Mark Rutland
2015-02-16 13:51 ` Jan Kiszka
2015-02-16 14:25 ` Mark Rutland
2015-02-16 14:31 ` Jan Kiszka
2015-02-16 14:56 ` Mark Rutland
2015-02-16 15:38 ` Jan Kiszka
2015-02-17 8:09 ` Jan Kiszka
2015-02-17 10:46 ` Mark Rutland
2015-02-17 11:32 ` Jan Kiszka
2015-02-17 11:55 ` Mark Rutland
2015-02-19 8:28 ` Thierry Reding
2015-02-19 9:19 ` Ian Campbell
2015-02-19 9:25 ` Jan Kiszka
2015-02-19 10:13 ` Ian Campbell
2015-02-19 13:49 ` Mark Rutland
2015-02-19 10:22 ` Thierry Reding
2015-02-19 13:42 ` Mark Rutland
2015-02-19 10:34 ` Thierry Reding
2015-02-19 11:17 ` Jan Kiszka
2015-02-16 12:54 ` [U-Boot] [PATCH v2 07/12] tegra: Make tegra_powergate_power_on public Jan Kiszka
2015-02-16 12:54 ` [U-Boot] [PATCH v2 08/12] tegra: Add ap_pm_init hook Jan Kiszka
2015-02-16 12:54 ` [U-Boot] [PATCH v2 09/12] tegra124: Add PSCI support for Tegra124 Jan Kiszka
2015-02-17 21:03 ` Stephen Warren
2015-02-18 6:13 ` Jan Kiszka
2015-02-18 16:34 ` Stephen Warren [this message]
2015-02-19 9:14 ` Thierry Reding
2015-02-20 9:36 ` Jan Kiszka
2015-02-24 7:23 ` Jan Kiszka
2015-02-24 8:18 ` Thierry Reding
2015-02-24 8:23 ` Jan Kiszka
2015-02-19 8:57 ` Thierry Reding
2015-02-19 9:04 ` Thierry Reding
2015-02-16 12:54 ` [U-Boot] [PATCH v2 10/12] jetson-tk1: Add PSCI configuration options and reserve secure code Jan Kiszka
2015-02-17 21:05 ` Stephen Warren
2015-02-18 7:39 ` Jan Kiszka
2015-02-16 12:54 ` [U-Boot] [PATCH v2 11/12] tegra124: Reserve secure RAM using MC_SECURITY_CFG{0, 1}_0 Jan Kiszka
2015-02-16 13:49 ` Mark Rutland
2015-02-16 13:55 ` Jan Kiszka
2015-02-17 21:06 ` Stephen Warren
2015-02-18 7:24 ` Jan Kiszka
2015-02-16 12:54 ` [U-Boot] [PATCH v2 12/12] tegra: Set CNTFRQ for secondary CPUs Jan Kiszka
2015-02-16 13:37 ` Mark Rutland
2015-02-16 13:44 ` Jan Kiszka
2015-02-16 13:51 ` Mark Rutland
2015-02-16 14:02 ` Jan Kiszka
2015-02-17 7:01 ` Jan Kiszka
2015-02-17 10:21 ` Mark Rutland
2015-02-17 10:27 ` Jan Kiszka
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=54E4BF2D.3050103@wwwdotorg.org \
--to=swarren@wwwdotorg.org \
--cc=u-boot@lists.denx.de \
/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