Merge tag 'u-boot-imx-20200825' of https://gitlab.denx.de/u-boot/custodians/u-boot-imx
[platform/kernel/u-boot.git] / arch / arm / mach-uniphier / soc-info.c
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
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
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
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 }