blob: 0c7ee8acf5a71998bde29b762a3b4ed98b215e7a [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Nobuhiro Iwamatsu1cdf2482012-08-19 04:40:05 +00002/*
3 * (C) Copyright 2012 Nobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
4 * (C) Copyright 2012 Renesas Solutions Corp.
Nobuhiro Iwamatsu1cdf2482012-08-19 04:40:05 +00005 */
6#include <common.h>
7#include <asm/io.h>
8
9u32 rmobile_get_cpu_type(void)
10{
11 u32 id;
12 u32 type;
13 struct sh73a0_hpb *hpb = (struct sh73a0_hpb *)HPB_BASE;
14
Tetsuyuki Kobayashi170cc962012-07-25 18:24:20 +000015 id = readl(&hpb->cccr);
Nobuhiro Iwamatsu1cdf2482012-08-19 04:40:05 +000016 type = (id >> 8) & 0xFF;
17
18 return type;
19}
20
Tetsuyuki Kobayashi4f007b82012-07-25 18:24:21 +000021u32 rmobile_get_cpu_rev_integer(void)
Nobuhiro Iwamatsu1cdf2482012-08-19 04:40:05 +000022{
23 u32 id;
24 u32 rev;
25 struct sh73a0_hpb *hpb = (struct sh73a0_hpb *)HPB_BASE;
26
Tetsuyuki Kobayashi170cc962012-07-25 18:24:20 +000027 id = readl(&hpb->cccr);
Tetsuyuki Kobayashi4f007b82012-07-25 18:24:21 +000028 rev = ((id >> 4) & 0xF) + 1;
29
30 return rev;
31}
32
33u32 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 Iwamatsu1cdf2482012-08-19 04:40:05 +000041
42 return rev;
43}