Lines Matching +full:turned +full:- +full:off
1 // SPDX-License-Identifier: GPL-2.0
3 * R-Car Gen4 SYSC Power management support
22 #include "rcar-gen4-sysc.h"
26 #define SYSCPONSR(x) (0x800 + ((x) * 0x4)) /* Power-ON Status Register 0 */
27 #define SYSCPOFFSR(x) (0x808 + ((x) * 0x4)) /* Power-OFF Status Register */
39 #define PWRON_PWROFF BIT(0) /* Power-ON/OFF request */
45 #define PDRSR_OFF BIT(0) /* Power-OFF state */
46 #define PDRSR_ON BIT(4) /* Power-ON state */
47 #define PDRSR_OFF_STATE BIT(8) /* Processing Power-OFF sequence */
48 #define PDRSR_ON_STATE BIT(12) /* Processing Power-ON sequence */
83 return -EAGAIN; in rcar_gen4_sysc_pwr_on_off()
103 return -EIO; in clear_irq_flags()
153 ret = -EIO; in rcar_gen4_sysc_power()
162 ret = -EIO; in rcar_gen4_sysc_power()
174 pr_debug("sysc power %s domain %d: %08x -> %d\n", on ? "on" : "off", in rcar_gen4_sysc_power()
207 pr_debug("%s: %s\n", __func__, genpd->name); in rcar_gen4_sysc_pd_power_off()
208 return rcar_gen4_sysc_power(pd->pdr, false); in rcar_gen4_sysc_pd_power_off()
215 pr_debug("%s: %s\n", __func__, genpd->name); in rcar_gen4_sysc_pd_power_on()
216 return rcar_gen4_sysc_power(pd->pdr, true); in rcar_gen4_sysc_pd_power_on()
221 struct generic_pm_domain *genpd = &pd->genpd; in rcar_gen4_sysc_pd_setup()
222 const char *name = pd->genpd.name; in rcar_gen4_sysc_pd_setup()
225 if (pd->flags & PD_CPU) { in rcar_gen4_sysc_pd_setup()
228 * only be turned off if the CPU is not in use. in rcar_gen4_sysc_pd_setup()
231 genpd->flags |= GENPD_FLAG_ALWAYS_ON; in rcar_gen4_sysc_pd_setup()
232 } else if (pd->flags & PD_SCU) { in rcar_gen4_sysc_pd_setup()
234 * This domain contains an SCU and cache-controller, and in rcar_gen4_sysc_pd_setup()
235 * therefore it should only be turned off if the CPU cores are in rcar_gen4_sysc_pd_setup()
239 genpd->flags |= GENPD_FLAG_ALWAYS_ON; in rcar_gen4_sysc_pd_setup()
240 } else if (pd->flags & PD_NO_CR) { in rcar_gen4_sysc_pd_setup()
242 * This domain cannot be turned off. in rcar_gen4_sysc_pd_setup()
244 genpd->flags |= GENPD_FLAG_ALWAYS_ON; in rcar_gen4_sysc_pd_setup()
247 if (!(pd->flags & (PD_CPU | PD_SCU))) { in rcar_gen4_sysc_pd_setup()
249 genpd->flags |= GENPD_FLAG_PM_CLK | GENPD_FLAG_ACTIVE_WAKEUP; in rcar_gen4_sysc_pd_setup()
250 genpd->attach_dev = cpg_mssr_attach_dev; in rcar_gen4_sysc_pd_setup()
251 genpd->detach_dev = cpg_mssr_detach_dev; in rcar_gen4_sysc_pd_setup()
254 genpd->power_off = rcar_gen4_sysc_pd_power_off; in rcar_gen4_sysc_pd_setup()
255 genpd->power_on = rcar_gen4_sysc_pd_power_on; in rcar_gen4_sysc_pd_setup()
257 if (pd->flags & (PD_CPU | PD_NO_CR)) { in rcar_gen4_sysc_pd_setup()
259 pr_debug("%s: Not touching %s\n", __func__, genpd->name); in rcar_gen4_sysc_pd_setup()
263 if (!rcar_gen4_sysc_power_is_off(pd->pdr)) { in rcar_gen4_sysc_pd_setup()
264 pr_debug("%s: %s is already powered\n", __func__, genpd->name); in rcar_gen4_sysc_pd_setup()
268 rcar_gen4_sysc_power(pd->pdr, true); in rcar_gen4_sysc_pd_setup()
280 { .compatible = "renesas,r8a779a0-sysc", .data = &r8a779a0_sysc_info },
283 { .compatible = "renesas,r8a779f0-sysc", .data = &r8a779f0_sysc_info },
286 { .compatible = "renesas,r8a779g0-sysc", .data = &r8a779g0_sysc_info },
289 { .compatible = "renesas,r8a779h0-sysc", .data = &r8a779h0_sysc_info },
313 return -ENODEV; in rcar_gen4_sysc_pd_init()
315 info = match->data; in rcar_gen4_sysc_pd_init()
320 error = -ENOMEM; in rcar_gen4_sysc_pd_init()
328 error = -ENOMEM; in rcar_gen4_sysc_pd_init()
332 domains->onecell_data.domains = domains->domains; in rcar_gen4_sysc_pd_init()
333 domains->onecell_data.num_domains = ARRAY_SIZE(domains->domains); in rcar_gen4_sysc_pd_init()
334 rcar_gen4_sysc_onecell_data = &domains->onecell_data; in rcar_gen4_sysc_pd_init()
336 for (i = 0; i < info->num_areas; i++) { in rcar_gen4_sysc_pd_init()
337 const struct rcar_gen4_sysc_area *area = &info->areas[i]; in rcar_gen4_sysc_pd_init()
341 if (!area->name) { in rcar_gen4_sysc_pd_init()
346 n = strlen(area->name) + 1; in rcar_gen4_sysc_pd_init()
349 error = -ENOMEM; in rcar_gen4_sysc_pd_init()
353 memcpy(pd->name, area->name, n); in rcar_gen4_sysc_pd_init()
354 pd->genpd.name = pd->name; in rcar_gen4_sysc_pd_init()
355 pd->pdr = area->pdr; in rcar_gen4_sysc_pd_init()
356 pd->flags = area->flags; in rcar_gen4_sysc_pd_init()
362 domains->domains[area->pdr] = &pd->genpd; in rcar_gen4_sysc_pd_init()
364 if (area->parent < 0) in rcar_gen4_sysc_pd_init()
367 error = pm_genpd_add_subdomain(domains->domains[area->parent], in rcar_gen4_sysc_pd_init()
368 &pd->genpd); in rcar_gen4_sysc_pd_init()
371 area->name, area->parent); in rcar_gen4_sysc_pd_init()
376 error = of_genpd_add_provider_onecell(np, &domains->onecell_data); in rcar_gen4_sysc_pd_init()