18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Renesas R-Car System Controller 48c2ecf20Sopenharmony_ci * 58c2ecf20Sopenharmony_ci * Copyright (C) 2016 Glider bvba 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci#ifndef __SOC_RENESAS_RCAR_SYSC_H__ 88c2ecf20Sopenharmony_ci#define __SOC_RENESAS_RCAR_SYSC_H__ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <linux/types.h> 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci/* 148c2ecf20Sopenharmony_ci * Power Domain flags 158c2ecf20Sopenharmony_ci */ 168c2ecf20Sopenharmony_ci#define PD_CPU BIT(0) /* Area contains main CPU core */ 178c2ecf20Sopenharmony_ci#define PD_SCU BIT(1) /* Area contains SCU and L2 cache */ 188c2ecf20Sopenharmony_ci#define PD_NO_CR BIT(2) /* Area lacks PWR{ON,OFF}CR registers */ 198c2ecf20Sopenharmony_ci 208c2ecf20Sopenharmony_ci#define PD_CPU_CR PD_CPU /* CPU area has CR (R-Car H1) */ 218c2ecf20Sopenharmony_ci#define PD_CPU_NOCR PD_CPU | PD_NO_CR /* CPU area lacks CR (R-Car Gen2/3) */ 228c2ecf20Sopenharmony_ci#define PD_ALWAYS_ON PD_NO_CR /* Always-on area */ 238c2ecf20Sopenharmony_ci 248c2ecf20Sopenharmony_ci 258c2ecf20Sopenharmony_ci/* 268c2ecf20Sopenharmony_ci * Description of a Power Area 278c2ecf20Sopenharmony_ci */ 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_cistruct rcar_sysc_area { 308c2ecf20Sopenharmony_ci const char *name; 318c2ecf20Sopenharmony_ci u16 chan_offs; /* Offset of PWRSR register for this area */ 328c2ecf20Sopenharmony_ci u8 chan_bit; /* Bit in PWR* (except for PWRUP in PWRSR) */ 338c2ecf20Sopenharmony_ci u8 isr_bit; /* Bit in SYSCI*R */ 348c2ecf20Sopenharmony_ci int parent; /* -1 if none */ 358c2ecf20Sopenharmony_ci unsigned int flags; /* See PD_* */ 368c2ecf20Sopenharmony_ci}; 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci 398c2ecf20Sopenharmony_ci/* 408c2ecf20Sopenharmony_ci * SoC-specific Power Area Description 418c2ecf20Sopenharmony_ci */ 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_cistruct rcar_sysc_info { 448c2ecf20Sopenharmony_ci int (*init)(void); /* Optional */ 458c2ecf20Sopenharmony_ci const struct rcar_sysc_area *areas; 468c2ecf20Sopenharmony_ci unsigned int num_areas; 478c2ecf20Sopenharmony_ci /* Optional External Request Mask Register */ 488c2ecf20Sopenharmony_ci u32 extmask_offs; /* SYSCEXTMASK register offset */ 498c2ecf20Sopenharmony_ci u32 extmask_val; /* SYSCEXTMASK register mask value */ 508c2ecf20Sopenharmony_ci}; 518c2ecf20Sopenharmony_ci 528c2ecf20Sopenharmony_ciextern const struct rcar_sysc_info r8a7742_sysc_info; 538c2ecf20Sopenharmony_ciextern const struct rcar_sysc_info r8a7743_sysc_info; 548c2ecf20Sopenharmony_ciextern const struct rcar_sysc_info r8a7745_sysc_info; 558c2ecf20Sopenharmony_ciextern const struct rcar_sysc_info r8a77470_sysc_info; 568c2ecf20Sopenharmony_ciextern const struct rcar_sysc_info r8a774a1_sysc_info; 578c2ecf20Sopenharmony_ciextern const struct rcar_sysc_info r8a774b1_sysc_info; 588c2ecf20Sopenharmony_ciextern const struct rcar_sysc_info r8a774c0_sysc_info; 598c2ecf20Sopenharmony_ciextern const struct rcar_sysc_info r8a774e1_sysc_info; 608c2ecf20Sopenharmony_ciextern const struct rcar_sysc_info r8a7779_sysc_info; 618c2ecf20Sopenharmony_ciextern const struct rcar_sysc_info r8a7790_sysc_info; 628c2ecf20Sopenharmony_ciextern const struct rcar_sysc_info r8a7791_sysc_info; 638c2ecf20Sopenharmony_ciextern const struct rcar_sysc_info r8a7792_sysc_info; 648c2ecf20Sopenharmony_ciextern const struct rcar_sysc_info r8a7794_sysc_info; 658c2ecf20Sopenharmony_ciextern struct rcar_sysc_info r8a7795_sysc_info; 668c2ecf20Sopenharmony_ciextern const struct rcar_sysc_info r8a77960_sysc_info; 678c2ecf20Sopenharmony_ciextern const struct rcar_sysc_info r8a77961_sysc_info; 688c2ecf20Sopenharmony_ciextern const struct rcar_sysc_info r8a77965_sysc_info; 698c2ecf20Sopenharmony_ciextern const struct rcar_sysc_info r8a77970_sysc_info; 708c2ecf20Sopenharmony_ciextern const struct rcar_sysc_info r8a77980_sysc_info; 718c2ecf20Sopenharmony_ciextern const struct rcar_sysc_info r8a77990_sysc_info; 728c2ecf20Sopenharmony_ciextern const struct rcar_sysc_info r8a77995_sysc_info; 738c2ecf20Sopenharmony_ci 748c2ecf20Sopenharmony_ci 758c2ecf20Sopenharmony_ci /* 768c2ecf20Sopenharmony_ci * Helpers for fixing up power area tables depending on SoC revision 778c2ecf20Sopenharmony_ci */ 788c2ecf20Sopenharmony_ci 798c2ecf20Sopenharmony_ciextern void rcar_sysc_nullify(struct rcar_sysc_area *areas, 808c2ecf20Sopenharmony_ci unsigned int num_areas, u8 id); 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ci#endif /* __SOC_RENESAS_RCAR_SYSC_H__ */ 83