Nishad Kamdar | 107539f | 2020-01-18 18:19:00 +0530 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0 */ |
| 2 | /* |
Geert Uytterhoeven | dcc09fd | 2016-04-20 14:02:38 +0200 | [diff] [blame] | 3 | * Renesas R-Car System Controller |
| 4 | * |
| 5 | * Copyright (C) 2016 Glider bvba |
Geert Uytterhoeven | dcc09fd | 2016-04-20 14:02:38 +0200 | [diff] [blame] | 6 | */ |
| 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 Uytterhoeven | dcc09fd | 2016-04-20 14:02:38 +0200 | [diff] [blame] | 20 | #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 | |
| 29 | struct 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 | |
| 43 | struct rcar_sysc_info { |
Geert Uytterhoeven | afa6f53 | 2017-03-31 11:01:55 +0200 | [diff] [blame] | 44 | int (*init)(void); /* Optional */ |
Geert Uytterhoeven | dcc09fd | 2016-04-20 14:02:38 +0200 | [diff] [blame] | 45 | const struct rcar_sysc_area *areas; |
| 46 | unsigned int num_areas; |
Geert Uytterhoeven | 44b5100 | 2019-08-28 13:36:12 +0200 | [diff] [blame] | 47 | /* Optional External Request Mask Register */ |
| 48 | u32 extmask_offs; /* SYSCEXTMASK register offset */ |
| 49 | u32 extmask_val; /* SYSCEXTMASK register mask value */ |
Geert Uytterhoeven | dcc09fd | 2016-04-20 14:02:38 +0200 | [diff] [blame] | 50 | }; |
| 51 | |
Lad Prabhakar | 5b9fa9c | 2020-04-23 22:40:43 +0100 | [diff] [blame] | 52 | extern const struct rcar_sysc_info r8a7742_sysc_info; |
Sergei Shtylyov | 603311b | 2016-10-05 14:35:01 -0700 | [diff] [blame] | 53 | extern const struct rcar_sysc_info r8a7743_sysc_info; |
Sergei Shtylyov | 141723e | 2016-11-05 00:46:13 +0300 | [diff] [blame] | 54 | extern const struct rcar_sysc_info r8a7745_sysc_info; |
Biju Das | 964f7c0 | 2018-03-28 20:26:09 +0100 | [diff] [blame] | 55 | extern const struct rcar_sysc_info r8a77470_sysc_info; |
Biju Das | 7f0e99c | 2018-08-02 15:53:19 +0100 | [diff] [blame] | 56 | extern const struct rcar_sysc_info r8a774a1_sysc_info; |
Biju Das | 6655c56 | 2019-09-23 08:29:40 +0100 | [diff] [blame] | 57 | extern const struct rcar_sysc_info r8a774b1_sysc_info; |
Fabrizio Castro | f37d211 | 2018-09-10 15:41:27 +0100 | [diff] [blame] | 58 | extern const struct rcar_sysc_info r8a774c0_sysc_info; |
Marian-Cristian Rotariu | f446ade | 2020-07-07 17:18:05 +0100 | [diff] [blame] | 59 | extern const struct rcar_sysc_info r8a774e1_sysc_info; |
Geert Uytterhoeven | 9b83ea1 | 2016-04-20 14:02:41 +0200 | [diff] [blame] | 60 | extern const struct rcar_sysc_info r8a7779_sysc_info; |
Geert Uytterhoeven | ad7c9db | 2016-04-20 14:02:42 +0200 | [diff] [blame] | 61 | extern const struct rcar_sysc_info r8a7790_sysc_info; |
Geert Uytterhoeven | c5fbb3c | 2016-04-20 14:02:43 +0200 | [diff] [blame] | 62 | extern const struct rcar_sysc_info r8a7791_sysc_info; |
Sergei Shtylyov | 7e49c84 | 2016-06-12 23:56:50 +0300 | [diff] [blame] | 63 | extern const struct rcar_sysc_info r8a7792_sysc_info; |
Geert Uytterhoeven | 9af1dbc | 2016-04-20 14:02:45 +0200 | [diff] [blame] | 64 | extern const struct rcar_sysc_info r8a7794_sysc_info; |
Geert Uytterhoeven | 0e0c4db | 2019-08-28 13:36:13 +0200 | [diff] [blame] | 65 | extern struct rcar_sysc_info r8a7795_sysc_info; |
Geert Uytterhoeven | bdde3d3 | 2019-10-23 14:33:37 +0200 | [diff] [blame] | 66 | extern const struct rcar_sysc_info r8a77960_sysc_info; |
| 67 | extern const struct rcar_sysc_info r8a77961_sysc_info; |
Jacopo Mondi | a527709 | 2018-02-20 16:12:06 +0100 | [diff] [blame] | 68 | extern const struct rcar_sysc_info r8a77965_sysc_info; |
Sergei Shtylyov | bab9b2a | 2017-09-12 23:37:20 +0300 | [diff] [blame] | 69 | extern const struct rcar_sysc_info r8a77970_sysc_info; |
Sergei Shtylyov | 41d6d8b | 2018-02-16 21:28:02 +0300 | [diff] [blame] | 70 | extern const struct rcar_sysc_info r8a77980_sysc_info; |
Takeshi Kihara | 44b12d4 | 2018-05-15 21:07:38 +0900 | [diff] [blame] | 71 | extern const struct rcar_sysc_info r8a77990_sysc_info; |
Geert Uytterhoeven | eed17c4 | 2017-07-20 14:34:53 +0200 | [diff] [blame] | 72 | extern const struct rcar_sysc_info r8a77995_sysc_info; |
Geert Uytterhoeven | afa6f53 | 2017-03-31 11:01:55 +0200 | [diff] [blame] | 73 | |
| 74 | |
| 75 | /* |
| 76 | * Helpers for fixing up power area tables depending on SoC revision |
| 77 | */ |
| 78 | |
| 79 | extern void rcar_sysc_nullify(struct rcar_sysc_area *areas, |
| 80 | unsigned int num_areas, u8 id); |
| 81 | |
Geert Uytterhoeven | dcc09fd | 2016-04-20 14:02:38 +0200 | [diff] [blame] | 82 | #endif /* __SOC_RENESAS_RCAR_SYSC_H__ */ |