Nobuhiro Iwamatsu | 940103d | 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 | * |
| 5 | * See file CREDITS for list of people who contributed to this |
| 6 | * project. |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or |
| 9 | * modify it under the terms of the GNU General Public License as |
| 10 | * published by the Free Software Foundation; either version 2 of |
| 11 | * the License, or (at your option) any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful, |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 | * GNU General Public License for more details. |
| 17 | * |
| 18 | * You should have received a copy of the GNU General Public License |
| 19 | * along with this program; if not, write to the Free Software |
| 20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 21 | * MA 02111-1307 USA |
| 22 | */ |
| 23 | #include <common.h> |
| 24 | #include <asm/io.h> |
| 25 | |
| 26 | u32 rmobile_get_cpu_type(void) |
| 27 | { |
| 28 | u32 id; |
| 29 | u32 type; |
| 30 | struct sh73a0_hpb *hpb = (struct sh73a0_hpb *)HPB_BASE; |
| 31 | |
Tetsuyuki Kobayashi | eed9212 | 2012-07-25 18:24:20 +0000 | [diff] [blame] | 32 | id = readl(&hpb->cccr); |
Nobuhiro Iwamatsu | 940103d | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 33 | type = (id >> 8) & 0xFF; |
| 34 | |
| 35 | return type; |
| 36 | } |
| 37 | |
Tetsuyuki Kobayashi | 7811e54 | 2012-07-25 18:24:21 +0000 | [diff] [blame] | 38 | u32 rmobile_get_cpu_rev_integer(void) |
Nobuhiro Iwamatsu | 940103d | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 39 | { |
| 40 | u32 id; |
| 41 | u32 rev; |
| 42 | struct sh73a0_hpb *hpb = (struct sh73a0_hpb *)HPB_BASE; |
| 43 | |
Tetsuyuki Kobayashi | eed9212 | 2012-07-25 18:24:20 +0000 | [diff] [blame] | 44 | id = readl(&hpb->cccr); |
Tetsuyuki Kobayashi | 7811e54 | 2012-07-25 18:24:21 +0000 | [diff] [blame] | 45 | rev = ((id >> 4) & 0xF) + 1; |
| 46 | |
| 47 | return rev; |
| 48 | } |
| 49 | |
| 50 | u32 rmobile_get_cpu_rev_fraction(void) |
| 51 | { |
| 52 | u32 id; |
| 53 | u32 rev; |
| 54 | struct sh73a0_hpb *hpb = (struct sh73a0_hpb *)HPB_BASE; |
| 55 | |
| 56 | id = readl(&hpb->cccr); |
| 57 | rev = id & 0xF; |
Nobuhiro Iwamatsu | 940103d | 2012-08-19 04:40:05 +0000 | [diff] [blame] | 58 | |
| 59 | return rev; |
| 60 | } |