#include <linux/clk/renesas.h>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/mm.h>
#include <linux/of_address.h>
#include <linux/pm_domain.h>
#include <linux/slab.h>
#include <linux/spinlock.h>
#include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/soc/renesas/rcar-sysc.h>
#include "rcar-sysc.h"
#define SYSCSR …
#define SYSCISR …
#define SYSCISCR …
#define SYSCIER …
#define SYSCIMR …
#define SYSCSR_PONENB …
#define SYSCSR_POFFENB …
#define PWRSR_OFFS …
#define PWROFFCR_OFFS …
#define PWROFFSR_OFFS …
#define PWRONCR_OFFS …
#define PWRONSR_OFFS …
#define PWRER_OFFS …
#define SYSCSR_TIMEOUT …
#define SYSCSR_DELAY_US …
#define PWRER_RETRIES …
#define PWRER_DELAY_US …
#define SYSCISR_TIMEOUT …
#define SYSCISR_DELAY_US …
#define RCAR_PD_ALWAYS_ON …
struct rcar_sysc_pd { … };
static void __iomem *rcar_sysc_base;
static DEFINE_SPINLOCK(rcar_sysc_lock);
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)
{ … }
static int rcar_sysc_power(const struct rcar_sysc_pd *pd, bool on)
{ … }
static bool rcar_sysc_power_is_off(const struct rcar_sysc_pd *pd)
{ … }
static inline struct rcar_sysc_pd *to_rcar_pd(struct generic_pm_domain *d)
{ … }
static int rcar_sysc_pd_power_off(struct generic_pm_domain *genpd)
{ … }
static int rcar_sysc_pd_power_on(struct generic_pm_domain *genpd)
{ … }
static bool has_cpg_mstp;
static int __init rcar_sysc_pd_setup(struct rcar_sysc_pd *pd)
{ … }
static const struct of_device_id rcar_sysc_matches[] __initconst = …;
struct rcar_pm_domains { … };
static struct genpd_onecell_data *rcar_sysc_onecell_data;
static int __init rcar_sysc_pd_init(void)
{ … }
early_initcall(rcar_sysc_pd_init);
#ifdef CONFIG_ARCH_R8A7779
static int rcar_sysc_power_cpu(unsigned int idx, bool on)
{
struct generic_pm_domain *genpd;
struct rcar_sysc_pd *pd;
unsigned int i;
if (!rcar_sysc_onecell_data)
return -ENODEV;
for (i = 0; i < rcar_sysc_onecell_data->num_domains; i++) {
genpd = rcar_sysc_onecell_data->domains[i];
if (!genpd)
continue;
pd = to_rcar_pd(genpd);
if (!(pd->flags & PD_CPU) || pd->chan_bit != idx)
continue;
return rcar_sysc_power(pd, on);
}
return -ENOENT;
}
int rcar_sysc_power_down_cpu(unsigned int cpu)
{
return rcar_sysc_power_cpu(cpu, false);
}
int rcar_sysc_power_up_cpu(unsigned int cpu)
{
return rcar_sysc_power_cpu(cpu, true);
}
#endif