diff options
author | Andreas Färber <afaerber@suse.de> | 2017-06-05 21:04:21 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2017-06-23 17:43:27 +0200 |
commit | 6932ec60cc0a71689150b16b71427cfdc6575602 (patch) | |
tree | 27942772c2ef4d35444d6c4ef7c48e36663d9855 /drivers/soc/actions/owl-sps.c | |
parent | aa9f800ded78d530bb07104a4745e95af723abf6 (diff) |
soc: actions: owl-sps: Factor out owl_sps_set_pg() for power-gating
Allow the SMP code to reuse PM domain code for CPU2/CPU3 wakeup.
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'drivers/soc/actions/owl-sps.c')
-rw-r--r-- | drivers/soc/actions/owl-sps.c | 34 |
1 files changed, 3 insertions, 31 deletions
diff --git a/drivers/soc/actions/owl-sps.c b/drivers/soc/actions/owl-sps.c index 8abb72f01929..875225bfa21c 100644 --- a/drivers/soc/actions/owl-sps.c +++ b/drivers/soc/actions/owl-sps.c @@ -12,15 +12,12 @@ * option) any later version. */ -#include <linux/delay.h> -#include <linux/io.h> #include <linux/of_address.h> #include <linux/of_platform.h> #include <linux/pm_domain.h> +#include <linux/soc/actions/owl-sps.h> #include <dt-bindings/power/owl-s500-powergate.h> -#define OWL_SPS_PG_CTL 0x0 - struct owl_sps_domain_info { const char *name; int pwr_bit; @@ -51,37 +48,12 @@ struct owl_sps_domain { static int owl_sps_set_power(struct owl_sps_domain *pd, bool enable) { - u32 val, pwr_mask, ack_mask; - int timeout; - bool ack; + u32 pwr_mask, ack_mask; ack_mask = BIT(pd->info->ack_bit); pwr_mask = BIT(pd->info->pwr_bit); - val = readl(pd->sps->base + OWL_SPS_PG_CTL); - ack = val & ack_mask; - - if (ack == enable) - return 0; - - if (enable) - val |= pwr_mask; - else - val &= ~pwr_mask; - - writel(val, pd->sps->base + OWL_SPS_PG_CTL); - for (timeout = 5000; timeout > 0; timeout -= 50) { - val = readl(pd->sps->base + OWL_SPS_PG_CTL); - if ((val & ack_mask) == (enable ? ack_mask : 0)) - break; - udelay(50); - } - if (timeout <= 0) - return -ETIMEDOUT; - - udelay(10); - - return 0; + return owl_sps_set_pg(pd->sps->base, pwr_mask, ack_mask, enable); } static int owl_sps_power_on(struct generic_pm_domain *domain) |