• Home
  • Raw
  • Download

Lines Matching full:domain

133 	struct imx_pgc_domain *domain = container_of(genpd,  in imx_gpc_pu_pgc_sw_pxx_req()  local
139 const bool has_regulator = !IS_ERR(domain->regulator); in imx_gpc_pu_pgc_sw_pxx_req()
143 regmap_update_bits(domain->regmap, GPC_PGC_CPU_MAPPING, in imx_gpc_pu_pgc_sw_pxx_req()
144 domain->bits.map, domain->bits.map); in imx_gpc_pu_pgc_sw_pxx_req()
147 ret = regulator_enable(domain->regulator); in imx_gpc_pu_pgc_sw_pxx_req()
149 dev_err(domain->dev, "failed to enable regulator\n"); in imx_gpc_pu_pgc_sw_pxx_req()
154 /* Enable reset clocks for all devices in the domain */ in imx_gpc_pu_pgc_sw_pxx_req()
155 for (i = 0; i < domain->num_clks; i++) in imx_gpc_pu_pgc_sw_pxx_req()
156 clk_prepare_enable(domain->clk[i]); in imx_gpc_pu_pgc_sw_pxx_req()
159 regmap_update_bits(domain->regmap, GPC_PGC_CTRL(domain->pgc), in imx_gpc_pu_pgc_sw_pxx_req()
162 if (domain->bits.hsk) in imx_gpc_pu_pgc_sw_pxx_req()
163 regmap_update_bits(domain->regmap, GPC_PU_PWRHSK, in imx_gpc_pu_pgc_sw_pxx_req()
164 domain->bits.hsk, on ? domain->bits.hsk : 0); in imx_gpc_pu_pgc_sw_pxx_req()
166 regmap_update_bits(domain->regmap, offset, in imx_gpc_pu_pgc_sw_pxx_req()
167 domain->bits.pxx, domain->bits.pxx); in imx_gpc_pu_pgc_sw_pxx_req()
173 ret = regmap_read_poll_timeout(domain->regmap, offset, pxx_req, in imx_gpc_pu_pgc_sw_pxx_req()
174 !(pxx_req & domain->bits.pxx), in imx_gpc_pu_pgc_sw_pxx_req()
177 dev_err(domain->dev, "failed to command PGC\n"); in imx_gpc_pu_pgc_sw_pxx_req()
180 * domain and failed we might as well disable in imx_gpc_pu_pgc_sw_pxx_req()
189 regmap_update_bits(domain->regmap, GPC_PGC_CTRL(domain->pgc), in imx_gpc_pu_pgc_sw_pxx_req()
192 /* Disable reset clocks for all devices in the domain */ in imx_gpc_pu_pgc_sw_pxx_req()
193 for (i = 0; i < domain->num_clks; i++) in imx_gpc_pu_pgc_sw_pxx_req()
194 clk_disable_unprepare(domain->clk[i]); in imx_gpc_pu_pgc_sw_pxx_req()
199 err = regulator_disable(domain->regulator); in imx_gpc_pu_pgc_sw_pxx_req()
201 dev_err(domain->dev, in imx_gpc_pu_pgc_sw_pxx_req()
207 regmap_update_bits(domain->regmap, GPC_PGC_CPU_MAPPING, in imx_gpc_pu_pgc_sw_pxx_req()
208 domain->bits.map, 0); in imx_gpc_pu_pgc_sw_pxx_req()
446 static int imx_pgc_get_clocks(struct imx_pgc_domain *domain) in imx_pgc_get_clocks() argument
451 struct clk *clk = of_clk_get(domain->dev->of_node, i); in imx_pgc_get_clocks()
455 dev_err(domain->dev, "more than %d clocks\n", in imx_pgc_get_clocks()
460 domain->clk[i] = clk; in imx_pgc_get_clocks()
462 domain->num_clks = i; in imx_pgc_get_clocks()
468 clk_put(domain->clk[i]); in imx_pgc_get_clocks()
473 static void imx_pgc_put_clocks(struct imx_pgc_domain *domain) in imx_pgc_put_clocks() argument
477 for (i = domain->num_clks - 1; i >= 0; i--) in imx_pgc_put_clocks()
478 clk_put(domain->clk[i]); in imx_pgc_put_clocks()
483 struct imx_pgc_domain *domain = pdev->dev.platform_data; in imx_pgc_domain_probe() local
486 domain->dev = &pdev->dev; in imx_pgc_domain_probe()
488 domain->regulator = devm_regulator_get_optional(domain->dev, "power"); in imx_pgc_domain_probe()
489 if (IS_ERR(domain->regulator)) { in imx_pgc_domain_probe()
490 if (PTR_ERR(domain->regulator) != -ENODEV) in imx_pgc_domain_probe()
491 return dev_err_probe(domain->dev, PTR_ERR(domain->regulator), in imx_pgc_domain_probe()
492 "Failed to get domain's regulator\n"); in imx_pgc_domain_probe()
493 } else if (domain->voltage) { in imx_pgc_domain_probe()
494 regulator_set_voltage(domain->regulator, in imx_pgc_domain_probe()
495 domain->voltage, domain->voltage); in imx_pgc_domain_probe()
498 ret = imx_pgc_get_clocks(domain); in imx_pgc_domain_probe()
500 return dev_err_probe(domain->dev, ret, "Failed to get domain's clocks\n"); in imx_pgc_domain_probe()
502 ret = pm_genpd_init(&domain->genpd, NULL, true); in imx_pgc_domain_probe()
504 dev_err(domain->dev, "Failed to init power domain\n"); in imx_pgc_domain_probe()
505 imx_pgc_put_clocks(domain); in imx_pgc_domain_probe()
509 ret = of_genpd_add_provider_simple(domain->dev->of_node, in imx_pgc_domain_probe()
510 &domain->genpd); in imx_pgc_domain_probe()
512 dev_err(domain->dev, "Failed to add genpd provider\n"); in imx_pgc_domain_probe()
513 pm_genpd_remove(&domain->genpd); in imx_pgc_domain_probe()
514 imx_pgc_put_clocks(domain); in imx_pgc_domain_probe()
522 struct imx_pgc_domain *domain = pdev->dev.platform_data; in imx_pgc_domain_remove() local
524 of_genpd_del_provider(domain->dev->of_node); in imx_pgc_domain_remove()
525 pm_genpd_remove(&domain->genpd); in imx_pgc_domain_remove()
526 imx_pgc_put_clocks(domain); in imx_pgc_domain_remove()
532 { "imx-pgc-domain", },
584 struct imx_pgc_domain *domain; in builtin_platform_driver() local
596 "Domain index %d is out of bounds\n", in builtin_platform_driver()
601 pd_pdev = platform_device_alloc("imx-pgc-domain", in builtin_platform_driver()
618 domain = pd_pdev->dev.platform_data; in builtin_platform_driver()
619 domain->regmap = regmap; in builtin_platform_driver()
620 domain->genpd.power_on = imx_gpc_pu_pgc_sw_pup_req; in builtin_platform_driver()
621 domain->genpd.power_off = imx_gpc_pu_pgc_sw_pdn_req; in builtin_platform_driver()