blob: f9de3a9dda9e4c3c9cfa44db8425955462874cee [file] [log] [blame]
Masahiro Yamada31649052017-01-21 18:05:26 +09001/*
2 * Copyright (C) 2017 Socionext Inc.
3 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
4 *
5 * SPDX-License-Identifier: GPL-2.0+
6 */
7
8#include <linux/io.h>
9#include <linux/types.h>
10
11#include "sg-regs.h"
12#include "soc-info.h"
13
14static unsigned int __uniphier_get_revision_field(unsigned int mask,
15 unsigned int shift)
16{
17 u32 revision = readl(SG_REVISION);
18
19 return (revision >> shift) & mask;
20}
21
22unsigned int uniphier_get_soc_id(void)
23{
24 return __uniphier_get_revision_field(0xff, 16);
25}
26
27unsigned int uniphier_get_soc_model(void)
28{
Masahiro Yamadafecae1b2017-05-09 17:14:55 +090029 return __uniphier_get_revision_field(0x7, 8);
Masahiro Yamada31649052017-01-21 18:05:26 +090030}
31
32unsigned int uniphier_get_soc_revision(void)
33{
34 return __uniphier_get_revision_field(0x1f, 0);
35}