* [PATCH] ARM: sunxi: Fix CPU powerdown on A83T
@ 2019-10-28 21:49 Ondrej Jirman
2019-10-29 1:09 ` [linux-sunxi] " Chen-Yu Tsai
2019-10-29 8:10 ` Maxime Ripard
0 siblings, 2 replies; 4+ messages in thread
From: Ondrej Jirman @ 2019-10-28 21:49 UTC (permalink / raw)
To: linux-sunxi
Cc: Ondrej Jirman, stable, Maxime Ripard, Chen-Yu Tsai, Russell King,
moderated list:ARM/Allwinner sunXi SoC support, open list
PRCM_PWROFF_GATING_REG has CPU0 at bit 4 on A83T. So without this
patch, instead of gating the CPU0, the whole cluster was power gated,
when shutting down first CPU in the cluster.
Fixes: 6961275e72a8c1 ("ARM: sun8i: smp: Add support for A83T")
Signed-off-by: Ondrej Jirman <megous@megous.com>
Cc: stable@vger.kernel.org
---
arch/arm/mach-sunxi/mc_smp.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/arm/mach-sunxi/mc_smp.c b/arch/arm/mach-sunxi/mc_smp.c
index 239084cf8192..26cbce135338 100644
--- a/arch/arm/mach-sunxi/mc_smp.c
+++ b/arch/arm/mach-sunxi/mc_smp.c
@@ -481,14 +481,18 @@ static void sunxi_mc_smp_cpu_die(unsigned int l_cpu)
static int sunxi_cpu_powerdown(unsigned int cpu, unsigned int cluster)
{
u32 reg;
+ int gating_bit = cpu;
pr_debug("%s: cluster %u cpu %u\n", __func__, cluster, cpu);
if (cpu >= SUNXI_CPUS_PER_CLUSTER || cluster >= SUNXI_NR_CLUSTERS)
return -EINVAL;
+ if (is_a83t && cpu == 0)
+ gating_bit = 4;
+
/* gate processor power */
reg = readl(prcm_base + PRCM_PWROFF_GATING_REG(cluster));
- reg |= PRCM_PWROFF_GATING_REG_CORE(cpu);
+ reg |= PRCM_PWROFF_GATING_REG_CORE(gating_bit);
writel(reg, prcm_base + PRCM_PWROFF_GATING_REG(cluster));
udelay(20);
--
2.23.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [linux-sunxi] [PATCH] ARM: sunxi: Fix CPU powerdown on A83T
2019-10-28 21:49 [PATCH] ARM: sunxi: Fix CPU powerdown on A83T Ondrej Jirman
@ 2019-10-29 1:09 ` Chen-Yu Tsai
2019-10-29 1:25 ` Ondřej Jirman
2019-10-29 8:10 ` Maxime Ripard
1 sibling, 1 reply; 4+ messages in thread
From: Chen-Yu Tsai @ 2019-10-29 1:09 UTC (permalink / raw)
To: Ondřej Jirman
Cc: linux-sunxi, stable, Maxime Ripard, Russell King,
moderated list:ARM/Allwinner sunXi SoC support, open list
On Tue, Oct 29, 2019 at 5:49 AM Ondrej Jirman <megous@megous.com> wrote:
>
> PRCM_PWROFF_GATING_REG has CPU0 at bit 4 on A83T. So without this
> patch, instead of gating the CPU0, the whole cluster was power gated,
> when shutting down first CPU in the cluster.
>
> Fixes: 6961275e72a8c1 ("ARM: sun8i: smp: Add support for A83T")
> Signed-off-by: Ondrej Jirman <megous@megous.com>
> Cc: stable@vger.kernel.org
Acked-by: Chen-Yu Tsai <wens@csie.org>
Though I distinctly remember the BSP had some code dealing with chip
revisions in which the two bits were reversed. :(
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [linux-sunxi] [PATCH] ARM: sunxi: Fix CPU powerdown on A83T
2019-10-29 1:09 ` [linux-sunxi] " Chen-Yu Tsai
@ 2019-10-29 1:25 ` Ondřej Jirman
0 siblings, 0 replies; 4+ messages in thread
From: Ondřej Jirman @ 2019-10-29 1:25 UTC (permalink / raw)
To: Chen-Yu Tsai
Cc: linux-sunxi, stable, Maxime Ripard, Russell King,
moderated list:ARM/Allwinner sunXi SoC support, open list
On Tue, Oct 29, 2019 at 09:09:40AM +0800, Chen-Yu Tsai wrote:
> On Tue, Oct 29, 2019 at 5:49 AM Ondrej Jirman <megous@megous.com> wrote:
> >
> > PRCM_PWROFF_GATING_REG has CPU0 at bit 4 on A83T. So without this
> > patch, instead of gating the CPU0, the whole cluster was power gated,
> > when shutting down first CPU in the cluster.
> >
> > Fixes: 6961275e72a8c1 ("ARM: sun8i: smp: Add support for A83T")
> > Signed-off-by: Ondrej Jirman <megous@megous.com>
> > Cc: stable@vger.kernel.org
>
> Acked-by: Chen-Yu Tsai <wens@csie.org>
>
> Though I distinctly remember the BSP had some code dealing with chip
> revisions in which the two bits were reversed. :(
Actually, it's a bit more complicated. There's a special check in BSP
code (grep for SUN8IW6P1_REV_A) that instead of power gating, just
holds the core in reset for that revision.
regards,
o.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] ARM: sunxi: Fix CPU powerdown on A83T
2019-10-28 21:49 [PATCH] ARM: sunxi: Fix CPU powerdown on A83T Ondrej Jirman
2019-10-29 1:09 ` [linux-sunxi] " Chen-Yu Tsai
@ 2019-10-29 8:10 ` Maxime Ripard
1 sibling, 0 replies; 4+ messages in thread
From: Maxime Ripard @ 2019-10-29 8:10 UTC (permalink / raw)
To: Ondrej Jirman
Cc: linux-sunxi, stable, Chen-Yu Tsai, Russell King,
moderated list:ARM/Allwinner sunXi SoC support, open list
[-- Attachment #1: Type: text/plain, Size: 423 bytes --]
On Mon, Oct 28, 2019 at 10:49:14PM +0100, Ondrej Jirman wrote:
> PRCM_PWROFF_GATING_REG has CPU0 at bit 4 on A83T. So without this
> patch, instead of gating the CPU0, the whole cluster was power gated,
> when shutting down first CPU in the cluster.
>
> Fixes: 6961275e72a8c1 ("ARM: sun8i: smp: Add support for A83T")
> Signed-off-by: Ondrej Jirman <megous@megous.com>
> Cc: stable@vger.kernel.org
Applied, thanks
Maxime
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-10-29 8:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-28 21:49 [PATCH] ARM: sunxi: Fix CPU powerdown on A83T Ondrej Jirman
2019-10-29 1:09 ` [linux-sunxi] " Chen-Yu Tsai
2019-10-29 1:25 ` Ondřej Jirman
2019-10-29 8:10 ` Maxime Ripard
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).