Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Nobuhiro Iwamatsu | 1cdf248 | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 2 | /* |
| 3 | * (C) Copyright 2012 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com> |
| 4 | * (C) Copyright 2012 Renesas Solutions Corp. |
Nobuhiro Iwamatsu | 1cdf248 | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 5 | */ |
| 6 | #include <common.h> |
| 7 | #include <asm/io.h> |
| 8 | |
| 9 | u32 rmobile_get_cpu_type(void) |
| 10 | { |
| 11 | u32 id; |
| 12 | u32 type; |
| 13 | struct sh73a0_hpb *hpb = (struct sh73a0_hpb *)HPB_BASE; |
| 14 | |
Tetsuyuki Kobayashi | 170cc96 | 2012-07-25 18:24:20 +0000 | [diff] [blame] | 15 | id = readl(&hpb->cccr); |
Nobuhiro Iwamatsu | 1cdf248 | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 16 | type = (id >> 8) & 0xFF; |
| 17 | |
| 18 | return type; |
| 19 | } |
| 20 | |
Tetsuyuki Kobayashi | 4f007b8 | 2012-07-25 18:24:21 +0000 | [diff] [blame] | 21 | u32 rmobile_get_cpu_rev_integer(void) |
Nobuhiro Iwamatsu | 1cdf248 | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 22 | { |
| 23 | u32 id; |
| 24 | u32 rev; |
| 25 | struct sh73a0_hpb *hpb = (struct sh73a0_hpb *)HPB_BASE; |
| 26 | |
Tetsuyuki Kobayashi | 170cc96 | 2012-07-25 18:24:20 +0000 | [diff] [blame] | 27 | id = readl(&hpb->cccr); |
Tetsuyuki Kobayashi | 4f007b8 | 2012-07-25 18:24:21 +0000 | [diff] [blame] | 28 | rev = ((id >> 4) & 0xF) + 1; |
| 29 | |
| 30 | return rev; |
| 31 | } |
| 32 | |
| 33 | u32 rmobile_get_cpu_rev_fraction(void) |
| 34 | { |
| 35 | u32 id; |
| 36 | u32 rev; |
| 37 | struct sh73a0_hpb *hpb = (struct sh73a0_hpb *)HPB_BASE; |
| 38 | |
| 39 | id = readl(&hpb->cccr); |
| 40 | rev = id & 0xF; |
Nobuhiro Iwamatsu | 1cdf248 | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 41 | |
| 42 | return rev; |
| 43 | } |