drivers/pmdomain/renesas/rcar-sysc.c
Source file repositories/reference/linux-study-clean/drivers/pmdomain/renesas/rcar-sysc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pmdomain/renesas/rcar-sysc.c- Extension
.c- Size
- 12940 bytes
- Lines
- 492
- Domain
- Driver Families
- Bucket
- drivers/pmdomain
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/clk/renesas.hlinux/delay.hlinux/err.hlinux/mm.hlinux/of_address.hlinux/pm_domain.hlinux/slab.hlinux/spinlock.hlinux/io.hlinux/iopoll.hlinux/soc/renesas/rcar-sysc.hrcar-sysc.h
Detected Declarations
struct rcar_sysc_pdstruct rcar_pm_domainsfunction rcar_sysc_pwr_on_offfunction rcar_sysc_powerfunction rcar_sysc_power_is_offfunction rcar_sysc_pd_power_offfunction rcar_sysc_pd_power_onfunction rcar_sysc_pd_setupfunction rcar_sysc_pd_initfunction rcar_sysc_pd_init_providerfunction rcar_sysc_power_cpufunction rcar_sysc_power_down_cpufunction rcar_sysc_power_up_cpu
Annotated Snippet
struct rcar_sysc_pd {
struct generic_pm_domain genpd;
u16 chan_offs;
u8 chan_bit;
u8 isr_bit;
unsigned int flags;
char name[];
};
static void __iomem *rcar_sysc_base;
static DEFINE_SPINLOCK(rcar_sysc_lock); /* SMP CPUs + I/O devices */
static u32 rcar_sysc_extmask_offs, rcar_sysc_extmask_val;
static int rcar_sysc_pwr_on_off(const struct rcar_sysc_pd *pd, bool on)
{
unsigned int sr_bit, reg_offs;
u32 val;
int ret;
if (on) {
sr_bit = SYSCSR_PONENB;
reg_offs = PWRONCR_OFFS;
} else {
sr_bit = SYSCSR_POFFENB;
reg_offs = PWROFFCR_OFFS;
}
/* Wait until SYSC is ready to accept a power request */
ret = readl_poll_timeout_atomic(rcar_sysc_base + SYSCSR, val,
val & BIT(sr_bit), SYSCSR_DELAY_US,
SYSCSR_TIMEOUT);
if (ret)
return -EAGAIN;
/* Power-off delay quirk */
if (!on && (pd->flags & PD_OFF_DELAY))
udelay(1);
/* Submit power shutoff or power resume request */
iowrite32(BIT(pd->chan_bit), rcar_sysc_base + pd->chan_offs + reg_offs);
return 0;
}
static int rcar_sysc_power(const struct rcar_sysc_pd *pd, bool on)
{
unsigned int isr_mask = BIT(pd->isr_bit);
unsigned int chan_mask = BIT(pd->chan_bit);
unsigned int status, k;
unsigned long flags;
int ret;
spin_lock_irqsave(&rcar_sysc_lock, flags);
/*
* Mask external power requests for CPU or 3DG domains
*/
if (rcar_sysc_extmask_val) {
iowrite32(rcar_sysc_extmask_val,
rcar_sysc_base + rcar_sysc_extmask_offs);
}
/*
* The interrupt source needs to be enabled, but masked, to prevent the
* CPU from receiving it.
*/
iowrite32(ioread32(rcar_sysc_base + SYSCIMR) | isr_mask,
rcar_sysc_base + SYSCIMR);
iowrite32(ioread32(rcar_sysc_base + SYSCIER) | isr_mask,
rcar_sysc_base + SYSCIER);
iowrite32(isr_mask, rcar_sysc_base + SYSCISCR);
/* Submit power shutoff or resume request until it was accepted */
for (k = 0; k < PWRER_RETRIES; k++) {
ret = rcar_sysc_pwr_on_off(pd, on);
if (ret)
goto out;
status = ioread32(rcar_sysc_base + pd->chan_offs + PWRER_OFFS);
if (!(status & chan_mask))
break;
udelay(PWRER_DELAY_US);
}
if (k == PWRER_RETRIES) {
ret = -EIO;
goto out;
}
Annotation
- Immediate include surface: `linux/clk/renesas.h`, `linux/delay.h`, `linux/err.h`, `linux/mm.h`, `linux/of_address.h`, `linux/pm_domain.h`, `linux/slab.h`, `linux/spinlock.h`.
- Detected declarations: `struct rcar_sysc_pd`, `struct rcar_pm_domains`, `function rcar_sysc_pwr_on_off`, `function rcar_sysc_power`, `function rcar_sysc_power_is_off`, `function rcar_sysc_pd_power_off`, `function rcar_sysc_pd_power_on`, `function rcar_sysc_pd_setup`, `function rcar_sysc_pd_init`, `function rcar_sysc_pd_init_provider`.
- Atlas domain: Driver Families / drivers/pmdomain.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.