blob: 6a7b203a44da68bffedc2ff937f7a98a529f7839 [file] [log] [blame]
Tom Rini83d290c2018-05-06 17:58:06 -04001// SPDX-License-Identifier: GPL-2.0+
Masahiro Yamadae27d6c72017-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 Yamadae27d6c72017-01-21 18:05:26 +09006 */
7
Masahiro Yamadadd74b942017-10-13 19:21:55 +09008#include <stdio.h>
Masahiro Yamadae27d6c72017-01-21 18:05:26 +09009#include <linux/errno.h>
10#include <linux/io.h>
Masahiro Yamadadd74b942017-10-13 19:21:55 +090011#include <linux/printk.h>
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090012
Masahiro Yamada34ded872019-07-10 20:07:42 +090013#include "base-address.h"
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090014#include "soc-info.h"
15
16int print_cpuinfo(void)
17{
18 unsigned int id, model, rev, required_model = 1, required_rev = 1;
Masahiro Yamada34ded872019-07-10 20:07:42 +090019 int ret;
20
21 ret = uniphier_base_address_init();
22 if (ret)
23 return ret;
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090024
25 id = uniphier_get_soc_id();
26 model = uniphier_get_soc_model();
27 rev = uniphier_get_soc_revision();
28
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090029 puts("SoC: ");
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090030
31 switch (id) {
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090032 case UNIPHIER_LD4_ID:
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090033 puts("LD4");
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090034 required_rev = 2;
35 break;
36 case UNIPHIER_PRO4_ID:
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090037 puts("Pro4");
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090038 break;
39 case UNIPHIER_SLD8_ID:
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090040 puts("sLD8");
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090041 break;
42 case UNIPHIER_PRO5_ID:
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090043 puts("Pro5");
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090044 break;
45 case UNIPHIER_PXS2_ID:
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090046 puts("PXs2");
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090047 break;
48 case UNIPHIER_LD6B_ID:
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090049 puts("LD6b");
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090050 break;
51 case UNIPHIER_LD11_ID:
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090052 puts("LD11");
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090053 break;
54 case UNIPHIER_LD20_ID:
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090055 puts("LD20");
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090056 break;
Masahiro Yamada2c2ab3d2017-01-21 18:05:31 +090057 case UNIPHIER_PXS3_ID:
58 puts("PXs3");
59 break;
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090060 default:
61 printf("Unknown Processor ID (0x%x)\n", id);
62 return -ENOTSUPP;
63 }
64
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090065 printf(" (model %d, revision %d)\n", model, rev);
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090066
67 if (model < required_model) {
Masahiro Yamadadd74b942017-10-13 19:21:55 +090068 pr_err("Only model %d or newer is supported.\n",
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090069 required_model);
70 return -ENOTSUPP;
71 } else if (rev < required_rev) {
Masahiro Yamadadd74b942017-10-13 19:21:55 +090072 pr_err("Only revision %d or newer is supported.\n",
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090073 required_rev);
74 return -ENOTSUPP;
75 }
76
77 return 0;
78}