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