Nobuhiro Iwamatsu | 1d0e927 | 2013-11-21 17:06:45 +0900 | [diff] [blame] | 1 | /* |
Nobuhiro Iwamatsu | 9b7fa2f | 2014-03-28 11:07:39 +0900 | [diff] [blame] | 2 | * arch/arm/cpu/armv7/rmobile/cpu_info-rcar.c |
Nobuhiro Iwamatsu | 1d0e927 | 2013-11-21 17:06:45 +0900 | [diff] [blame] | 3 | * |
Nobuhiro Iwamatsu | 9b7fa2f | 2014-03-28 11:07:39 +0900 | [diff] [blame] | 4 | * Copyright (C) 2013,2014 Renesas Electronics Corporation |
Nobuhiro Iwamatsu | 1d0e927 | 2013-11-21 17:06:45 +0900 | [diff] [blame] | 5 | * |
| 6 | * SPDX-License-Identifier: GPL-2.0 |
| 7 | */ |
| 8 | #include <common.h> |
| 9 | #include <asm/io.h> |
| 10 | |
Marek Vasut | e965c89 | 2017-05-13 15:57:38 +0200 | [diff] [blame] | 11 | #define PRR 0xFF000044 |
| 12 | #define PRR_MASK 0x7fff |
| 13 | #define R8A7796_REV_1_0 0x5200 |
| 14 | #define R8A7796_REV_1_1 0x5210 |
Nobuhiro Iwamatsu | 1d0e927 | 2013-11-21 17:06:45 +0900 | [diff] [blame] | 15 | |
| 16 | u32 rmobile_get_cpu_type(void) |
| 17 | { |
| 18 | return (readl(PRR) & 0x00007F00) >> 8; |
| 19 | } |
| 20 | |
| 21 | u32 rmobile_get_cpu_rev_integer(void) |
| 22 | { |
Marek Vasut | e965c89 | 2017-05-13 15:57:38 +0200 | [diff] [blame] | 23 | const u32 prr = readl(PRR); |
| 24 | |
| 25 | if ((prr & PRR_MASK) == R8A7796_REV_1_1) |
| 26 | return 1; |
| 27 | else |
| 28 | return ((prr & 0x000000F0) >> 4) + 1; |
Nobuhiro Iwamatsu | 1d0e927 | 2013-11-21 17:06:45 +0900 | [diff] [blame] | 29 | } |
Nobuhiro Iwamatsu | a028abe | 2014-03-28 11:15:59 +0900 | [diff] [blame] | 30 | |
| 31 | u32 rmobile_get_cpu_rev_fraction(void) |
| 32 | { |
Marek Vasut | e965c89 | 2017-05-13 15:57:38 +0200 | [diff] [blame] | 33 | const u32 prr = readl(PRR); |
| 34 | |
| 35 | if ((prr & PRR_MASK) == R8A7796_REV_1_1) |
| 36 | return 1; |
| 37 | else |
| 38 | return prr & 0x0000000F; |
Nobuhiro Iwamatsu | a028abe | 2014-03-28 11:15:59 +0900 | [diff] [blame] | 39 | } |