Lines Matching full:scpsys

43 	struct scpsys *scpsys;  member
54 struct scpsys { struct
66 struct scpsys *scpsys = pd->scpsys; in scpsys_domain_is_on() argument
69 regmap_read(scpsys->base, pd->data->pwr_sta_offs, &status); in scpsys_domain_is_on()
72 regmap_read(scpsys->base, pd->data->pwr_sta2nd_offs, &status2); in scpsys_domain_is_on()
82 struct scpsys *scpsys = pd->scpsys; in scpsys_sram_enable() local
86 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, pd->data->sram_pdn_bits); in scpsys_sram_enable()
89 ret = regmap_read_poll_timeout(scpsys->base, pd->data->ctl_offs, tmp, in scpsys_sram_enable()
95 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_SRAM_ISOINT_B_BIT); in scpsys_sram_enable()
97 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_SRAM_CLKISO_BIT); in scpsys_sram_enable()
106 struct scpsys *scpsys = pd->scpsys; in scpsys_sram_disable() local
110 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_SRAM_CLKISO_BIT); in scpsys_sram_disable()
112 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_SRAM_ISOINT_B_BIT); in scpsys_sram_disable()
115 regmap_set_bits(scpsys->base, pd->data->ctl_offs, pd->data->sram_pdn_bits); in scpsys_sram_disable()
118 return regmap_read_poll_timeout(scpsys->base, pd->data->ctl_offs, tmp, in scpsys_sram_disable()
236 struct scpsys *scpsys = pd->scpsys; in scpsys_power_on() local
249 regmap_clear_bits(scpsys->base, pd->data->ext_buck_iso_offs, in scpsys_power_on()
253 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_BIT); in scpsys_power_on()
254 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_2ND_BIT); in scpsys_power_on()
262 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_CLK_DIS_BIT); in scpsys_power_on()
263 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_ISO_BIT); in scpsys_power_on()
264 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_RST_B_BIT); in scpsys_power_on()
313 struct scpsys *scpsys = pd->scpsys; in scpsys_power_off() local
326 regmap_set_bits(scpsys->base, pd->data->ext_buck_iso_offs, in scpsys_power_off()
332 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_ISO_BIT); in scpsys_power_off()
333 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_CLK_DIS_BIT); in scpsys_power_off()
334 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_RST_B_BIT); in scpsys_power_off()
335 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_2ND_BIT); in scpsys_power_off()
336 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_BIT); in scpsys_power_off()
352 generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_node *node) in scpsys_add_one_domain() argument
356 struct device_node *root_node = scpsys->dev->of_node; in scpsys_add_one_domain()
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()
398 scpsys->dev->of_node = node; in scpsys_add_one_domain()
399 pd->supply = devm_regulator_get(scpsys->dev, "domain"); in scpsys_add_one_domain()
400 scpsys->dev->of_node = root_node; in scpsys_add_one_domain()
402 return dev_err_cast_probe(scpsys->dev, pd->supply, in scpsys_add_one_domain()
440 pd->clks = devm_kcalloc(scpsys->dev, pd->num_clks, sizeof(*pd->clks), GFP_KERNEL); in scpsys_add_one_domain()
444 pd->subsys_clks = devm_kcalloc(scpsys->dev, pd->num_subsys_clks, in scpsys_add_one_domain()
455 dev_err_probe(scpsys->dev, ret, in scpsys_add_one_domain()
467 dev_err_probe(scpsys->dev, ret, in scpsys_add_one_domain()
484 dev_warn(scpsys->dev, in scpsys_add_one_domain()
489 dev_err(scpsys->dev, "%pOF: failed to power on domain: %d\n", node, ret); in scpsys_add_one_domain()
497 if (scpsys->domains[id]) { in scpsys_add_one_domain()
499 dev_err(scpsys->dev, in scpsys_add_one_domain()
520 scpsys->domains[id] = &pd->genpd; in scpsys_add_one_domain()
522 return scpsys->pd_data.domains[id]; in scpsys_add_one_domain()
531 static int scpsys_add_subdomain(struct scpsys *scpsys, struct device_node *parent) in scpsys_add_subdomain() argument
542 dev_err(scpsys->dev, "%pOF: failed to get parent domain id\n", child); in scpsys_add_subdomain()
546 if (!scpsys->pd_data.domains[id]) { in scpsys_add_subdomain()
548 dev_err(scpsys->dev, "power domain with id %d does not exist\n", id); in scpsys_add_subdomain()
552 parent_pd = scpsys->pd_data.domains[id]; in scpsys_add_subdomain()
554 child_pd = scpsys_add_one_domain(scpsys, child); in scpsys_add_subdomain()
557 dev_err_probe(scpsys->dev, ret, "%pOF: failed to get child domain id\n", in scpsys_add_subdomain()
563 ret = scpsys_add_subdomain(scpsys, child); in scpsys_add_subdomain()
569 dev_err(scpsys->dev, "failed to add %s subdomain to parent %s\n", in scpsys_add_subdomain()
573 dev_dbg(scpsys->dev, "%s add subdomain: %s\n", parent_pd->name, in scpsys_add_subdomain()
595 dev_err(pd->scpsys->dev, in scpsys_remove_one_domain()
605 static void scpsys_domain_cleanup(struct scpsys *scpsys) in scpsys_domain_cleanup() argument
611 for (i = scpsys->pd_data.num_domains - 1; i >= 0; i--) { in scpsys_domain_cleanup()
612 genpd = scpsys->pd_data.domains[i]; in scpsys_domain_cleanup()
667 struct scpsys *scpsys; in scpsys_probe() local
676 scpsys = devm_kzalloc(dev, struct_size(scpsys, domains, soc->num_domains), GFP_KERNEL); in scpsys_probe()
677 if (!scpsys) in scpsys_probe()
680 scpsys->dev = dev; in scpsys_probe()
681 scpsys->soc_data = soc; in scpsys_probe()
683 scpsys->pd_data.domains = scpsys->domains; in scpsys_probe()
684 scpsys->pd_data.num_domains = soc->num_domains; in scpsys_probe()
692 scpsys->base = syscon_node_to_regmap(parent->of_node); in scpsys_probe()
693 if (IS_ERR(scpsys->base)) { in scpsys_probe()
695 return PTR_ERR(scpsys->base); in scpsys_probe()
702 domain = scpsys_add_one_domain(scpsys, node); in scpsys_probe()
709 ret = scpsys_add_subdomain(scpsys, node); in scpsys_probe()
721 ret = of_genpd_add_provider_onecell(np, &scpsys->pd_data); in scpsys_probe()
730 scpsys_domain_cleanup(scpsys); in scpsys_probe()