diff options
author | Philipp Tomsich <philipp.tomsich@theobroma-systems.com> | 2016-08-29 21:43:44 +0200 |
---|---|---|
committer | Klaus Goger <klaus.goger@theobroma-systems.com> | 2016-09-18 15:46:44 +0200 |
commit | ec55fb7961f55a095e16178d597d135e01ece42c (patch) | |
tree | c0ff770e6b26c110bc6385dc3b49f595480f4a19 | |
parent | eb3467e80e7006b7dd028496b612d1570a03881a (diff) |
ARM: sun9i: Update mcpm to common mcpm machinery
-rw-r--r-- | arch/arm/mach-sunxi/mcpm.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/arch/arm/mach-sunxi/mcpm.c b/arch/arm/mach-sunxi/mcpm.c index e74e8aab2560..37e9416b6bf6 100644 --- a/arch/arm/mach-sunxi/mcpm.c +++ b/arch/arm/mach-sunxi/mcpm.c @@ -247,11 +247,34 @@ static int sunxi_cluster_powerup(unsigned int cluster) static void sunxi_cpu_powerdown_prepare(unsigned int cpu, unsigned int cluster) { - gic_cpu_if_down(); + gic_cpu_if_down(0); } +static int sunxi_cluster_powerdown(unsigned int cluster); + static void sunxi_cluster_powerdown_prepare(unsigned int cluster) { + int ret; + u32 reg; + + pr_debug("%s: cluster %u\n", __func__, cluster); + BUG_ON(cluster >= SUNXI_NR_CLUSTERS); + + /* last man standing, assert ACINACTM */ + reg = readl(cpucfg_base + CPUCFG_CX_CTRL_REG1(cluster)); + reg |= CPUCFG_CX_CTRL_REG1_ACINACTM; + writel(reg, cpucfg_base + CPUCFG_CX_CTRL_REG1(cluster)); + + /* wait for cluster L2 WFI */ + ret = readl_poll_timeout(cpucfg_base + CPUCFG_CX_STATUS(cluster), reg, + reg & CPUCFG_CX_STATUS_STANDBYWFIL2, + 1000, 100000); + if (ret) { + pr_warn("%s: cluster %u time out waiting for STANDBYWFIL2\n", + __func__, cluster); + } + + sunxi_cluster_powerdown(cluster); } static void sunxi_cpu_cache_disable(void) @@ -325,7 +348,7 @@ static int sunxi_cluster_powerdown(unsigned int cluster) static int sunxi_wait_for_powerdown(unsigned int cpu, unsigned int cluster) { - int ret; + int ret; u32 reg; pr_debug("%s: cpu %u cluster %u\n", __func__, cpu, cluster); @@ -341,6 +364,7 @@ static int sunxi_wait_for_powerdown(unsigned int cpu, unsigned int cluster) /* power down CPU core */ sunxi_cpu_powerdown(cpu, cluster); +#if 0 if (__mcpm_cluster_state(cluster) != CLUSTER_DOWN) return 0; @@ -360,6 +384,7 @@ static int sunxi_wait_for_powerdown(unsigned int cpu, unsigned int cluster) } sunxi_cluster_powerdown(cluster); +#endif return 0; } |