Lines Matching full:scpsys

38 	struct scpsys *scpsys;  member
48 struct scpsys { struct
60 struct scpsys *scpsys = pd->scpsys; in scpsys_domain_is_on() argument
63 regmap_read(scpsys->base, scpsys->soc_data->pwr_sta_offs, &status); in scpsys_domain_is_on()
66 regmap_read(scpsys->base, scpsys->soc_data->pwr_sta2nd_offs, &status2); in scpsys_domain_is_on()
76 struct scpsys *scpsys = pd->scpsys; in scpsys_sram_enable() local
80 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, pd->data->sram_pdn_bits); in scpsys_sram_enable()
83 ret = regmap_read_poll_timeout(scpsys->base, pd->data->ctl_offs, tmp, in scpsys_sram_enable()
89 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_SRAM_ISOINT_B_BIT); in scpsys_sram_enable()
91 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_SRAM_CLKISO_BIT); in scpsys_sram_enable()
100 struct scpsys *scpsys = pd->scpsys; in scpsys_sram_disable() local
104 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_SRAM_CLKISO_BIT); in scpsys_sram_disable()
106 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_SRAM_ISOINT_B_BIT); in scpsys_sram_disable()
109 regmap_set_bits(scpsys->base, pd->data->ctl_offs, pd->data->sram_pdn_bits); in scpsys_sram_disable()
112 return regmap_read_poll_timeout(scpsys->base, pd->data->ctl_offs, tmp, in scpsys_sram_disable()
206 struct scpsys *scpsys = pd->scpsys; in scpsys_power_on() local
219 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_BIT); in scpsys_power_on()
220 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_2ND_BIT); in scpsys_power_on()
228 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_CLK_DIS_BIT); in scpsys_power_on()
229 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_ISO_BIT); in scpsys_power_on()
230 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_RST_B_BIT); in scpsys_power_on()
260 struct scpsys *scpsys = pd->scpsys; in scpsys_power_off() local
275 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_RST_B_BIT); in scpsys_power_off()
276 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_ISO_BIT); in scpsys_power_off()
277 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_CLK_DIS_BIT); in scpsys_power_off()
278 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_2ND_BIT); in scpsys_power_off()
279 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_BIT); in scpsys_power_off()
295 generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_node *node) in scpsys_add_one_domain() argument
299 struct device_node *root_node = scpsys->dev->of_node; in scpsys_add_one_domain()
310 dev_err(scpsys->dev, "%pOF: failed to retrieve domain id from reg: %d\n", in scpsys_add_one_domain()
315 if (id >= scpsys->soc_data->num_domains) { in scpsys_add_one_domain()
316 dev_err(scpsys->dev, "%pOF: invalid domain id %d\n", node, id); in scpsys_add_one_domain()
320 domain_data = &scpsys->soc_data->domains_data[id]; in scpsys_add_one_domain()
322 dev_err(scpsys->dev, "%pOF: undefined domain id %d\n", node, id); in scpsys_add_one_domain()
326 pd = devm_kzalloc(scpsys->dev, sizeof(*pd), GFP_KERNEL); in scpsys_add_one_domain()
331 pd->scpsys = scpsys; in scpsys_add_one_domain()
341 scpsys->dev->of_node = node; in scpsys_add_one_domain()
342 pd->supply = devm_regulator_get(scpsys->dev, "domain"); in scpsys_add_one_domain()
343 scpsys->dev->of_node = root_node; in scpsys_add_one_domain()
345 dev_err_probe(scpsys->dev, PTR_ERR(pd->supply), in scpsys_add_one_domain()
377 pd->clks = devm_kcalloc(scpsys->dev, pd->num_clks, sizeof(*pd->clks), GFP_KERNEL); in scpsys_add_one_domain()
381 pd->subsys_clks = devm_kcalloc(scpsys->dev, pd->num_subsys_clks, in scpsys_add_one_domain()
392 dev_err_probe(scpsys->dev, ret, in scpsys_add_one_domain()
404 dev_err_probe(scpsys->dev, ret, in scpsys_add_one_domain()
421 dev_warn(scpsys->dev, in scpsys_add_one_domain()
426 dev_err(scpsys->dev, "%pOF: failed to power on domain: %d\n", node, ret); in scpsys_add_one_domain()
431 if (scpsys->domains[id]) { in scpsys_add_one_domain()
433 dev_err(scpsys->dev, in scpsys_add_one_domain()
451 scpsys->domains[id] = &pd->genpd; in scpsys_add_one_domain()
453 return scpsys->pd_data.domains[id]; in scpsys_add_one_domain()
462 static int scpsys_add_subdomain(struct scpsys *scpsys, struct device_node *parent) in scpsys_add_subdomain() argument
473 dev_err(scpsys->dev, "%pOF: failed to get parent domain id\n", child); in scpsys_add_subdomain()
477 if (!scpsys->pd_data.domains[id]) { in scpsys_add_subdomain()
479 dev_err(scpsys->dev, "power domain with id %d does not exist\n", id); in scpsys_add_subdomain()
483 parent_pd = scpsys->pd_data.domains[id]; in scpsys_add_subdomain()
485 child_pd = scpsys_add_one_domain(scpsys, child); in scpsys_add_subdomain()
488 dev_err_probe(scpsys->dev, ret, "%pOF: failed to get child domain id\n", in scpsys_add_subdomain()
495 dev_err(scpsys->dev, "failed to add %s subdomain to parent %s\n", in scpsys_add_subdomain()
499 dev_dbg(scpsys->dev, "%s add subdomain: %s\n", parent_pd->name, in scpsys_add_subdomain()
504 ret = scpsys_add_subdomain(scpsys, child); in scpsys_add_subdomain()
529 dev_err(pd->scpsys->dev, in scpsys_remove_one_domain()
537 static void scpsys_domain_cleanup(struct scpsys *scpsys) in scpsys_domain_cleanup() argument
543 for (i = scpsys->pd_data.num_domains - 1; i >= 0; i--) { in scpsys_domain_cleanup()
544 genpd = scpsys->pd_data.domains[i]; in scpsys_domain_cleanup()
579 struct scpsys *scpsys; in scpsys_probe() local
588 scpsys = devm_kzalloc(dev, struct_size(scpsys, domains, soc->num_domains), GFP_KERNEL); in scpsys_probe()
589 if (!scpsys) in scpsys_probe()
592 scpsys->dev = dev; in scpsys_probe()
593 scpsys->soc_data = soc; in scpsys_probe()
595 scpsys->pd_data.domains = scpsys->domains; in scpsys_probe()
596 scpsys->pd_data.num_domains = soc->num_domains; in scpsys_probe()
604 scpsys->base = syscon_node_to_regmap(parent->of_node); in scpsys_probe()
605 if (IS_ERR(scpsys->base)) { in scpsys_probe()
607 return PTR_ERR(scpsys->base); in scpsys_probe()
614 domain = scpsys_add_one_domain(scpsys, node); in scpsys_probe()
621 ret = scpsys_add_subdomain(scpsys, node); in scpsys_probe()
633 ret = of_genpd_add_provider_onecell(np, &scpsys->pd_data); in scpsys_probe()
642 scpsys_domain_cleanup(scpsys); in scpsys_probe()