Lines Matching full:scpsys

41 	struct scpsys *scpsys;  member
51 struct scpsys { struct
63 struct scpsys *scpsys = pd->scpsys; in scpsys_domain_is_on() argument
66 regmap_read(scpsys->base, pd->data->pwr_sta_offs, &status); in scpsys_domain_is_on()
69 regmap_read(scpsys->base, pd->data->pwr_sta2nd_offs, &status2); in scpsys_domain_is_on()
79 struct scpsys *scpsys = pd->scpsys; in scpsys_sram_enable() local
83 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, pd->data->sram_pdn_bits); in scpsys_sram_enable()
86 ret = regmap_read_poll_timeout(scpsys->base, pd->data->ctl_offs, tmp, in scpsys_sram_enable()
92 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_SRAM_ISOINT_B_BIT); in scpsys_sram_enable()
94 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_SRAM_CLKISO_BIT); in scpsys_sram_enable()
103 struct scpsys *scpsys = pd->scpsys; in scpsys_sram_disable() local
107 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_SRAM_CLKISO_BIT); in scpsys_sram_disable()
109 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_SRAM_ISOINT_B_BIT); in scpsys_sram_disable()
112 regmap_set_bits(scpsys->base, pd->data->ctl_offs, pd->data->sram_pdn_bits); in scpsys_sram_disable()
115 return regmap_read_poll_timeout(scpsys->base, pd->data->ctl_offs, tmp, in scpsys_sram_disable()
209 struct scpsys *scpsys = pd->scpsys; in scpsys_power_on() local
222 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_BIT); in scpsys_power_on()
223 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_2ND_BIT); in scpsys_power_on()
231 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_CLK_DIS_BIT); in scpsys_power_on()
232 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_ISO_BIT); in scpsys_power_on()
233 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_RST_B_BIT); in scpsys_power_on()
263 struct scpsys *scpsys = pd->scpsys; in scpsys_power_off() local
278 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_RST_B_BIT); in scpsys_power_off()
279 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_ISO_BIT); in scpsys_power_off()
280 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_CLK_DIS_BIT); in scpsys_power_off()
281 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_2ND_BIT); in scpsys_power_off()
282 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_BIT); in scpsys_power_off()
298 generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_node *node) in scpsys_add_one_domain() argument
302 struct device_node *root_node = scpsys->dev->of_node; in scpsys_add_one_domain()
313 dev_err(scpsys->dev, "%pOF: failed to retrieve domain id from reg: %d\n", in scpsys_add_one_domain()
318 if (id >= scpsys->soc_data->num_domains) { in scpsys_add_one_domain()
319 dev_err(scpsys->dev, "%pOF: invalid domain id %d\n", node, id); in scpsys_add_one_domain()
323 domain_data = &scpsys->soc_data->domains_data[id]; in scpsys_add_one_domain()
325 dev_err(scpsys->dev, "%pOF: undefined domain id %d\n", node, id); in scpsys_add_one_domain()
329 pd = devm_kzalloc(scpsys->dev, sizeof(*pd), GFP_KERNEL); in scpsys_add_one_domain()
334 pd->scpsys = scpsys; in scpsys_add_one_domain()
344 scpsys->dev->of_node = node; in scpsys_add_one_domain()
345 pd->supply = devm_regulator_get(scpsys->dev, "domain"); in scpsys_add_one_domain()
346 scpsys->dev->of_node = root_node; in scpsys_add_one_domain()
348 dev_err_probe(scpsys->dev, PTR_ERR(pd->supply), in scpsys_add_one_domain()
380 pd->clks = devm_kcalloc(scpsys->dev, pd->num_clks, sizeof(*pd->clks), GFP_KERNEL); in scpsys_add_one_domain()
384 pd->subsys_clks = devm_kcalloc(scpsys->dev, pd->num_subsys_clks, in scpsys_add_one_domain()
395 dev_err_probe(scpsys->dev, ret, in scpsys_add_one_domain()
407 dev_err_probe(scpsys->dev, ret, in scpsys_add_one_domain()
424 dev_warn(scpsys->dev, in scpsys_add_one_domain()
429 dev_err(scpsys->dev, "%pOF: failed to power on domain: %d\n", node, ret); in scpsys_add_one_domain()
437 if (scpsys->domains[id]) { in scpsys_add_one_domain()
439 dev_err(scpsys->dev, in scpsys_add_one_domain()
460 scpsys->domains[id] = &pd->genpd; in scpsys_add_one_domain()
462 return scpsys->pd_data.domains[id]; in scpsys_add_one_domain()
471 static int scpsys_add_subdomain(struct scpsys *scpsys, struct device_node *parent) in scpsys_add_subdomain() argument
482 dev_err(scpsys->dev, "%pOF: failed to get parent domain id\n", child); in scpsys_add_subdomain()
486 if (!scpsys->pd_data.domains[id]) { in scpsys_add_subdomain()
488 dev_err(scpsys->dev, "power domain with id %d does not exist\n", id); in scpsys_add_subdomain()
492 parent_pd = scpsys->pd_data.domains[id]; in scpsys_add_subdomain()
494 child_pd = scpsys_add_one_domain(scpsys, child); in scpsys_add_subdomain()
497 dev_err_probe(scpsys->dev, ret, "%pOF: failed to get child domain id\n", in scpsys_add_subdomain()
504 dev_err(scpsys->dev, "failed to add %s subdomain to parent %s\n", in scpsys_add_subdomain()
508 dev_dbg(scpsys->dev, "%s add subdomain: %s\n", parent_pd->name, in scpsys_add_subdomain()
513 ret = scpsys_add_subdomain(scpsys, child); in scpsys_add_subdomain()
538 dev_err(pd->scpsys->dev, in scpsys_remove_one_domain()
546 static void scpsys_domain_cleanup(struct scpsys *scpsys) in scpsys_domain_cleanup() argument
552 for (i = scpsys->pd_data.num_domains - 1; i >= 0; i--) { in scpsys_domain_cleanup()
553 genpd = scpsys->pd_data.domains[i]; in scpsys_domain_cleanup()
600 struct scpsys *scpsys; in scpsys_probe() local
609 scpsys = devm_kzalloc(dev, struct_size(scpsys, domains, soc->num_domains), GFP_KERNEL); in scpsys_probe()
610 if (!scpsys) in scpsys_probe()
613 scpsys->dev = dev; in scpsys_probe()
614 scpsys->soc_data = soc; in scpsys_probe()
616 scpsys->pd_data.domains = scpsys->domains; in scpsys_probe()
617 scpsys->pd_data.num_domains = soc->num_domains; in scpsys_probe()
625 scpsys->base = syscon_node_to_regmap(parent->of_node); in scpsys_probe()
626 if (IS_ERR(scpsys->base)) { in scpsys_probe()
628 return PTR_ERR(scpsys->base); in scpsys_probe()
635 domain = scpsys_add_one_domain(scpsys, node); in scpsys_probe()
642 ret = scpsys_add_subdomain(scpsys, node); in scpsys_probe()
654 ret = of_genpd_add_provider_onecell(np, &scpsys->pd_data); in scpsys_probe()
663 scpsys_domain_cleanup(scpsys); in scpsys_probe()