summaryrefslogtreecommitdiff
path: root/drivers/soc
diff options
context:
space:
mode:
authorDong Aisheng <aisheng.dong@nxp.com>2017-11-27 20:12:36 +0800
committerJason Liu <jason.hui.liu@nxp.com>2019-02-12 10:29:37 +0800
commita68c9467e2ea77df653f9a543758015776fecb91 (patch)
tree6d3470778ea158699c2ff3639d68ec96c41a28c5 /drivers/soc
parenta5c12faa60cdeaab73ba15376799716f0d2481a3 (diff)
MLK-17074-10 soc: imx8: pm-domains: fix missing full intialization for root domain nodes
Current power domain driver only setup all domain callbacks during second level power domains intialization. However, there're also some root power domain nodes having valid SC resource handler which may be used by device as well. Missing to setup them may result in some features lost on these domains. e.g. pd_dc0: PD_DC_0 { compatible = "nxp,imx8-pd"; reg = <SC_R_DC_0>; #power-domain-cells = <0>; #address-cells = <1>; #size-cells = <0>; ... } Reviewed-by: Frank Li <frank.li@nxp.com> Reviewed-by: Ranjani Vaidyanathan <Ranjani.Vaidyanathan@nxp.com> Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com> During 4.14 rebase added dynamic allocation of genpd.states, required by upstream commit 59d65b73a23c ("PM / Domains: Make genpd state allocation dynamic") Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Diffstat (limited to 'drivers/soc')
-rw-r--r--drivers/soc/imx/pm-domains.c37
1 files changed, 22 insertions, 15 deletions
diff --git a/drivers/soc/imx/pm-domains.c b/drivers/soc/imx/pm-domains.c
index 23257b34aa5a..cb4d414247fa 100644
--- a/drivers/soc/imx/pm-domains.c
+++ b/drivers/soc/imx/pm-domains.c
@@ -219,6 +219,24 @@ struct syscore_ops imx8_pm_domains_syscore_ops = {
.resume = imx8_pm_domains_resume,
};
+static void imx8_pd_setup(struct imx8_pm_domain *pd)
+{
+ pd->pd.states = kzalloc(2 * sizeof(struct genpd_power_state), GFP_KERNEL);
+ BUG_ON(!pd->pd.states);
+
+ pd->pd.power_off = imx8_pd_power_off;
+ pd->pd.power_on = imx8_pd_power_on;
+ pd->pd.attach_dev = imx8_attach_dev;
+ pd->pd.detach_dev = imx8_detach_dev;
+
+ pd->pd.states[0].power_off_latency_ns = 25000;
+ pd->pd.states[0].power_on_latency_ns = 25000;
+ pd->pd.states[1].power_off_latency_ns = 2500000;
+ pd->pd.states[1].power_on_latency_ns = 2500000;
+
+ pd->pd.state_count = 2;
+}
+
static int __init imx8_add_pm_domains(struct device_node *parent,
struct generic_pm_domain *genpd_parent)
{
@@ -244,17 +262,7 @@ static int __init imx8_add_pm_domains(struct device_node *parent,
imx8_pd->rsrc_id = rsrc_id;
if (imx8_pd->rsrc_id != SC_R_LAST) {
- imx8_pd->pd.power_off = imx8_pd_power_off;
- imx8_pd->pd.power_on = imx8_pd_power_on;
- imx8_pd->pd.attach_dev = imx8_attach_dev;
- imx8_pd->pd.detach_dev = imx8_detach_dev;
-
- imx8_pd->pd.states[0].power_off_latency_ns = 25000;
- imx8_pd->pd.states[0].power_on_latency_ns = 25000;
- imx8_pd->pd.states[1].power_off_latency_ns = 2500000;
- imx8_pd->pd.states[1].power_on_latency_ns = 2500000;
-
- imx8_pd->pd.state_count = 2;
+ imx8_pd_setup(imx8_pd);
if (of_property_read_bool(np, "early_power_on")
&& index < (sizeof(early_power_on_rsrc) /
@@ -311,10 +319,9 @@ static int __init imx8_init_pm_domains(void)
if (!of_property_read_u32(np, "reg", &rsrc_id))
imx8_pd->rsrc_id = rsrc_id;
- if (imx8_pd->rsrc_id != SC_R_LAST) {
- imx8_pd->pd.power_off = imx8_pd_power_off;
- imx8_pd->pd.power_on = imx8_pd_power_on;
- }
+ if (imx8_pd->rsrc_id != SC_R_LAST)
+ imx8_pd_setup(imx8_pd);
+
INIT_LIST_HEAD(&imx8_pd->clks);
pm_genpd_init(&imx8_pd->pd, NULL, true);