.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
---|
1 | 2 | /* |
---|
2 | 3 | * Renesas R-Car H3 System Controller |
---|
3 | 4 | * |
---|
4 | 5 | * 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. |
---|
9 | 6 | */ |
---|
10 | 7 | |
---|
11 | | -#include <linux/bug.h> |
---|
| 8 | +#include <linux/bits.h> |
---|
12 | 9 | #include <linux/kernel.h> |
---|
13 | 10 | #include <linux/sys_soc.h> |
---|
14 | 11 | |
---|
.. | .. |
---|
54 | 51 | |
---|
55 | 52 | |
---|
56 | 53 | /* |
---|
57 | | - * Fixups for R-Car H3 revisions after ES1.x |
---|
| 54 | + * Fixups for R-Car H3 revisions |
---|
58 | 55 | */ |
---|
59 | 56 | |
---|
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 | + }, |
---|
62 | 68 | { /* sentinel */ } |
---|
63 | 69 | }; |
---|
64 | 70 | |
---|
65 | 71 | static int __init r8a7795_sysc_init(void) |
---|
66 | 72 | { |
---|
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)) |
---|
68 | 81 | rcar_sysc_nullify(r8a7795_areas, ARRAY_SIZE(r8a7795_areas), |
---|
69 | 82 | R8A7795_PD_A2VC0); |
---|
| 83 | + |
---|
| 84 | + if (quirks & NO_EXTMASK) |
---|
| 85 | + r8a7795_sysc_info.extmask_val = 0; |
---|
70 | 86 | |
---|
71 | 87 | return 0; |
---|
72 | 88 | } |
---|
73 | 89 | |
---|
74 | | -const struct rcar_sysc_info r8a7795_sysc_info __initconst = { |
---|
| 90 | +struct rcar_sysc_info r8a7795_sysc_info __initdata = { |
---|
75 | 91 | .init = r8a7795_sysc_init, |
---|
76 | 92 | .areas = r8a7795_areas, |
---|
77 | 93 | .num_areas = ARRAY_SIZE(r8a7795_areas), |
---|
| 94 | + .extmask_offs = 0x2f8, |
---|
| 95 | + .extmask_val = BIT(0), |
---|
78 | 96 | }; |
---|