Lines Matching +full:100 +full:pg

588 	unsigned int retries = 100;  in tegra20_powergate_set()
621 status == true, 1, 100); in tegra114_powergate_set()
629 status == true, 1, 100); in tegra114_powergate_set()
707 static int tegra_powergate_prepare_clocks(struct tegra_powergate *pg) in tegra_powergate_prepare_clocks() argument
709 unsigned long safe_rate = 100 * 1000 * 1000; in tegra_powergate_prepare_clocks()
713 for (i = 0; i < pg->num_clks; i++) { in tegra_powergate_prepare_clocks()
714 pg->clk_rates[i] = clk_get_rate(pg->clks[i]); in tegra_powergate_prepare_clocks()
716 if (!pg->clk_rates[i]) { in tegra_powergate_prepare_clocks()
721 if (pg->clk_rates[i] <= safe_rate) in tegra_powergate_prepare_clocks()
730 err = clk_set_rate(pg->clks[i], safe_rate); in tegra_powergate_prepare_clocks()
739 clk_set_rate(pg->clks[i], pg->clk_rates[i]); in tegra_powergate_prepare_clocks()
744 static int tegra_powergate_unprepare_clocks(struct tegra_powergate *pg) in tegra_powergate_unprepare_clocks() argument
749 for (i = 0; i < pg->num_clks; i++) { in tegra_powergate_unprepare_clocks()
750 err = clk_set_rate(pg->clks[i], pg->clk_rates[i]); in tegra_powergate_unprepare_clocks()
758 static void tegra_powergate_disable_clocks(struct tegra_powergate *pg) in tegra_powergate_disable_clocks() argument
762 for (i = 0; i < pg->num_clks; i++) in tegra_powergate_disable_clocks()
763 clk_disable_unprepare(pg->clks[i]); in tegra_powergate_disable_clocks()
766 static int tegra_powergate_enable_clocks(struct tegra_powergate *pg) in tegra_powergate_enable_clocks() argument
771 for (i = 0; i < pg->num_clks; i++) { in tegra_powergate_enable_clocks()
772 err = clk_prepare_enable(pg->clks[i]); in tegra_powergate_enable_clocks()
781 clk_disable_unprepare(pg->clks[i]); in tegra_powergate_enable_clocks()
786 static int tegra_powergate_power_up(struct tegra_powergate *pg, in tegra_powergate_power_up() argument
791 err = reset_control_assert(pg->reset); in tegra_powergate_power_up()
797 err = tegra_powergate_set(pg->pmc, pg->id, true); in tegra_powergate_power_up()
803 err = tegra_powergate_prepare_clocks(pg); in tegra_powergate_power_up()
807 err = tegra_powergate_enable_clocks(pg); in tegra_powergate_power_up()
813 err = __tegra_powergate_remove_clamping(pg->pmc, pg->id); in tegra_powergate_power_up()
819 err = reset_control_deassert(pg->reset); in tegra_powergate_power_up()
825 if (pg->pmc->soc->needs_mbist_war) in tegra_powergate_power_up()
826 err = tegra210_clk_handle_mbist_war(pg->id); in tegra_powergate_power_up()
831 tegra_powergate_disable_clocks(pg); in tegra_powergate_power_up()
833 err = tegra_powergate_unprepare_clocks(pg); in tegra_powergate_power_up()
840 tegra_powergate_disable_clocks(pg); in tegra_powergate_power_up()
844 tegra_powergate_unprepare_clocks(pg); in tegra_powergate_power_up()
847 tegra_powergate_set(pg->pmc, pg->id, false); in tegra_powergate_power_up()
852 static int tegra_powergate_power_down(struct tegra_powergate *pg) in tegra_powergate_power_down() argument
856 err = tegra_powergate_prepare_clocks(pg); in tegra_powergate_power_down()
860 err = tegra_powergate_enable_clocks(pg); in tegra_powergate_power_down()
866 err = reset_control_assert(pg->reset); in tegra_powergate_power_down()
872 tegra_powergate_disable_clocks(pg); in tegra_powergate_power_down()
876 err = tegra_powergate_set(pg->pmc, pg->id, false); in tegra_powergate_power_down()
880 err = tegra_powergate_unprepare_clocks(pg); in tegra_powergate_power_down()
887 tegra_powergate_enable_clocks(pg); in tegra_powergate_power_down()
889 reset_control_deassert(pg->reset); in tegra_powergate_power_down()
893 tegra_powergate_disable_clocks(pg); in tegra_powergate_power_down()
896 tegra_powergate_unprepare_clocks(pg); in tegra_powergate_power_down()
903 struct tegra_powergate *pg = to_powergate(domain); in tegra_genpd_power_on() local
904 struct device *dev = pg->pmc->dev; in tegra_genpd_power_on()
907 err = tegra_powergate_power_up(pg, true); in tegra_genpd_power_on()
910 pg->genpd.name, err); in tegra_genpd_power_on()
914 reset_control_release(pg->reset); in tegra_genpd_power_on()
922 struct tegra_powergate *pg = to_powergate(domain); in tegra_genpd_power_off() local
923 struct device *dev = pg->pmc->dev; in tegra_genpd_power_off()
926 err = reset_control_acquire(pg->reset); in tegra_genpd_power_off()
929 pg->genpd.name, err); in tegra_genpd_power_off()
933 err = tegra_powergate_power_down(pg); in tegra_genpd_power_off()
936 pg->genpd.name, err); in tegra_genpd_power_off()
937 reset_control_release(pg->reset); in tegra_genpd_power_off()
1006 struct tegra_powergate *pg; in tegra_powergate_sequence_power_up() local
1012 pg = kzalloc(sizeof(*pg), GFP_KERNEL); in tegra_powergate_sequence_power_up()
1013 if (!pg) in tegra_powergate_sequence_power_up()
1016 pg->clk_rates = kzalloc(sizeof(*pg->clk_rates), GFP_KERNEL); in tegra_powergate_sequence_power_up()
1017 if (!pg->clk_rates) { in tegra_powergate_sequence_power_up()
1018 kfree(pg->clks); in tegra_powergate_sequence_power_up()
1022 pg->id = id; in tegra_powergate_sequence_power_up()
1023 pg->clks = &clk; in tegra_powergate_sequence_power_up()
1024 pg->num_clks = 1; in tegra_powergate_sequence_power_up()
1025 pg->reset = rst; in tegra_powergate_sequence_power_up()
1026 pg->pmc = pmc; in tegra_powergate_sequence_power_up()
1028 err = tegra_powergate_power_up(pg, false); in tegra_powergate_sequence_power_up()
1033 kfree(pg->clk_rates); in tegra_powergate_sequence_power_up()
1034 kfree(pg); in tegra_powergate_sequence_power_up()
1192 static int tegra_powergate_of_get_clks(struct tegra_powergate *pg, in tegra_powergate_of_get_clks() argument
1203 pg->clks = kcalloc(count, sizeof(clk), GFP_KERNEL); in tegra_powergate_of_get_clks()
1204 if (!pg->clks) in tegra_powergate_of_get_clks()
1207 pg->clk_rates = kcalloc(count, sizeof(*pg->clk_rates), GFP_KERNEL); in tegra_powergate_of_get_clks()
1208 if (!pg->clk_rates) { in tegra_powergate_of_get_clks()
1209 kfree(pg->clks); in tegra_powergate_of_get_clks()
1214 pg->clks[i] = of_clk_get(np, i); in tegra_powergate_of_get_clks()
1215 if (IS_ERR(pg->clks[i])) { in tegra_powergate_of_get_clks()
1216 err = PTR_ERR(pg->clks[i]); in tegra_powergate_of_get_clks()
1221 pg->num_clks = count; in tegra_powergate_of_get_clks()
1227 clk_put(pg->clks[i]); in tegra_powergate_of_get_clks()
1229 kfree(pg->clk_rates); in tegra_powergate_of_get_clks()
1230 kfree(pg->clks); in tegra_powergate_of_get_clks()
1235 static int tegra_powergate_of_get_resets(struct tegra_powergate *pg, in tegra_powergate_of_get_resets() argument
1238 struct device *dev = pg->pmc->dev; in tegra_powergate_of_get_resets()
1241 pg->reset = of_reset_control_array_get_exclusive_released(np); in tegra_powergate_of_get_resets()
1242 if (IS_ERR(pg->reset)) { in tegra_powergate_of_get_resets()
1243 err = PTR_ERR(pg->reset); in tegra_powergate_of_get_resets()
1248 err = reset_control_acquire(pg->reset); in tegra_powergate_of_get_resets()
1255 err = reset_control_assert(pg->reset); in tegra_powergate_of_get_resets()
1257 err = reset_control_deassert(pg->reset); in tegra_powergate_of_get_resets()
1261 reset_control_release(pg->reset); in tegra_powergate_of_get_resets()
1266 reset_control_release(pg->reset); in tegra_powergate_of_get_resets()
1267 reset_control_put(pg->reset); in tegra_powergate_of_get_resets()
1276 struct tegra_powergate *pg; in tegra_powergate_add() local
1280 pg = kzalloc(sizeof(*pg), GFP_KERNEL); in tegra_powergate_add()
1281 if (!pg) in tegra_powergate_add()
1297 pg->id = id; in tegra_powergate_add()
1298 pg->genpd.name = np->name; in tegra_powergate_add()
1299 pg->genpd.power_off = tegra_genpd_power_off; in tegra_powergate_add()
1300 pg->genpd.power_on = tegra_genpd_power_on; in tegra_powergate_add()
1301 pg->pmc = pmc; in tegra_powergate_add()
1303 off = !tegra_powergate_is_powered(pmc, pg->id); in tegra_powergate_add()
1305 err = tegra_powergate_of_get_clks(pg, np); in tegra_powergate_add()
1311 err = tegra_powergate_of_get_resets(pg, np, off); in tegra_powergate_add()
1319 WARN_ON(tegra_powergate_power_up(pg, true)); in tegra_powergate_add()
1324 err = pm_genpd_init(&pg->genpd, NULL, off); in tegra_powergate_add()
1331 err = of_genpd_add_provider_simple(np, &pg->genpd); in tegra_powergate_add()
1338 dev_dbg(dev, "added PM domain %s\n", pg->genpd.name); in tegra_powergate_add()
1343 pm_genpd_remove(&pg->genpd); in tegra_powergate_add()
1346 reset_control_put(pg->reset); in tegra_powergate_add()
1349 while (pg->num_clks--) in tegra_powergate_add()
1350 clk_put(pg->clks[pg->num_clks]); in tegra_powergate_add()
1352 kfree(pg->clks); in tegra_powergate_add()
1358 kfree(pg); in tegra_powergate_add()
1486 struct tegra_powergate *pg = to_powergate(genpd); in tegra_powergate_remove() local
1488 reset_control_put(pg->reset); in tegra_powergate_remove()
1490 while (pg->num_clks--) in tegra_powergate_remove()
1491 clk_put(pg->clks[pg->num_clks]); in tegra_powergate_remove()
1493 kfree(pg->clks); in tegra_powergate_remove()
1495 set_bit(pg->id, pmc->powergates_available); in tegra_powergate_remove()
1497 kfree(pg); in tegra_powergate_remove()
1749 usleep_range(100, 250); in tegra_io_pad_set_voltage()