blob: 3e8e7f4ef33bdf838cb0dd6d45fdf14e40341efc [file] [log] [blame]
Masahiro Yamada323d1f92015-09-22 00:27:39 +09001/*
2 * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0+
5 */
6
7#include <linux/io.h>
8#include <linux/types.h>
9#include <mach/sg-regs.h>
10#include <mach/soc_info.h>
11
12#if UNIPHIER_MULTI_SOC
13enum uniphier_soc_id uniphier_get_soc_type(void)
14{
15 u32 revision = readl(SG_REVISION);
16 enum uniphier_soc_id ret;
17
18 switch ((revision & SG_REVISION_TYPE_MASK) >> SG_REVISION_TYPE_SHIFT) {
19#ifdef CONFIG_ARCH_UNIPHIER_PH1_SLD3
20 case 0x25:
21 ret = SOC_UNIPHIER_PH1_SLD3;
22 break;
23#endif
24#ifdef CONFIG_ARCH_UNIPHIER_PH1_LD4
25 case 0x26:
26 ret = SOC_UNIPHIER_PH1_LD4;
27 break;
28#endif
29#ifdef CONFIG_ARCH_UNIPHIER_PH1_PRO4
30 case 0x28:
31 ret = SOC_UNIPHIER_PH1_PRO4;
32 break;
33#endif
34#ifdef CONFIG_ARCH_UNIPHIER_PH1_SLD8
35 case 0x29:
36 ret = SOC_UNIPHIER_PH1_SLD8;
37 break;
38#endif
39#ifdef CONFIG_ARCH_UNIPHIER_PH1_PRO5
40 case 0x2A:
41 ret = SOC_UNIPHIER_PH1_PRO5;
42 break;
43#endif
44#ifdef CONFIG_ARCH_UNIPHIER_PROXSTREAM2
45 case 0x2E:
46 ret = SOC_UNIPHIER_PROXSTREAM2;
47 break;
48#endif
49#ifdef CONFIG_ARCH_UNIPHIER_PH1_LD6B
50 case 0x2F:
51 ret = SOC_UNIPHIER_PH1_LD6B;
52 break;
53#endif
54 default:
55 ret = SOC_UNIPHIER_UNKNOWN;
56 break;
57 }
58
59 return ret;
60}
61#endif