Lines Matching full:scpsys

42 	struct scpsys *scpsys;  member
52 struct scpsys { struct
64 struct scpsys *scpsys = pd->scpsys; in scpsys_domain_is_on() local
67 regmap_read(scpsys->base, pd->data->pwr_sta_offs, &status); in scpsys_domain_is_on()
70 regmap_read(scpsys->base, pd->data->pwr_sta2nd_offs, &status2); in scpsys_domain_is_on()
80 struct scpsys *scpsys = pd->scpsys; in scpsys_sram_enable() local
84 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, pd->data->sram_pdn_bits); in scpsys_sram_enable()
87 ret = regmap_read_poll_timeout(scpsys->base, pd->data->ctl_offs, tmp, in scpsys_sram_enable()
93 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_SRAM_ISOINT_B_BIT); in scpsys_sram_enable()
95 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_SRAM_CLKISO_BIT); in scpsys_sram_enable()
104 struct scpsys *scpsys = pd->scpsys; in scpsys_sram_disable() local
108 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_SRAM_CLKISO_BIT); in scpsys_sram_disable()
110 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_SRAM_ISOINT_B_BIT); in scpsys_sram_disable()
113 regmap_set_bits(scpsys->base, pd->data->ctl_offs, pd->data->sram_pdn_bits); in scpsys_sram_disable()
116 return regmap_read_poll_timeout(scpsys->base, pd->data->ctl_offs, tmp, in scpsys_sram_disable()
210 struct scpsys *scpsys = pd->scpsys; in scpsys_power_on() local
223 regmap_clear_bits(scpsys->base, pd->data->ext_buck_iso_offs, in scpsys_power_on()
227 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_BIT); in scpsys_power_on()
228 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_2ND_BIT); in scpsys_power_on()
236 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_CLK_DIS_BIT); in scpsys_power_on()
237 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_ISO_BIT); in scpsys_power_on()
238 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_RST_B_BIT); in scpsys_power_on()
268 struct scpsys *scpsys = pd->scpsys; in scpsys_power_off() local
281 regmap_set_bits(scpsys->base, pd->data->ext_buck_iso_offs, in scpsys_power_off()
287 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_ISO_BIT); in scpsys_power_off()
288 regmap_set_bits(scpsys->base, pd->data->ctl_offs, PWR_CLK_DIS_BIT); in scpsys_power_off()
289 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_RST_B_BIT); in scpsys_power_off()
290 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_2ND_BIT); in scpsys_power_off()
291 regmap_clear_bits(scpsys->base, pd->data->ctl_offs, PWR_ON_BIT); in scpsys_power_off()
307 generic_pm_domain *scpsys_add_one_domain(struct scpsys *scpsys, struct device_node *node) in scpsys_add_one_domain() argument
311 struct device_node *root_node = scpsys->dev->of_node; in scpsys_add_one_domain()
322 dev_err(scpsys->dev, "%pOF: failed to retrieve domain id from reg: %d\n", in scpsys_add_one_domain()
327 if (id >= scpsys->soc_data->num_domains) { in scpsys_add_one_domain()
328 dev_err(scpsys->dev, "%pOF: invalid domain id %d\n", node, id); in scpsys_add_one_domain()
332 domain_data = &scpsys->soc_data->domains_data[id]; in scpsys_add_one_domain()
334 dev_err(scpsys->dev, "%pOF: undefined domain id %d\n", node, id); in scpsys_add_one_domain()
338 pd = devm_kzalloc(scpsys->dev, sizeof(*pd), GFP_KERNEL); in scpsys_add_one_domain()
343 pd->scpsys = scpsys; in scpsys_add_one_domain()
353 scpsys->dev->of_node = node; in scpsys_add_one_domain()
354 pd->supply = devm_regulator_get(scpsys->dev, "domain"); in scpsys_add_one_domain()
355 scpsys->dev->of_node = root_node; in scpsys_add_one_domain()
357 dev_err_probe(scpsys->dev, PTR_ERR(pd->supply), in scpsys_add_one_domain()
389 pd->clks = devm_kcalloc(scpsys->dev, pd->num_clks, sizeof(*pd->clks), GFP_KERNEL); in scpsys_add_one_domain()
393 pd->subsys_clks = devm_kcalloc(scpsys->dev, pd->num_subsys_clks, in scpsys_add_one_domain()
404 dev_err_probe(scpsys->dev, ret, in scpsys_add_one_domain()
416 dev_err_probe(scpsys->dev, ret, in scpsys_add_one_domain()
433 dev_warn(scpsys->dev, in scpsys_add_one_domain()
438 dev_err(scpsys->dev, "%pOF: failed to power on domain: %d\n", node, ret); in scpsys_add_one_domain()
446 if (scpsys->domains[id]) { in scpsys_add_one_domain()
448 dev_err(scpsys->dev, in scpsys_add_one_domain()
469 scpsys->domains[id] = &pd->genpd; in scpsys_add_one_domain()
471 return scpsys->pd_data.domains[id]; in scpsys_add_one_domain()
480 static int scpsys_add_subdomain(struct scpsys *scpsys, struct device_node *parent) in scpsys_add_subdomain() argument
491 dev_err(scpsys->dev, "%pOF: failed to get parent domain id\n", child); in scpsys_add_subdomain()
495 if (!scpsys->pd_data.domains[id]) { in scpsys_add_subdomain()
497 dev_err(scpsys->dev, "power domain with id %d does not exist\n", id); in scpsys_add_subdomain()
501 parent_pd = scpsys->pd_data.domains[id]; in scpsys_add_subdomain()
503 child_pd = scpsys_add_one_domain(scpsys, child); in scpsys_add_subdomain()
506 dev_err_probe(scpsys->dev, ret, "%pOF: failed to get child domain id\n", in scpsys_add_subdomain()
512 ret = scpsys_add_subdomain(scpsys, child); in scpsys_add_subdomain()
518 dev_err(scpsys->dev, "failed to add %s subdomain to parent %s\n", in scpsys_add_subdomain()
522 dev_dbg(scpsys->dev, "%s add subdomain: %s\n", parent_pd->name, in scpsys_add_subdomain()
544 dev_err(pd->scpsys->dev, in scpsys_remove_one_domain()
554 static void scpsys_domain_cleanup(struct scpsys *scpsys) in scpsys_domain_cleanup() argument
560 for (i = scpsys->pd_data.num_domains - 1; i >= 0; i--) { in scpsys_domain_cleanup()
561 genpd = scpsys->pd_data.domains[i]; in scpsys_domain_cleanup()
612 struct scpsys *scpsys; in scpsys_probe() local
621 scpsys = devm_kzalloc(dev, struct_size(scpsys, domains, soc->num_domains), GFP_KERNEL); in scpsys_probe()
622 if (!scpsys) in scpsys_probe()
625 scpsys->dev = dev; in scpsys_probe()
626 scpsys->soc_data = soc; in scpsys_probe()
628 scpsys->pd_data.domains = scpsys->domains; in scpsys_probe()
629 scpsys->pd_data.num_domains = soc->num_domains; in scpsys_probe()
637 scpsys->base = syscon_node_to_regmap(parent->of_node); in scpsys_probe()
638 if (IS_ERR(scpsys->base)) { in scpsys_probe()
640 return PTR_ERR(scpsys->base); in scpsys_probe()
647 domain = scpsys_add_one_domain(scpsys, node); in scpsys_probe()
654 ret = scpsys_add_subdomain(scpsys, node); in scpsys_probe()
666 ret = of_genpd_add_provider_onecell(np, &scpsys->pd_data); in scpsys_probe()
675 scpsys_domain_cleanup(scpsys); in scpsys_probe()