1 // SPDX-License-Identifier: GPL-2.0+
3 * Copyright (C) 2017 Socionext Inc.
4 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
8 #include <linux/types.h>
13 static unsigned int __uniphier_get_revision_field(unsigned int mask,
16 u32 revision = readl(sg_base + SG_REVISION);
18 return (revision >> shift) & mask;
21 unsigned int uniphier_get_soc_id(void)
23 return __uniphier_get_revision_field(0xff, 16);
26 unsigned int uniphier_get_soc_model(void)
28 return __uniphier_get_revision_field(0x7, 8);
31 unsigned int uniphier_get_soc_revision(void)
33 return __uniphier_get_revision_field(0x1f, 0);