blob: b0221016d1ef7cc3b01cef65146d7e68faa8a860 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Masahiro Yamadae27d6c72017-01-21 18:05:26 +09002/*
3 * Copyright (C) 2017 Socionext Inc.
4 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamadae27d6c72017-01-21 18:05:26 +09005 */
6
Masahiro Yamada351b74c2020-07-30 18:28:08 +09007#include <linux/bitfield.h>
Masahiro Yamadae27d6c72017-01-21 18:05:26 +09008#include <linux/io.h>
9#include <linux/types.h>
10
11#include "sg-regs.h"
12#include "soc-info.h"
13
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090014unsigned int uniphier_get_soc_id(void)
15{
Masahiro Yamada351b74c2020-07-30 18:28:08 +090016 u32 rev = readl(sg_base + SG_REVISION);
17
18 return FIELD_GET(SG_REVISION_TYPE_MASK, rev);
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090019}
20
21unsigned int uniphier_get_soc_model(void)
22{
Masahiro Yamada351b74c2020-07-30 18:28:08 +090023 u32 rev = readl(sg_base + SG_REVISION);
24
25 return FIELD_GET(SG_REVISION_MODEL_MASK, rev);
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090026}
27
28unsigned int uniphier_get_soc_revision(void)
29{
Masahiro Yamada351b74c2020-07-30 18:28:08 +090030 u32 rev = readl(sg_base + SG_REVISION);
31
32 return FIELD_GET(SG_REVISION_REV_MASK, rev);
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090033}