1 // SPDX-License-Identifier: GPL-2.0+
2 /*
3  * Copyright (C) 2017 Socionext Inc.
4  *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
5  */
6 
7 #include <linux/bitfield.h>
8 #include <linux/io.h>
9 #include <linux/types.h>
10 
11 #include "sg-regs.h"
12 #include "soc-info.h"
13 
uniphier_get_soc_id(void)14 unsigned int uniphier_get_soc_id(void)
15 {
16 	u32 rev = readl(sg_base + SG_REVISION);
17 
18 	return FIELD_GET(SG_REVISION_TYPE_MASK, rev);
19 }
20 
uniphier_get_soc_model(void)21 unsigned int uniphier_get_soc_model(void)
22 {
23 	u32 rev = readl(sg_base + SG_REVISION);
24 
25 	return FIELD_GET(SG_REVISION_MODEL_MASK, rev);
26 }
27 
uniphier_get_soc_revision(void)28 unsigned int uniphier_get_soc_revision(void)
29 {
30 	u32 rev = readl(sg_base + SG_REVISION);
31 
32 	return FIELD_GET(SG_REVISION_REV_MASK, rev);
33 }
34