Lines Matching full:scpsys
44 struct scpsys *scpsys; member
55 struct scpsys { struct
67 struct scpsys *scpsys = pd->scpsys; in scpsys_domain_is_on() local
70 regmap_read(scpsys->base, pd->data->pwr_sta_offs, &status); in scpsys_domain_is_on()
73 regmap_read(scpsys->base, pd->data->pwr_sta2nd_offs, &status2); in scpsys_domain_is_on()
83 struct scpsys *scpsys = pd->scpsys; in scpsys_sram_enable() local
87 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, pd->data->sram_pdn_bits); in scpsys_sram_enable()
90 ret = regmap_read_poll_timeout(scpsys->base, pd->data->ctl_offs, tmp, in scpsys_sram_enable()
96 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_SRAM_ISOINT_B_BIT); in scpsys_sram_enable()
98 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_SRAM_CLKISO_BIT); in scpsys_sram_enable()
107 struct scpsys *scpsys = pd->scpsys; in scpsys_sram_disable() local
111 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_SRAM_CLKISO_BIT); in scpsys_sram_disable()
113 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_SRAM_ISOINT_B_BIT); in scpsys_sram_disable()
116 regmap_set_bits(scpsys->base, pd->data->ctl_offs, pd->data->sram_pdn_bits); in scpsys_sram_disable()
119 return regmap_read_poll_timeout(scpsys->base, pd->data->ctl_offs, tmp, in scpsys_sram_disable()
237 struct scpsys *scpsys = pd->scpsys; in scpsys_power_on() local
250 regmap_clear_bits(scpsys->base, pd->data->ext_buck_iso_offs, in scpsys_power_on()
254 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_BIT); in scpsys_power_on()
255 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_2ND_BIT); in scpsys_power_on()
263 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_CLK_DIS_BIT); in scpsys_power_on()
264 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_ISO_BIT); in scpsys_power_on()
265 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_RST_B_BIT); in scpsys_power_on()
314 struct scpsys *scpsys = pd->scpsys; in scpsys_power_off() local
327 regmap_set_bits(scpsys->base, pd->data->ext_buck_iso_offs, in scpsys_power_off()
333 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_ISO_BIT); in scpsys_power_off()
334 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_CLK_DIS_BIT); in scpsys_power_off()
335 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_RST_B_BIT); in scpsys_power_off()
336 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_2ND_BIT); in scpsys_power_off()
337 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_BIT); in scpsys_power_off()
353 generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_node *node) in scpsys_add_one_domain() argument
367 dev_err(scpsys->dev, "%pOF: failed to retrieve domain id from reg: %d\n", in scpsys_add_one_domain()
372 if (id >= scpsys->soc_data->num_domains) { in scpsys_add_one_domain()
373 dev_err(scpsys->dev, "%pOF: invalid domain id %d\n", node, id); in scpsys_add_one_domain()
377 domain_data = &scpsys->soc_data->domains_data[id]; in scpsys_add_one_domain()
379 dev_err(scpsys->dev, "%pOF: undefined domain id %d\n", node, id); in scpsys_add_one_domain()
383 pd = devm_kzalloc(scpsys->dev, sizeof(*pd), GFP_KERNEL); in scpsys_add_one_domain()
388 pd->scpsys = scpsys; in scpsys_add_one_domain()
391 pd->supply = devm_of_regulator_get_optional(scpsys->dev, node, "domain"); in scpsys_add_one_domain()
393 return dev_err_cast_probe(scpsys->dev, pd->supply, in scpsys_add_one_domain()
431 pd->clks = devm_kcalloc(scpsys->dev, pd->num_clks, sizeof(*pd->clks), GFP_KERNEL); in scpsys_add_one_domain()
435 pd->subsys_clks = devm_kcalloc(scpsys->dev, pd->num_subsys_clks, in scpsys_add_one_domain()
446 dev_err_probe(scpsys->dev, ret, in scpsys_add_one_domain()
458 dev_err_probe(scpsys->dev, ret, in scpsys_add_one_domain()
475 dev_warn(scpsys->dev, in scpsys_add_one_domain()
480 dev_err(scpsys->dev, "%pOF: failed to power on domain: %d\n", node, ret); in scpsys_add_one_domain()
488 if (scpsys->domains[id]) { in scpsys_add_one_domain()
490 dev_err(scpsys->dev, in scpsys_add_one_domain()
511 scpsys->domains[id] = &pd->genpd; in scpsys_add_one_domain()
513 return scpsys->pd_data.domains[id]; in scpsys_add_one_domain()
522 static int scpsys_add_subdomain(struct scpsys *scpsys, struct device_node *parent) in scpsys_add_subdomain() argument
533 dev_err(scpsys->dev, "%pOF: failed to get parent domain id\n", child); in scpsys_add_subdomain()
537 if (!scpsys->pd_data.domains[id]) { in scpsys_add_subdomain()
539 dev_err(scpsys->dev, "power domain with id %d does not exist\n", id); in scpsys_add_subdomain()
543 parent_pd = scpsys->pd_data.domains[id]; in scpsys_add_subdomain()
545 child_pd = scpsys_add_one_domain(scpsys, child); in scpsys_add_subdomain()
548 dev_err_probe(scpsys->dev, ret, "%pOF: failed to get child domain id\n", in scpsys_add_subdomain()
554 ret = scpsys_add_subdomain(scpsys, child); in scpsys_add_subdomain()
560 dev_err(scpsys->dev, "failed to add %s subdomain to parent %s\n", in scpsys_add_subdomain()
564 dev_dbg(scpsys->dev, "%s add subdomain: %s\n", parent_pd->name, in scpsys_add_subdomain()
586 dev_err(pd->scpsys->dev, in scpsys_remove_one_domain()
596 static void scpsys_domain_cleanup(struct scpsys *scpsys) in scpsys_domain_cleanup() argument
602 for (i = scpsys->pd_data.num_domains - 1; i >= 0; i--) { in scpsys_domain_cleanup()
603 genpd = scpsys->pd_data.domains[i]; in scpsys_domain_cleanup()
662 struct scpsys *scpsys; in scpsys_probe() local
671 scpsys = devm_kzalloc(dev, struct_size(scpsys, domains, soc->num_domains), GFP_KERNEL); in scpsys_probe()
672 if (!scpsys) in scpsys_probe()
675 scpsys->dev = dev; in scpsys_probe()
676 scpsys->soc_data = soc; in scpsys_probe()
678 scpsys->pd_data.domains = scpsys->domains; in scpsys_probe()
679 scpsys->pd_data.num_domains = soc->num_domains; in scpsys_probe()
687 scpsys->base = syscon_node_to_regmap(parent->of_node); in scpsys_probe()
688 if (IS_ERR(scpsys->base)) { in scpsys_probe()
690 return PTR_ERR(scpsys->base); in scpsys_probe()
697 domain = scpsys_add_one_domain(scpsys, node); in scpsys_probe()
704 ret = scpsys_add_subdomain(scpsys, node); in scpsys_probe()
716 ret = of_genpd_add_provider_onecell(np, &scpsys->pd_data); in scpsys_probe()
725 scpsys_domain_cleanup(scpsys); in scpsys_probe()