Geert Uytterhoeven | dcc09fd | 2016-04-20 14:02:38 +0200 | [diff] [blame] | 1 | /* |
| 2 | * Renesas R-Car System Controller |
| 3 | * |
| 4 | * Copyright (C) 2016 Glider bvba |
| 5 | * |
| 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
| 9 | */ |
| 10 | #ifndef __SOC_RENESAS_RCAR_SYSC_H__ |
| 11 | #define __SOC_RENESAS_RCAR_SYSC_H__ |
| 12 | |
| 13 | #include <linux/types.h> |
| 14 | |
| 15 | |
| 16 | /* |
| 17 | * Power Domain flags |
| 18 | */ |
| 19 | #define PD_CPU BIT(0) /* Area contains main CPU core */ |
| 20 | #define PD_SCU BIT(1) /* Area contains SCU and L2 cache */ |
| 21 | #define PD_NO_CR BIT(2) /* Area lacks PWR{ON,OFF}CR registers */ |
| 22 | |
Geert Uytterhoeven | dcc09fd | 2016-04-20 14:02:38 +0200 | [diff] [blame] | 23 | #define PD_CPU_CR PD_CPU /* CPU area has CR (R-Car H1) */ |
| 24 | #define PD_CPU_NOCR PD_CPU | PD_NO_CR /* CPU area lacks CR (R-Car Gen2/3) */ |
| 25 | #define PD_ALWAYS_ON PD_NO_CR /* Always-on area */ |
| 26 | |
| 27 | |
| 28 | /* |
| 29 | * Description of a Power Area |
| 30 | */ |
| 31 | |
| 32 | struct rcar_sysc_area { |
| 33 | const char *name; |
| 34 | u16 chan_offs; /* Offset of PWRSR register for this area */ |
| 35 | u8 chan_bit; /* Bit in PWR* (except for PWRUP in PWRSR) */ |
| 36 | u8 isr_bit; /* Bit in SYSCI*R */ |
| 37 | int parent; /* -1 if none */ |
| 38 | unsigned int flags; /* See PD_* */ |
| 39 | }; |
| 40 | |
| 41 | |
| 42 | /* |
| 43 | * SoC-specific Power Area Description |
| 44 | */ |
| 45 | |
| 46 | struct rcar_sysc_info { |
Geert Uytterhoeven | afa6f53 | 2017-03-31 11:01:55 +0200 | [diff] [blame] | 47 | int (*init)(void); /* Optional */ |
Geert Uytterhoeven | dcc09fd | 2016-04-20 14:02:38 +0200 | [diff] [blame] | 48 | const struct rcar_sysc_area *areas; |
| 49 | unsigned int num_areas; |
| 50 | }; |
| 51 | |
Sergei Shtylyov | 603311b | 2016-10-05 14:35:01 -0700 | [diff] [blame] | 52 | extern const struct rcar_sysc_info r8a7743_sysc_info; |
Sergei Shtylyov | 141723e | 2016-11-05 00:46:13 +0300 | [diff] [blame] | 53 | extern const struct rcar_sysc_info r8a7745_sysc_info; |
Geert Uytterhoeven | 9b83ea1 | 2016-04-20 14:02:41 +0200 | [diff] [blame] | 54 | extern const struct rcar_sysc_info r8a7779_sysc_info; |
Geert Uytterhoeven | ad7c9db | 2016-04-20 14:02:42 +0200 | [diff] [blame] | 55 | extern const struct rcar_sysc_info r8a7790_sysc_info; |
Geert Uytterhoeven | c5fbb3c | 2016-04-20 14:02:43 +0200 | [diff] [blame] | 56 | extern const struct rcar_sysc_info r8a7791_sysc_info; |
Sergei Shtylyov | 7e49c84 | 2016-06-12 23:56:50 +0300 | [diff] [blame] | 57 | extern const struct rcar_sysc_info r8a7792_sysc_info; |
Geert Uytterhoeven | 9af1dbc | 2016-04-20 14:02:45 +0200 | [diff] [blame] | 58 | extern const struct rcar_sysc_info r8a7794_sysc_info; |
Geert Uytterhoeven | 23f1e2e | 2016-04-20 14:02:46 +0200 | [diff] [blame] | 59 | extern const struct rcar_sysc_info r8a7795_sysc_info; |
Geert Uytterhoeven | e0c98b9 | 2016-05-30 19:05:11 +0200 | [diff] [blame] | 60 | extern const struct rcar_sysc_info r8a7796_sysc_info; |
Sergei Shtylyov | bab9b2a | 2017-09-12 23:37:20 +0300 | [diff] [blame] | 61 | extern const struct rcar_sysc_info r8a77970_sysc_info; |
Sergei Shtylyov | 41d6d8b | 2018-02-16 21:28:02 +0300 | [diff] [blame^] | 62 | extern const struct rcar_sysc_info r8a77980_sysc_info; |
Geert Uytterhoeven | eed17c4 | 2017-07-20 14:34:53 +0200 | [diff] [blame] | 63 | extern const struct rcar_sysc_info r8a77995_sysc_info; |
Geert Uytterhoeven | afa6f53 | 2017-03-31 11:01:55 +0200 | [diff] [blame] | 64 | |
| 65 | |
| 66 | /* |
| 67 | * Helpers for fixing up power area tables depending on SoC revision |
| 68 | */ |
| 69 | |
| 70 | extern void rcar_sysc_nullify(struct rcar_sysc_area *areas, |
| 71 | unsigned int num_areas, u8 id); |
| 72 | |
Geert Uytterhoeven | dcc09fd | 2016-04-20 14:02:38 +0200 | [diff] [blame] | 73 | #endif /* __SOC_RENESAS_RCAR_SYSC_H__ */ |