2 * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com>
4 * SPDX-License-Identifier: GPL-2.0+
8 #include <linux/types.h>
13 #if UNIPHIER_MULTI_SOC
14 enum uniphier_soc_id uniphier_get_soc_type(void)
16 u32 revision = readl(SG_REVISION);
17 enum uniphier_soc_id ret;
19 switch ((revision & SG_REVISION_TYPE_MASK) >> SG_REVISION_TYPE_SHIFT) {
20 #ifdef CONFIG_ARCH_UNIPHIER_SLD3
22 ret = SOC_UNIPHIER_SLD3;
25 #ifdef CONFIG_ARCH_UNIPHIER_LD4
27 ret = SOC_UNIPHIER_LD4;
30 #ifdef CONFIG_ARCH_UNIPHIER_PRO4
32 ret = SOC_UNIPHIER_PRO4;
35 #ifdef CONFIG_ARCH_UNIPHIER_SLD8
37 ret = SOC_UNIPHIER_SLD8;
40 #ifdef CONFIG_ARCH_UNIPHIER_PRO5
42 ret = SOC_UNIPHIER_PRO5;
45 #ifdef CONFIG_ARCH_UNIPHIER_PXS2
47 ret = SOC_UNIPHIER_PXS2;
50 #ifdef CONFIG_ARCH_UNIPHIER_LD6B
52 ret = SOC_UNIPHIER_LD6B;
55 #ifdef CONFIG_ARCH_UNIPHIER_LD11
57 ret = SOC_UNIPHIER_LD11;
60 #ifdef CONFIG_ARCH_UNIPHIER_LD20
62 ret = SOC_UNIPHIER_LD20;
66 ret = SOC_UNIPHIER_UNKNOWN;
74 int uniphier_get_soc_model(void)
76 return (readl(SG_REVISION) & SG_REVISION_MODEL_MASK) >>
77 SG_REVISION_MODEL_SHIFT;
80 int uniphier_get_soc_revision(void)
82 return (readl(SG_REVISION) & SG_REVISION_REV_MASK) >>
83 SG_REVISION_REV_SHIFT;