blob: 9f5f5051b318d128d11644861beba8c89cb240d4 [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
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 Yamadab8faf5f2017-07-13 20:32:17 +090023 puts("SoC: ");
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090024
25 switch (id) {
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090026 case UNIPHIER_LD4_ID:
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090027 puts("LD4");
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090028 required_rev = 2;
29 break;
30 case UNIPHIER_PRO4_ID:
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090031 puts("Pro4");
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090032 break;
33 case UNIPHIER_SLD8_ID:
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090034 puts("sLD8");
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090035 break;
36 case UNIPHIER_PRO5_ID:
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090037 puts("Pro5");
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090038 break;
39 case UNIPHIER_PXS2_ID:
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090040 puts("PXs2");
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090041 break;
42 case UNIPHIER_LD6B_ID:
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090043 puts("LD6b");
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090044 break;
45 case UNIPHIER_LD11_ID:
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090046 puts("LD11");
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090047 break;
48 case UNIPHIER_LD20_ID:
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090049 puts("LD20");
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090050 break;
Masahiro Yamada2c2ab3d2017-01-21 18:05:31 +090051 case UNIPHIER_PXS3_ID:
52 puts("PXs3");
53 break;
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090054 default:
55 printf("Unknown Processor ID (0x%x)\n", id);
56 return -ENOTSUPP;
57 }
58
Masahiro Yamadab8faf5f2017-07-13 20:32:17 +090059 printf(" (model %d, revision %d)\n", model, rev);
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090060
61 if (model < required_model) {
Masahiro Yamadadd74b942017-10-13 19:21:55 +090062 pr_err("Only model %d or newer is supported.\n",
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090063 required_model);
64 return -ENOTSUPP;
65 } else if (rev < required_rev) {
Masahiro Yamadadd74b942017-10-13 19:21:55 +090066 pr_err("Only revision %d or newer is supported.\n",
Masahiro Yamadae27d6c72017-01-21 18:05:26 +090067 required_rev);
68 return -ENOTSUPP;
69 }
70
71 return 0;
72}