1 /*
2  * Renesas SCP/MCP Software
3  * Copyright (c) 2020-2021, Renesas Electronics Corporation. All rights
4  * reserved.
5  *
6  * SPDX-License-Identifier: BSD-3-Clause
7  */
8 
9 #include <mmio.h>
10 #include <rcar_core.h>
11 
12 #define PRR (0xFFF00044U)
13 #define PRR_57EN_OFS (27)
14 #define PRR_57EN_MASK (0x0f)
15 #define PRR_53EN_OFS (22)
16 #define PRR_53EN_MASK (0x0f)
17 #define PRR_CAEN_MASK \
18     ((PRR_57EN_MASK << PRR_57EN_OFS) + (PRR_53EN_MASK << PRR_53EN_OFS))
19 #define RCAR_CLUSTER_COUNT  (2)
20 
rcar_core_get_count(void)21 unsigned int rcar_core_get_count(void)
22 {
23     return (__builtin_popcount(
24         (mmio_read_32(PRR) & PRR_CAEN_MASK) ^ PRR_CAEN_MASK));
25 }
26 
rcar_cluster_get_count(void)27 unsigned int rcar_cluster_get_count(void)
28 {
29     return RCAR_CLUSTER_COUNT;
30 }
31