mirror of
https://github.com/torvalds/linux.git
synced 2024-11-27 06:31:52 +00:00
soc: renesas: rcar-sysc: Prepare for fixing power request conflicts
Recent R-Car Gen3 SoCs added an External Request Mask Register to the System Controller (SYSC). This register allows to mask external power requests for CPU or 3DG domains, to prevent conflicts between powering off CPU cores or the 3D Graphics Engine, and changing the state of another power domain through SYSC, which could lead to CPG state machine lock-ups. Add support for making use of this register. Take into account that the register is optional, and that its location and contents are SoC-specific. Note that the issue fixed by this cannot happen in the upstream kernel, as upstream has no support for graphics acceleration yet. SoCs lacking the External Request Mask Register may need a different mitigation in the future. Inspired by a patch in the BSP by Dien Pham <dien.pham.ry@renesas.com>. Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com> Reviewed-by: Simon Horman <horms+renesas@verge.net.au> Link: https://lore.kernel.org/r/20190828113618.6672-2-geert+renesas@glider.be
This commit is contained in:
parent
54ce17dd40
commit
44b5100f7b
@ -63,6 +63,7 @@ struct rcar_sysc_ch {
|
|||||||
|
|
||||||
static void __iomem *rcar_sysc_base;
|
static void __iomem *rcar_sysc_base;
|
||||||
static DEFINE_SPINLOCK(rcar_sysc_lock); /* SMP CPUs + I/O devices */
|
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_ch *sysc_ch, bool on)
|
static int rcar_sysc_pwr_on_off(const struct rcar_sysc_ch *sysc_ch, bool on)
|
||||||
{
|
{
|
||||||
@ -105,6 +106,14 @@ static int rcar_sysc_power(const struct rcar_sysc_ch *sysc_ch, bool on)
|
|||||||
|
|
||||||
spin_lock_irqsave(&rcar_sysc_lock, flags);
|
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
|
* The interrupt source needs to be enabled, but masked, to prevent the
|
||||||
* CPU from receiving it.
|
* CPU from receiving it.
|
||||||
@ -148,6 +157,9 @@ static int rcar_sysc_power(const struct rcar_sysc_ch *sysc_ch, bool on)
|
|||||||
iowrite32(isr_mask, rcar_sysc_base + SYSCISCR);
|
iowrite32(isr_mask, rcar_sysc_base + SYSCISCR);
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
if (rcar_sysc_extmask_val)
|
||||||
|
iowrite32(0, rcar_sysc_base + rcar_sysc_extmask_offs);
|
||||||
|
|
||||||
spin_unlock_irqrestore(&rcar_sysc_lock, flags);
|
spin_unlock_irqrestore(&rcar_sysc_lock, flags);
|
||||||
|
|
||||||
pr_debug("sysc power %s domain %d: %08x -> %d\n", on ? "on" : "off",
|
pr_debug("sysc power %s domain %d: %08x -> %d\n", on ? "on" : "off",
|
||||||
@ -360,6 +372,10 @@ static int __init rcar_sysc_pd_init(void)
|
|||||||
|
|
||||||
rcar_sysc_base = base;
|
rcar_sysc_base = base;
|
||||||
|
|
||||||
|
/* Optional External Request Mask Register */
|
||||||
|
rcar_sysc_extmask_offs = info->extmask_offs;
|
||||||
|
rcar_sysc_extmask_val = info->extmask_val;
|
||||||
|
|
||||||
domains = kzalloc(sizeof(*domains), GFP_KERNEL);
|
domains = kzalloc(sizeof(*domains), GFP_KERNEL);
|
||||||
if (!domains) {
|
if (!domains) {
|
||||||
error = -ENOMEM;
|
error = -ENOMEM;
|
||||||
|
@ -44,6 +44,9 @@ struct rcar_sysc_info {
|
|||||||
int (*init)(void); /* Optional */
|
int (*init)(void); /* Optional */
|
||||||
const struct rcar_sysc_area *areas;
|
const struct rcar_sysc_area *areas;
|
||||||
unsigned int num_areas;
|
unsigned int num_areas;
|
||||||
|
/* Optional External Request Mask Register */
|
||||||
|
u32 extmask_offs; /* SYSCEXTMASK register offset */
|
||||||
|
u32 extmask_val; /* SYSCEXTMASK register mask value */
|
||||||
};
|
};
|
||||||
|
|
||||||
extern const struct rcar_sysc_info r8a7743_sysc_info;
|
extern const struct rcar_sysc_info r8a7743_sysc_info;
|
||||||
|
Loading…
Reference in New Issue
Block a user