blob: 90ef4110871f354c44b3490a18c6a53f91e0f979 [file] [log] [blame]
Masahiro Yamada31649052017-01-21 18:05:26 +09001/*
2 * Copyright (C) 2013-2014 Panasonic Corporation
3 * Copyright (C) 2015-2017 Socionext Inc.
4 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
5 *
6 * SPDX-License-Identifier: GPL-2.0+
7 */
8
9#include <common.h>
10#include <linux/errno.h>
11#include <linux/io.h>
12
13#include "soc-info.h"
14
15int print_cpuinfo(void)
16{
17 unsigned int id, model, rev, required_model = 1, required_rev = 1;
18
19 id = uniphier_get_soc_id();
20 model = uniphier_get_soc_model();
21 rev = uniphier_get_soc_revision();
22
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090023 puts("SoC: ");
Masahiro Yamada31649052017-01-21 18:05:26 +090024
25 switch (id) {
Masahiro Yamada31649052017-01-21 18:05:26 +090026 case UNIPHIER_LD4_ID:
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090027 puts("LD4");
Masahiro Yamada31649052017-01-21 18:05:26 +090028 required_rev = 2;
29 break;
30 case UNIPHIER_PRO4_ID:
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090031 puts("Pro4");
Masahiro Yamada31649052017-01-21 18:05:26 +090032 break;
33 case UNIPHIER_SLD8_ID:
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090034 puts("sLD8");
Masahiro Yamada31649052017-01-21 18:05:26 +090035 break;
36 case UNIPHIER_PRO5_ID:
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090037 puts("Pro5");
Masahiro Yamada31649052017-01-21 18:05:26 +090038 break;
39 case UNIPHIER_PXS2_ID:
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090040 puts("PXs2");
Masahiro Yamada31649052017-01-21 18:05:26 +090041 break;
42 case UNIPHIER_LD6B_ID:
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090043 puts("LD6b");
Masahiro Yamada31649052017-01-21 18:05:26 +090044 break;
45 case UNIPHIER_LD11_ID:
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090046 puts("LD11");
Masahiro Yamada31649052017-01-21 18:05:26 +090047 break;
48 case UNIPHIER_LD20_ID:
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090049 puts("LD20");
Masahiro Yamada31649052017-01-21 18:05:26 +090050 break;
Masahiro Yamada133b1262017-01-21 18:05:31 +090051 case UNIPHIER_PXS3_ID:
52 puts("PXs3");
53 break;
Masahiro Yamada31649052017-01-21 18:05:26 +090054 default:
55 printf("Unknown Processor ID (0x%x)\n", id);
56 return -ENOTSUPP;
57 }
58
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090059 printf(" (model %d, revision %d)\n", model, rev);
Masahiro Yamada31649052017-01-21 18:05:26 +090060
61 if (model < required_model) {
62 printf("Only model %d or newer is supported.\n",
63 required_model);
64 return -ENOTSUPP;
65 } else if (rev < required_rev) {
66 printf("Only revision %d or newer is supported.\n",
67 required_rev);
68 return -ENOTSUPP;
69 }
70
71 return 0;
72}