blob: baf1be6a01bfaf978fe7d912588d0de9baeaf7a0 [file] [log] [blame]
Masahiro Yamadae27d6c72017-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{
29 return __uniphier_get_revision_field(0x3, 8);
30}
31
32unsigned int uniphier_get_soc_revision(void)
33{
34 return __uniphier_get_revision_field(0x1f, 0);
35}