hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/soc/renesas/r8a7795-sysc.c
....@@ -1,14 +1,11 @@
1
+// SPDX-License-Identifier: GPL-2.0
12 /*
23 * Renesas R-Car H3 System Controller
34 *
45 * Copyright (C) 2016-2017 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.
96 */
107
11
-#include <linux/bug.h>
8
+#include <linux/bits.h>
129 #include <linux/kernel.h>
1310 #include <linux/sys_soc.h>
1411
....@@ -54,25 +51,46 @@
5451
5552
5653 /*
57
- * Fixups for R-Car H3 revisions after ES1.x
54
+ * Fixups for R-Car H3 revisions
5855 */
5956
60
-static const struct soc_device_attribute r8a7795es1[] __initconst = {
61
- { .soc_id = "r8a7795", .revision = "ES1.*" },
57
+#define HAS_A2VC0 BIT(0) /* Power domain A2VC0 is present */
58
+#define NO_EXTMASK BIT(1) /* Missing SYSCEXTMASK register */
59
+
60
+static const struct soc_device_attribute r8a7795_quirks_match[] __initconst = {
61
+ {
62
+ .soc_id = "r8a7795", .revision = "ES1.*",
63
+ .data = (void *)(HAS_A2VC0 | NO_EXTMASK),
64
+ }, {
65
+ .soc_id = "r8a7795", .revision = "ES2.*",
66
+ .data = (void *)(NO_EXTMASK),
67
+ },
6268 { /* sentinel */ }
6369 };
6470
6571 static int __init r8a7795_sysc_init(void)
6672 {
67
- if (!soc_device_match(r8a7795es1))
73
+ const struct soc_device_attribute *attr;
74
+ u32 quirks = 0;
75
+
76
+ attr = soc_device_match(r8a7795_quirks_match);
77
+ if (attr)
78
+ quirks = (uintptr_t)attr->data;
79
+
80
+ if (!(quirks & HAS_A2VC0))
6881 rcar_sysc_nullify(r8a7795_areas, ARRAY_SIZE(r8a7795_areas),
6982 R8A7795_PD_A2VC0);
83
+
84
+ if (quirks & NO_EXTMASK)
85
+ r8a7795_sysc_info.extmask_val = 0;
7086
7187 return 0;
7288 }
7389
74
-const struct rcar_sysc_info r8a7795_sysc_info __initconst = {
90
+struct rcar_sysc_info r8a7795_sysc_info __initdata = {
7591 .init = r8a7795_sysc_init,
7692 .areas = r8a7795_areas,
7793 .num_areas = ARRAY_SIZE(r8a7795_areas),
94
+ .extmask_offs = 0x2f8,
95
+ .extmask_val = BIT(0),
7896 };