Lines Matching +full:scu +full:- +full:pd
1 // SPDX-License-Identifier: GPL-2.0
3 * Renesas R-Car V3U System Controller
22 #include <dt-bindings/power/r8a779a0-sysc.h>
28 #define PD_SCU BIT(1) /* Area contains SCU and L2 cache */
32 #define PD_ALWAYS_ON PD_NO_CR /* Always-on area */
40 int parent; /* -1 if none */
45 * SoC-specific Power Area Description
53 { "always-on", R8A779A0_PD_ALWAYS_ON, -1, PD_ALWAYS_ON },
68 { "3dg-a", R8A779A0_PD_3DG_A, R8A779A0_PD_ALWAYS_ON },
69 { "3dg-b", R8A779A0_PD_3DG_B, R8A779A0_PD_3DG_A },
106 #define SYSCPONSR(x) (0x800 + ((x) * 0x4)) /* Power-ON Status Register 0 */
107 #define SYSCPOFFSR(x) (0x808 + ((x) * 0x4)) /* Power-OFF Status Register */
119 #define PWRON_PWROFF BIT(0) /* Power-ON/OFF request */
125 #define PDRSR_OFF BIT(0) /* Power-OFF state */
126 #define PDRSR_ON BIT(4) /* Power-ON state */
127 #define PDRSR_OFF_STATE BIT(8) /* Processing Power-OFF sequence */
128 #define PDRSR_ON_STATE BIT(12) /* Processing Power-ON sequence */
162 return -EAGAIN; in r8a779a0_sysc_pwr_on_off()
182 return -EIO; in clear_irq_flags()
232 ret = -EIO; in r8a779a0_sysc_power()
241 ret = -EIO; in r8a779a0_sysc_power()
253 pr_debug("sysc power %s domain %d: %08x -> %d\n", on ? "on" : "off", in r8a779a0_sysc_power()
284 struct r8a779a0_sysc_pd *pd = to_r8a779a0_pd(genpd); in r8a779a0_sysc_pd_power_off() local
286 pr_debug("%s: %s\n", __func__, genpd->name); in r8a779a0_sysc_pd_power_off()
287 return r8a779a0_sysc_power(pd->pdr, false); in r8a779a0_sysc_pd_power_off()
292 struct r8a779a0_sysc_pd *pd = to_r8a779a0_pd(genpd); in r8a779a0_sysc_pd_power_on() local
294 pr_debug("%s: %s\n", __func__, genpd->name); in r8a779a0_sysc_pd_power_on()
295 return r8a779a0_sysc_power(pd->pdr, true); in r8a779a0_sysc_pd_power_on()
298 static int __init r8a779a0_sysc_pd_setup(struct r8a779a0_sysc_pd *pd) in r8a779a0_sysc_pd_setup() argument
300 struct generic_pm_domain *genpd = &pd->genpd; in r8a779a0_sysc_pd_setup()
301 const char *name = pd->genpd.name; in r8a779a0_sysc_pd_setup()
304 if (pd->flags & PD_CPU) { in r8a779a0_sysc_pd_setup()
310 genpd->flags |= GENPD_FLAG_ALWAYS_ON; in r8a779a0_sysc_pd_setup()
311 } else if (pd->flags & PD_SCU) { in r8a779a0_sysc_pd_setup()
313 * This domain contains an SCU and cache-controller, and in r8a779a0_sysc_pd_setup()
317 pr_debug("PM domain %s contains %s\n", name, "SCU"); in r8a779a0_sysc_pd_setup()
318 genpd->flags |= GENPD_FLAG_ALWAYS_ON; in r8a779a0_sysc_pd_setup()
319 } else if (pd->flags & PD_NO_CR) { in r8a779a0_sysc_pd_setup()
323 genpd->flags |= GENPD_FLAG_ALWAYS_ON; in r8a779a0_sysc_pd_setup()
326 if (!(pd->flags & (PD_CPU | PD_SCU))) { in r8a779a0_sysc_pd_setup()
328 genpd->flags |= GENPD_FLAG_PM_CLK | GENPD_FLAG_ACTIVE_WAKEUP; in r8a779a0_sysc_pd_setup()
329 genpd->attach_dev = cpg_mssr_attach_dev; in r8a779a0_sysc_pd_setup()
330 genpd->detach_dev = cpg_mssr_detach_dev; in r8a779a0_sysc_pd_setup()
333 genpd->power_off = r8a779a0_sysc_pd_power_off; in r8a779a0_sysc_pd_setup()
334 genpd->power_on = r8a779a0_sysc_pd_power_on; in r8a779a0_sysc_pd_setup()
336 if (pd->flags & (PD_CPU | PD_NO_CR)) { in r8a779a0_sysc_pd_setup()
338 pr_debug("%s: Not touching %s\n", __func__, genpd->name); in r8a779a0_sysc_pd_setup()
342 if (!r8a779a0_sysc_power_is_off(pd->pdr)) { in r8a779a0_sysc_pd_setup()
343 pr_debug("%s: %s is already powered\n", __func__, genpd->name); in r8a779a0_sysc_pd_setup()
347 r8a779a0_sysc_power(pd->pdr, true); in r8a779a0_sysc_pd_setup()
358 { .compatible = "renesas,r8a779a0-sysc", .data = &r8a779a0_sysc_info },
381 return -ENODEV; in r8a779a0_sysc_pd_init()
383 info = match->data; in r8a779a0_sysc_pd_init()
388 error = -ENOMEM; in r8a779a0_sysc_pd_init()
396 error = -ENOMEM; in r8a779a0_sysc_pd_init()
400 domains->onecell_data.domains = domains->domains; in r8a779a0_sysc_pd_init()
401 domains->onecell_data.num_domains = ARRAY_SIZE(domains->domains); in r8a779a0_sysc_pd_init()
402 r8a779a0_sysc_onecell_data = &domains->onecell_data; in r8a779a0_sysc_pd_init()
404 for (i = 0; i < info->num_areas; i++) { in r8a779a0_sysc_pd_init()
405 const struct r8a779a0_sysc_area *area = &info->areas[i]; in r8a779a0_sysc_pd_init()
406 struct r8a779a0_sysc_pd *pd; in r8a779a0_sysc_pd_init() local
408 if (!area->name) { in r8a779a0_sysc_pd_init()
413 pd = kzalloc(sizeof(*pd) + strlen(area->name) + 1, GFP_KERNEL); in r8a779a0_sysc_pd_init()
414 if (!pd) { in r8a779a0_sysc_pd_init()
415 error = -ENOMEM; in r8a779a0_sysc_pd_init()
419 strcpy(pd->name, area->name); in r8a779a0_sysc_pd_init()
420 pd->genpd.name = pd->name; in r8a779a0_sysc_pd_init()
421 pd->pdr = area->pdr; in r8a779a0_sysc_pd_init()
422 pd->flags = area->flags; in r8a779a0_sysc_pd_init()
424 error = r8a779a0_sysc_pd_setup(pd); in r8a779a0_sysc_pd_init()
428 domains->domains[area->pdr] = &pd->genpd; in r8a779a0_sysc_pd_init()
430 if (area->parent < 0) in r8a779a0_sysc_pd_init()
433 error = pm_genpd_add_subdomain(domains->domains[area->parent], in r8a779a0_sysc_pd_init()
434 &pd->genpd); in r8a779a0_sysc_pd_init()
437 area->name, area->parent); in r8a779a0_sysc_pd_init()
442 error = of_genpd_add_provider_onecell(np, &domains->onecell_data); in r8a779a0_sysc_pd_init()