blob: 2e7ed4931fd676f427c80f90423a4a9d65974cd3 [file] [log] [blame]
Nobuhiro Iwamatsu940103d2012-08-19 04:40:05 +00001/*
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
26u32 rmobile_get_cpu_type(void)
27{
28 u32 id;
29 u32 type;
30 struct sh73a0_hpb *hpb = (struct sh73a0_hpb *)HPB_BASE;
31
Tetsuyuki Kobayashieed92122012-07-25 18:24:20 +000032 id = readl(&hpb->cccr);
Nobuhiro Iwamatsu940103d2012-08-19 04:40:05 +000033 type = (id >> 8) & 0xFF;
34
35 return type;
36}
37
Tetsuyuki Kobayashi7811e542012-07-25 18:24:21 +000038u32 rmobile_get_cpu_rev_integer(void)
Nobuhiro Iwamatsu940103d2012-08-19 04:40:05 +000039{
40 u32 id;
41 u32 rev;
42 struct sh73a0_hpb *hpb = (struct sh73a0_hpb *)HPB_BASE;
43
Tetsuyuki Kobayashieed92122012-07-25 18:24:20 +000044 id = readl(&hpb->cccr);
Tetsuyuki Kobayashi7811e542012-07-25 18:24:21 +000045 rev = ((id >> 4) & 0xF) + 1;
46
47 return rev;
48}
49
50u32 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 Iwamatsu940103d2012-08-19 04:40:05 +000058
59 return rev;
60}