blob: 8d861c1cfdf78b6f03b43922ec644a2a45d2577c [file] [log] [blame]
Nishad Kamdar107539f2020-01-18 18:19:00 +05301/* SPDX-License-Identifier: GPL-2.0 */
2/*
Geert Uytterhoevendcc09fd2016-04-20 14:02:38 +02003 * Renesas R-Car System Controller
4 *
5 * Copyright (C) 2016 Glider bvba
Geert Uytterhoevendcc09fd2016-04-20 14:02:38 +02006 */
7#ifndef __SOC_RENESAS_RCAR_SYSC_H__
8#define __SOC_RENESAS_RCAR_SYSC_H__
9
10#include <linux/types.h>
11
12
13/*
14 * Power Domain flags
15 */
16#define PD_CPU BIT(0) /* Area contains main CPU core */
17#define PD_SCU BIT(1) /* Area contains SCU and L2 cache */
18#define PD_NO_CR BIT(2) /* Area lacks PWR{ON,OFF}CR registers */
19
Geert Uytterhoevendcc09fd2016-04-20 14:02:38 +020020#define PD_CPU_CR PD_CPU /* CPU area has CR (R-Car H1) */
21#define PD_CPU_NOCR PD_CPU | PD_NO_CR /* CPU area lacks CR (R-Car Gen2/3) */
22#define PD_ALWAYS_ON PD_NO_CR /* Always-on area */
23
24
25/*
26 * Description of a Power Area
27 */
28
29struct rcar_sysc_area {
30 const char *name;
31 u16 chan_offs; /* Offset of PWRSR register for this area */
32 u8 chan_bit; /* Bit in PWR* (except for PWRUP in PWRSR) */
33 u8 isr_bit; /* Bit in SYSCI*R */
34 int parent; /* -1 if none */
35 unsigned int flags; /* See PD_* */
36};
37
38
39/*
40 * SoC-specific Power Area Description
41 */
42
43struct rcar_sysc_info {
Geert Uytterhoevenafa6f532017-03-31 11:01:55 +020044 int (*init)(void); /* Optional */
Geert Uytterhoevendcc09fd2016-04-20 14:02:38 +020045 const struct rcar_sysc_area *areas;
46 unsigned int num_areas;
Geert Uytterhoeven44b51002019-08-28 13:36:12 +020047 /* Optional External Request Mask Register */
48 u32 extmask_offs; /* SYSCEXTMASK register offset */
49 u32 extmask_val; /* SYSCEXTMASK register mask value */
Geert Uytterhoevendcc09fd2016-04-20 14:02:38 +020050};
51
Lad Prabhakar5b9fa9c2020-04-23 22:40:43 +010052extern const struct rcar_sysc_info r8a7742_sysc_info;
Sergei Shtylyov603311b2016-10-05 14:35:01 -070053extern const struct rcar_sysc_info r8a7743_sysc_info;
Sergei Shtylyov141723e2016-11-05 00:46:13 +030054extern const struct rcar_sysc_info r8a7745_sysc_info;
Biju Das964f7c02018-03-28 20:26:09 +010055extern const struct rcar_sysc_info r8a77470_sysc_info;
Biju Das7f0e99c2018-08-02 15:53:19 +010056extern const struct rcar_sysc_info r8a774a1_sysc_info;
Biju Das6655c562019-09-23 08:29:40 +010057extern const struct rcar_sysc_info r8a774b1_sysc_info;
Fabrizio Castrof37d2112018-09-10 15:41:27 +010058extern const struct rcar_sysc_info r8a774c0_sysc_info;
Marian-Cristian Rotariuf446ade2020-07-07 17:18:05 +010059extern const struct rcar_sysc_info r8a774e1_sysc_info;
Geert Uytterhoeven9b83ea12016-04-20 14:02:41 +020060extern const struct rcar_sysc_info r8a7779_sysc_info;
Geert Uytterhoevenad7c9db2016-04-20 14:02:42 +020061extern const struct rcar_sysc_info r8a7790_sysc_info;
Geert Uytterhoevenc5fbb3c2016-04-20 14:02:43 +020062extern const struct rcar_sysc_info r8a7791_sysc_info;
Sergei Shtylyov7e49c842016-06-12 23:56:50 +030063extern const struct rcar_sysc_info r8a7792_sysc_info;
Geert Uytterhoeven9af1dbc2016-04-20 14:02:45 +020064extern const struct rcar_sysc_info r8a7794_sysc_info;
Geert Uytterhoeven0e0c4db2019-08-28 13:36:13 +020065extern struct rcar_sysc_info r8a7795_sysc_info;
Geert Uytterhoevenbdde3d32019-10-23 14:33:37 +020066extern const struct rcar_sysc_info r8a77960_sysc_info;
67extern const struct rcar_sysc_info r8a77961_sysc_info;
Jacopo Mondia5277092018-02-20 16:12:06 +010068extern const struct rcar_sysc_info r8a77965_sysc_info;
Sergei Shtylyovbab9b2a2017-09-12 23:37:20 +030069extern const struct rcar_sysc_info r8a77970_sysc_info;
Sergei Shtylyov41d6d8b2018-02-16 21:28:02 +030070extern const struct rcar_sysc_info r8a77980_sysc_info;
Takeshi Kihara44b12d42018-05-15 21:07:38 +090071extern const struct rcar_sysc_info r8a77990_sysc_info;
Geert Uytterhoeveneed17c42017-07-20 14:34:53 +020072extern const struct rcar_sysc_info r8a77995_sysc_info;
Geert Uytterhoevenafa6f532017-03-31 11:01:55 +020073
74
75 /*
76 * Helpers for fixing up power area tables depending on SoC revision
77 */
78
79extern void rcar_sysc_nullify(struct rcar_sysc_area *areas,
80 unsigned int num_areas, u8 id);
81
Geert Uytterhoevendcc09fd2016-04-20 14:02:38 +020082#endif /* __SOC_RENESAS_RCAR_SYSC_H__ */