]> Git Repo - J-u-boot.git/blame - arch/arm/mach-rmobile/cpu_info-rcar.c
ARM: rmobile: Convert ifdef in rmobile_get_prr() to IS_ENABLED()
[J-u-boot.git] / arch / arm / mach-rmobile / cpu_info-rcar.c
CommitLineData
83d290c5 1// SPDX-License-Identifier: GPL-2.0
1d0e9278 2/*
9b7fa2fe 3 * arch/arm/cpu/armv7/rmobile/cpu_info-rcar.c
1d0e9278 4 *
9b7fa2fe 5 * Copyright (C) 2013,2014 Renesas Electronics Corporation
1d0e9278
NI
6 */
7#include <common.h>
8#include <asm/io.h>
9
e965c890
MV
10#define PRR_MASK 0x7fff
11#define R8A7796_REV_1_0 0x5200
12#define R8A7796_REV_1_1 0x5210
7d791368 13#define R8A7796_REV_1_3 0x5211
1d0e9278 14
bd6debbc
MV
15static u32 rmobile_get_prr(void)
16{
7fe9d7d1
MV
17 if (IS_ENABLED(CONFIG_RCAR_GEN3))
18 return readl(0xFFF00044);
19
bd6debbc 20 return readl(0xFF000044);
bd6debbc 21}
aff151e5 22
1d0e9278
NI
23u32 rmobile_get_cpu_type(void)
24{
aff151e5 25 return (rmobile_get_prr() & 0x00007F00) >> 8;
1d0e9278
NI
26}
27
28u32 rmobile_get_cpu_rev_integer(void)
29{
aff151e5 30 const u32 prr = rmobile_get_prr();
7d791368 31 const u32 rev = prr & PRR_MASK;
e965c890 32
7d791368 33 if (rev == R8A7796_REV_1_1 || rev == R8A7796_REV_1_3)
e965c890
MV
34 return 1;
35 else
36 return ((prr & 0x000000F0) >> 4) + 1;
1d0e9278 37}
a028abea
NI
38
39u32 rmobile_get_cpu_rev_fraction(void)
40{
aff151e5 41 const u32 prr = rmobile_get_prr();
7d791368 42 const u32 rev = prr & PRR_MASK;
e965c890 43
7d791368 44 if (rev == R8A7796_REV_1_1)
e965c890 45 return 1;
7d791368
BD
46 else if (rev == R8A7796_REV_1_3)
47 return 3;
e965c890
MV
48 else
49 return prr & 0x0000000F;
a028abea 50}
This page took 0.367514 seconds and 4 git commands to generate.