blob: fd799ca39a40d9c05a2c76189ea7d6f8adbea208 [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>
Masahiro Yamada107b3fb2016-01-09 01:51:13 +09009
10#include "sg-regs.h"
11#include "soc-info.h"
Masahiro Yamada323d1f92015-09-22 00:27:39 +090012
13#if UNIPHIER_MULTI_SOC
14enum uniphier_soc_id uniphier_get_soc_type(void)
15{
16 u32 revision = readl(SG_REVISION);
17 enum uniphier_soc_id ret;
18
19 switch ((revision & SG_REVISION_TYPE_MASK) >> SG_REVISION_TYPE_SHIFT) {
20#ifdef CONFIG_ARCH_UNIPHIER_PH1_SLD3
21 case 0x25:
22 ret = SOC_UNIPHIER_PH1_SLD3;
23 break;
24#endif
25#ifdef CONFIG_ARCH_UNIPHIER_PH1_LD4
26 case 0x26:
27 ret = SOC_UNIPHIER_PH1_LD4;
28 break;
29#endif
30#ifdef CONFIG_ARCH_UNIPHIER_PH1_PRO4
31 case 0x28:
32 ret = SOC_UNIPHIER_PH1_PRO4;
33 break;
34#endif
35#ifdef CONFIG_ARCH_UNIPHIER_PH1_SLD8
36 case 0x29:
37 ret = SOC_UNIPHIER_PH1_SLD8;
38 break;
39#endif
40#ifdef CONFIG_ARCH_UNIPHIER_PH1_PRO5
41 case 0x2A:
42 ret = SOC_UNIPHIER_PH1_PRO5;
43 break;
44#endif
45#ifdef CONFIG_ARCH_UNIPHIER_PROXSTREAM2
46 case 0x2E:
47 ret = SOC_UNIPHIER_PROXSTREAM2;
48 break;
49#endif
50#ifdef CONFIG_ARCH_UNIPHIER_PH1_LD6B
51 case 0x2F:
52 ret = SOC_UNIPHIER_PH1_LD6B;
53 break;
54#endif
Masahiro Yamada6f45a972015-12-17 17:47:45 +090055#ifdef CONFIG_ARCH_UNIPHIER_PH1_SLD11
56 case 0x31:
57 ret = SOC_UNIPHIER_PH1_SLD11;
58 break;
59#endif
60#ifdef CONFIG_ARCH_UNIPHIER_PH1_LD10
61 case 0x32:
62 ret = SOC_UNIPHIER_PH1_LD10;
63 break;
64#endif
Masahiro Yamada323d1f92015-09-22 00:27:39 +090065 default:
66 ret = SOC_UNIPHIER_UNKNOWN;
67 break;
68 }
69
70 return ret;
71}
72#endif
Masahiro Yamada2071f142015-12-17 17:47:41 +090073
74int uniphier_get_soc_model(void)
75{
76 return (readl(SG_REVISION) & SG_REVISION_MODEL_MASK) >>
77 SG_REVISION_MODEL_SHIFT;
78}
79
80int uniphier_get_soc_revision(void)
81{
82 return (readl(SG_REVISION) & SG_REVISION_REV_MASK) >>
83 SG_REVISION_REV_SHIFT;
84}