blob: 046104bd78d66a6426cdb279984dbe15b6c0fd32 [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) {
Masahiro Yamadaea65c982016-03-18 16:41:43 +090020#ifdef CONFIG_ARCH_UNIPHIER_SLD3
Masahiro Yamada323d1f92015-09-22 00:27:39 +090021 case 0x25:
Masahiro Yamadaea65c982016-03-18 16:41:43 +090022 ret = SOC_UNIPHIER_SLD3;
Masahiro Yamada323d1f92015-09-22 00:27:39 +090023 break;
24#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +090025#ifdef CONFIG_ARCH_UNIPHIER_LD4
Masahiro Yamada323d1f92015-09-22 00:27:39 +090026 case 0x26:
Masahiro Yamadaea65c982016-03-18 16:41:43 +090027 ret = SOC_UNIPHIER_LD4;
Masahiro Yamada323d1f92015-09-22 00:27:39 +090028 break;
29#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +090030#ifdef CONFIG_ARCH_UNIPHIER_PRO4
Masahiro Yamada323d1f92015-09-22 00:27:39 +090031 case 0x28:
Masahiro Yamadaea65c982016-03-18 16:41:43 +090032 ret = SOC_UNIPHIER_PRO4;
Masahiro Yamada323d1f92015-09-22 00:27:39 +090033 break;
34#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +090035#ifdef CONFIG_ARCH_UNIPHIER_SLD8
Masahiro Yamada323d1f92015-09-22 00:27:39 +090036 case 0x29:
Masahiro Yamadaea65c982016-03-18 16:41:43 +090037 ret = SOC_UNIPHIER_SLD8;
Masahiro Yamada323d1f92015-09-22 00:27:39 +090038 break;
39#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +090040#ifdef CONFIG_ARCH_UNIPHIER_PRO5
Masahiro Yamada323d1f92015-09-22 00:27:39 +090041 case 0x2A:
Masahiro Yamadaea65c982016-03-18 16:41:43 +090042 ret = SOC_UNIPHIER_PRO5;
Masahiro Yamada323d1f92015-09-22 00:27:39 +090043 break;
44#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +090045#ifdef CONFIG_ARCH_UNIPHIER_PXS2
Masahiro Yamada323d1f92015-09-22 00:27:39 +090046 case 0x2E:
Masahiro Yamadaea65c982016-03-18 16:41:43 +090047 ret = SOC_UNIPHIER_PXS2;
Masahiro Yamada323d1f92015-09-22 00:27:39 +090048 break;
49#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +090050#ifdef CONFIG_ARCH_UNIPHIER_LD6B
Masahiro Yamada323d1f92015-09-22 00:27:39 +090051 case 0x2F:
Masahiro Yamadaea65c982016-03-18 16:41:43 +090052 ret = SOC_UNIPHIER_LD6B;
Masahiro Yamada323d1f92015-09-22 00:27:39 +090053 break;
54#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +090055#ifdef CONFIG_ARCH_UNIPHIER_LD11
Masahiro Yamada6f45a972015-12-17 17:47:45 +090056 case 0x31:
Masahiro Yamadaea65c982016-03-18 16:41:43 +090057 ret = SOC_UNIPHIER_LD11;
Masahiro Yamada6f45a972015-12-17 17:47:45 +090058 break;
59#endif
Masahiro Yamadaea65c982016-03-18 16:41:43 +090060#ifdef CONFIG_ARCH_UNIPHIER_LD20
Masahiro Yamada6f45a972015-12-17 17:47:45 +090061 case 0x32:
Masahiro Yamadaea65c982016-03-18 16:41:43 +090062 ret = SOC_UNIPHIER_LD20;
Masahiro Yamada6f45a972015-12-17 17:47:45 +090063 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}