162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * Renesas R-Car System Controller 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Copyright (C) 2016 Glider bvba 662306a36Sopenharmony_ci */ 762306a36Sopenharmony_ci#ifndef __SOC_RENESAS_RCAR_SYSC_H__ 862306a36Sopenharmony_ci#define __SOC_RENESAS_RCAR_SYSC_H__ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci#include <linux/types.h> 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci/* 1462306a36Sopenharmony_ci * Power Domain flags 1562306a36Sopenharmony_ci */ 1662306a36Sopenharmony_ci#define PD_CPU BIT(0) /* Area contains main CPU core */ 1762306a36Sopenharmony_ci#define PD_SCU BIT(1) /* Area contains SCU and L2 cache */ 1862306a36Sopenharmony_ci#define PD_NO_CR BIT(2) /* Area lacks PWR{ON,OFF}CR registers */ 1962306a36Sopenharmony_ci 2062306a36Sopenharmony_ci#define PD_CPU_CR PD_CPU /* CPU area has CR (R-Car H1) */ 2162306a36Sopenharmony_ci#define PD_CPU_NOCR PD_CPU | PD_NO_CR /* CPU area lacks CR (R-Car Gen2/3) */ 2262306a36Sopenharmony_ci#define PD_ALWAYS_ON PD_NO_CR /* Always-on area */ 2362306a36Sopenharmony_ci 2462306a36Sopenharmony_ci 2562306a36Sopenharmony_ci/* 2662306a36Sopenharmony_ci * Description of a Power Area 2762306a36Sopenharmony_ci */ 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_cistruct rcar_sysc_area { 3062306a36Sopenharmony_ci const char *name; 3162306a36Sopenharmony_ci u16 chan_offs; /* Offset of PWRSR register for this area */ 3262306a36Sopenharmony_ci u8 chan_bit; /* Bit in PWR* (except for PWRUP in PWRSR) */ 3362306a36Sopenharmony_ci u8 isr_bit; /* Bit in SYSCI*R */ 3462306a36Sopenharmony_ci s8 parent; /* -1 if none */ 3562306a36Sopenharmony_ci u8 flags; /* See PD_* */ 3662306a36Sopenharmony_ci}; 3762306a36Sopenharmony_ci 3862306a36Sopenharmony_ci 3962306a36Sopenharmony_ci/* 4062306a36Sopenharmony_ci * SoC-specific Power Area Description 4162306a36Sopenharmony_ci */ 4262306a36Sopenharmony_ci 4362306a36Sopenharmony_cistruct rcar_sysc_info { 4462306a36Sopenharmony_ci int (*init)(void); /* Optional */ 4562306a36Sopenharmony_ci const struct rcar_sysc_area *areas; 4662306a36Sopenharmony_ci unsigned int num_areas; 4762306a36Sopenharmony_ci /* Optional External Request Mask Register */ 4862306a36Sopenharmony_ci u32 extmask_offs; /* SYSCEXTMASK register offset */ 4962306a36Sopenharmony_ci u32 extmask_val; /* SYSCEXTMASK register mask value */ 5062306a36Sopenharmony_ci}; 5162306a36Sopenharmony_ci 5262306a36Sopenharmony_ciextern const struct rcar_sysc_info r8a7742_sysc_info; 5362306a36Sopenharmony_ciextern const struct rcar_sysc_info r8a7743_sysc_info; 5462306a36Sopenharmony_ciextern const struct rcar_sysc_info r8a7745_sysc_info; 5562306a36Sopenharmony_ciextern const struct rcar_sysc_info r8a77470_sysc_info; 5662306a36Sopenharmony_ciextern const struct rcar_sysc_info r8a774a1_sysc_info; 5762306a36Sopenharmony_ciextern const struct rcar_sysc_info r8a774b1_sysc_info; 5862306a36Sopenharmony_ciextern const struct rcar_sysc_info r8a774c0_sysc_info; 5962306a36Sopenharmony_ciextern const struct rcar_sysc_info r8a774e1_sysc_info; 6062306a36Sopenharmony_ciextern const struct rcar_sysc_info r8a7779_sysc_info; 6162306a36Sopenharmony_ciextern const struct rcar_sysc_info r8a7790_sysc_info; 6262306a36Sopenharmony_ciextern const struct rcar_sysc_info r8a7791_sysc_info; 6362306a36Sopenharmony_ciextern const struct rcar_sysc_info r8a7792_sysc_info; 6462306a36Sopenharmony_ciextern const struct rcar_sysc_info r8a7794_sysc_info; 6562306a36Sopenharmony_ciextern struct rcar_sysc_info r8a7795_sysc_info; 6662306a36Sopenharmony_ciextern const struct rcar_sysc_info r8a77960_sysc_info; 6762306a36Sopenharmony_ciextern const struct rcar_sysc_info r8a77961_sysc_info; 6862306a36Sopenharmony_ciextern const struct rcar_sysc_info r8a77965_sysc_info; 6962306a36Sopenharmony_ciextern const struct rcar_sysc_info r8a77970_sysc_info; 7062306a36Sopenharmony_ciextern const struct rcar_sysc_info r8a77980_sysc_info; 7162306a36Sopenharmony_ciextern const struct rcar_sysc_info r8a77990_sysc_info; 7262306a36Sopenharmony_ciextern const struct rcar_sysc_info r8a77995_sysc_info; 7362306a36Sopenharmony_ci 7462306a36Sopenharmony_ci 7562306a36Sopenharmony_ci /* 7662306a36Sopenharmony_ci * Helpers for fixing up power area tables depending on SoC revision 7762306a36Sopenharmony_ci */ 7862306a36Sopenharmony_ci 7962306a36Sopenharmony_ciextern void rcar_sysc_nullify(struct rcar_sysc_area *areas, 8062306a36Sopenharmony_ci unsigned int num_areas, u8 id); 8162306a36Sopenharmony_ci 8262306a36Sopenharmony_ci#endif /* __SOC_RENESAS_RCAR_SYSC_H__ */ 83