blob: 1ede50771e82f77f2d202c8d4752c14acee3b4cd [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
Simon Glass691d7192020-05-10 11:40:02 -06008#include <init.h>
Masahiro Yamadadd74b942017-10-13 19:21:55 +09009#include <stdio.h>
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090010#include <linux/errno.h>
11#include <linux/io.h>
Masahiro Yamadadd74b942017-10-13 19:21:55 +090012#include <linux/printk.h>
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090013
Masahiro Yamada34ded872019-07-10 20:07:42 +090014#include "base-address.h"
Masahiro Yamadae27d6c72017-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 Yamada34ded872019-07-10 20:07:42 +090020 int ret;
21
22 ret = uniphier_base_address_init();
23 if (ret)
24 return ret;
Masahiro Yamadae27d6c72017-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 Yamadab8faf5f2017-07-13 20:32:17 +090030 puts("SoC: ");
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090031
32 switch (id) {
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090033 case UNIPHIER_LD4_ID:
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090034 puts("LD4");
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090035 required_rev = 2;
36 break;
37 case UNIPHIER_PRO4_ID:
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090038 puts("Pro4");
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090039 break;
40 case UNIPHIER_SLD8_ID:
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090041 puts("sLD8");
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090042 break;
43 case UNIPHIER_PRO5_ID:
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090044 puts("Pro5");
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090045 break;
46 case UNIPHIER_PXS2_ID:
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090047 puts("PXs2");
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090048 break;
49 case UNIPHIER_LD6B_ID:
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090050 puts("LD6b");
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090051 break;
52 case UNIPHIER_LD11_ID:
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090053 puts("LD11");
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090054 break;
55 case UNIPHIER_LD20_ID:
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090056 puts("LD20");
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090057 break;
Masahiro Yamada2c2ab3d2017-01-21 18:05:31 +090058 case UNIPHIER_PXS3_ID:
59 puts("PXs3");
60 break;
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090061 default:
62 printf("Unknown Processor ID (0x%x)\n", id);
63 return -ENOTSUPP;
64 }
65
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090066 printf(" (model %d, revision %d)\n", model, rev);
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090067
68 if (model < required_model) {
Masahiro Yamadadd74b942017-10-13 19:21:55 +090069 pr_err("Only model %d or newer is supported.\n",
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090070 required_model);
71 return -ENOTSUPP;
72 } else if (rev < required_rev) {
Masahiro Yamadadd74b942017-10-13 19:21:55 +090073 pr_err("Only revision %d or newer is supported.\n",
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090074 required_rev);
75 return -ENOTSUPP;
76 }
77
78 return 0;
79}