blob: 1ede50771e82f77f2d202c8d4752c14acee3b4cd [file] [log] [blame]
Tom Rini10e47792018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Masahiro Yamada31649052017-01-21 18:05:26 +09002/*
3 * Copyright (C) 2013-2014 Panasonic Corporation
4 * Copyright (C) 2015-2017 Socionext Inc.
5 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
Masahiro Yamada31649052017-01-21 18:05:26 +09006 */
7
Simon Glass97589732020-05-10 11:40:02 -06008#include <init.h>
Masahiro Yamada609cd532017-10-13 19:21:55 +09009#include <stdio.h>
Masahiro Yamada31649052017-01-21 18:05:26 +090010#include <linux/errno.h>
11#include <linux/io.h>
Masahiro Yamada609cd532017-10-13 19:21:55 +090012#include <linux/printk.h>
Masahiro Yamada31649052017-01-21 18:05:26 +090013
Masahiro Yamada8f74e792019-07-10 20:07:42 +090014#include "base-address.h"
Masahiro Yamada31649052017-01-21 18:05:26 +090015#include "soc-info.h"
16
17int print_cpuinfo(void)
18{
19 unsigned int id, model, rev, required_model = 1, required_rev = 1;
Masahiro Yamada8f74e792019-07-10 20:07:42 +090020 int ret;
21
22 ret = uniphier_base_address_init();
23 if (ret)
24 return ret;
Masahiro Yamada31649052017-01-21 18:05:26 +090025
26 id = uniphier_get_soc_id();
27 model = uniphier_get_soc_model();
28 rev = uniphier_get_soc_revision();
29
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090030 puts("SoC: ");
Masahiro Yamada31649052017-01-21 18:05:26 +090031
32 switch (id) {
Masahiro Yamada31649052017-01-21 18:05:26 +090033 case UNIPHIER_LD4_ID:
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090034 puts("LD4");
Masahiro Yamada31649052017-01-21 18:05:26 +090035 required_rev = 2;
36 break;
37 case UNIPHIER_PRO4_ID:
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090038 puts("Pro4");
Masahiro Yamada31649052017-01-21 18:05:26 +090039 break;
40 case UNIPHIER_SLD8_ID:
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090041 puts("sLD8");
Masahiro Yamada31649052017-01-21 18:05:26 +090042 break;
43 case UNIPHIER_PRO5_ID:
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090044 puts("Pro5");
Masahiro Yamada31649052017-01-21 18:05:26 +090045 break;
46 case UNIPHIER_PXS2_ID:
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090047 puts("PXs2");
Masahiro Yamada31649052017-01-21 18:05:26 +090048 break;
49 case UNIPHIER_LD6B_ID:
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090050 puts("LD6b");
Masahiro Yamada31649052017-01-21 18:05:26 +090051 break;
52 case UNIPHIER_LD11_ID:
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090053 puts("LD11");
Masahiro Yamada31649052017-01-21 18:05:26 +090054 break;
55 case UNIPHIER_LD20_ID:
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090056 puts("LD20");
Masahiro Yamada31649052017-01-21 18:05:26 +090057 break;
Masahiro Yamada133b1262017-01-21 18:05:31 +090058 case UNIPHIER_PXS3_ID:
59 puts("PXs3");
60 break;
Masahiro Yamada31649052017-01-21 18:05:26 +090061 default:
62 printf("Unknown Processor ID (0x%x)\n", id);
63 return -ENOTSUPP;
64 }
65
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090066 printf(" (model %d, revision %d)\n", model, rev);
Masahiro Yamada31649052017-01-21 18:05:26 +090067
68 if (model < required_model) {
Masahiro Yamada609cd532017-10-13 19:21:55 +090069 pr_err("Only model %d or newer is supported.\n",
Masahiro Yamada31649052017-01-21 18:05:26 +090070 required_model);
71 return -ENOTSUPP;
72 } else if (rev < required_rev) {
Masahiro Yamada609cd532017-10-13 19:21:55 +090073 pr_err("Only revision %d or newer is supported.\n",
Masahiro Yamada31649052017-01-21 18:05:26 +090074 required_rev);
75 return -ENOTSUPP;
76 }
77
78 return 0;
79}