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 #define R8A7796_REV_1_3 0x5211 14 #define R8A77995_REV_1_1 0x5810 15 rmobile_get_prr(void)16static u32 rmobile_get_prr(void) 17 { 18 if (IS_ENABLED(CONFIG_RCAR_64)) 19 return readl(0xFFF00044); 20 21 return readl(0xFF000044); 22 } 23 rmobile_get_cpu_type(void)24u32 rmobile_get_cpu_type(void) 25 { 26 return (rmobile_get_prr() & 0x00007F00) >> 8; 27 } 28 rmobile_get_cpu_rev_integer(void)29u32 rmobile_get_cpu_rev_integer(void) 30 { 31 const u32 prr = rmobile_get_prr(); 32 const u32 rev = prr & PRR_MASK; 33 34 if (rev == R8A7796_REV_1_1 || rev == R8A7796_REV_1_3 || 35 rev == R8A77995_REV_1_1) 36 return 1; 37 else 38 return ((prr & 0x000000F0) >> 4) + 1; 39 } 40 rmobile_get_cpu_rev_fraction(void)41u32 rmobile_get_cpu_rev_fraction(void) 42 { 43 const u32 prr = rmobile_get_prr(); 44 const u32 rev = prr & PRR_MASK; 45 46 if (rev == R8A7796_REV_1_1 || rev == R8A77995_REV_1_1) 47 return 1; 48 else if (rev == R8A7796_REV_1_3) 49 return 3; 50 else 51 return prr & 0x0000000F; 52 } 53