ARM: renesas: Save boot parameters passed in by ATF
[oweals/u-boot.git] / arch / arm / mach-rmobile / cpu_info-rcar.c
1 // SPDX-License-Identifier: GPL-2.0
2 /*
3  * arch/arm/cpu/armv7/rmobile/cpu_info-rcar.c
4  *
5  * Copyright (C) 2013,2014 Renesas Electronics Corporation
6  */
7 #include <common.h>
8 #include <asm/io.h>
9
10 #define PRR_MASK                0x7fff
11 #define R8A7796_REV_1_0         0x5200
12 #define R8A7796_REV_1_1         0x5210
13
14 static u32 rmobile_get_prr(void)
15 {
16 #ifdef CONFIG_RCAR_GEN3
17         return readl(0xFFF00044);
18 #else
19         return readl(0xFF000044);
20 #endif
21 }
22
23 u32 rmobile_get_cpu_type(void)
24 {
25         return (rmobile_get_prr() & 0x00007F00) >> 8;
26 }
27
28 u32 rmobile_get_cpu_rev_integer(void)
29 {
30         const u32 prr = rmobile_get_prr();
31
32         if ((prr & PRR_MASK) == R8A7796_REV_1_1)
33                 return 1;
34         else
35                 return ((prr & 0x000000F0) >> 4) + 1;
36 }
37
38 u32 rmobile_get_cpu_rev_fraction(void)
39 {
40         const u32 prr = rmobile_get_prr();
41
42         if ((prr & PRR_MASK) == R8A7796_REV_1_1)
43                 return 1;
44         else
45                 return prr & 0x0000000F;
46 }