2 * arch/arm/cpu/armv7/rmobile/cpu_info-rcar.c
4 * Copyright (C) 2013,2014 Renesas Electronics Corporation
6 * SPDX-License-Identifier: GPL-2.0
11 #define PRR_MASK 0x7fff
12 #define R8A7796_REV_1_0 0x5200
13 #define R8A7796_REV_1_1 0x5210
15 static u32 rmobile_get_prr(void);
17 u32 rmobile_get_cpu_type(void)
19 return (rmobile_get_prr() & 0x00007F00) >> 8;
22 u32 rmobile_get_cpu_rev_integer(void)
24 const u32 prr = rmobile_get_prr();
26 if ((prr & PRR_MASK) == R8A7796_REV_1_1)
29 return ((prr & 0x000000F0) >> 4) + 1;
32 u32 rmobile_get_cpu_rev_fraction(void)
34 const u32 prr = rmobile_get_prr();
36 if ((prr & PRR_MASK) == R8A7796_REV_1_1)
39 return prr & 0x0000000F;
42 #if !CONFIG_IS_ENABLED(DM) || !CONFIG_IS_ENABLED(SYSCON)
43 static u32 rmobile_get_prr(void)
46 * On RCar/RMobile Gen2 and older systems, the PRR is always
47 * located at the address below. On newer systems, the PRR
48 * may be located at different address, but that information
49 * is obtained from DT. This code will be removed when all
50 * of the older systems get converted to DM and OF control.
52 return readl(0xFF000044);
60 struct renesas_prr_priv {
68 static u32 rmobile_get_prr(void)
72 map = syscon_get_regmap_by_driver_data(PRR_RCAR);
74 printf("PRR regmap failed!\n");
78 return readl(map->base);
81 static const struct udevice_id renesas_prr_ids[] = {
82 { .compatible = "renesas,prr", .data = PRR_RCAR },
86 U_BOOT_DRIVER(renesas_prr) = {
87 .name = "renesas_prr",
89 .of_match = renesas_prr_ids,
90 .flags = DM_FLAG_PRE_RELOC,