1*e27d6c7dSMasahiro Yamada /*
2*e27d6c7dSMasahiro Yamada  * Copyright (C) 2013-2014 Panasonic Corporation
3*e27d6c7dSMasahiro Yamada  * Copyright (C) 2015-2017 Socionext Inc.
4*e27d6c7dSMasahiro Yamada  *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
5*e27d6c7dSMasahiro Yamada  *
6*e27d6c7dSMasahiro Yamada  * SPDX-License-Identifier:	GPL-2.0+
7*e27d6c7dSMasahiro Yamada  */
8*e27d6c7dSMasahiro Yamada 
9*e27d6c7dSMasahiro Yamada #include <common.h>
10*e27d6c7dSMasahiro Yamada #include <linux/errno.h>
11*e27d6c7dSMasahiro Yamada #include <linux/io.h>
12*e27d6c7dSMasahiro Yamada 
13*e27d6c7dSMasahiro Yamada #include "soc-info.h"
14*e27d6c7dSMasahiro Yamada 
15*e27d6c7dSMasahiro Yamada int print_cpuinfo(void)
16*e27d6c7dSMasahiro Yamada {
17*e27d6c7dSMasahiro Yamada 	unsigned int id, model, rev, required_model = 1, required_rev = 1;
18*e27d6c7dSMasahiro Yamada 
19*e27d6c7dSMasahiro Yamada 	id = uniphier_get_soc_id();
20*e27d6c7dSMasahiro Yamada 	model = uniphier_get_soc_model();
21*e27d6c7dSMasahiro Yamada 	rev = uniphier_get_soc_revision();
22*e27d6c7dSMasahiro Yamada 
23*e27d6c7dSMasahiro Yamada 	puts("CPU:   ");
24*e27d6c7dSMasahiro Yamada 
25*e27d6c7dSMasahiro Yamada 	switch (id) {
26*e27d6c7dSMasahiro Yamada 	case UNIPHIER_SLD3_ID:
27*e27d6c7dSMasahiro Yamada 		puts("sLD3 (MN2WS0220)");
28*e27d6c7dSMasahiro Yamada 		required_model = 2;
29*e27d6c7dSMasahiro Yamada 		break;
30*e27d6c7dSMasahiro Yamada 	case UNIPHIER_LD4_ID:
31*e27d6c7dSMasahiro Yamada 		puts("LD4 (MN2WS0250)");
32*e27d6c7dSMasahiro Yamada 		required_rev = 2;
33*e27d6c7dSMasahiro Yamada 		break;
34*e27d6c7dSMasahiro Yamada 	case UNIPHIER_PRO4_ID:
35*e27d6c7dSMasahiro Yamada 		puts("Pro4 (MN2WS0230)");
36*e27d6c7dSMasahiro Yamada 		break;
37*e27d6c7dSMasahiro Yamada 	case UNIPHIER_SLD8_ID:
38*e27d6c7dSMasahiro Yamada 		puts("sLD8 (MN2WS0270)");
39*e27d6c7dSMasahiro Yamada 		break;
40*e27d6c7dSMasahiro Yamada 	case UNIPHIER_PRO5_ID:
41*e27d6c7dSMasahiro Yamada 		puts("Pro5 (MN2WS0300)");
42*e27d6c7dSMasahiro Yamada 		break;
43*e27d6c7dSMasahiro Yamada 	case UNIPHIER_PXS2_ID:
44*e27d6c7dSMasahiro Yamada 		puts("PXs2 (MN2WS0310)");
45*e27d6c7dSMasahiro Yamada 		break;
46*e27d6c7dSMasahiro Yamada 	case UNIPHIER_LD6B_ID:
47*e27d6c7dSMasahiro Yamada 		puts("LD6b (MN2WS0320)");
48*e27d6c7dSMasahiro Yamada 		break;
49*e27d6c7dSMasahiro Yamada 	case UNIPHIER_LD11_ID:
50*e27d6c7dSMasahiro Yamada 		puts("LD11 (SC1405AP1)");
51*e27d6c7dSMasahiro Yamada 		break;
52*e27d6c7dSMasahiro Yamada 	case UNIPHIER_LD20_ID:
53*e27d6c7dSMasahiro Yamada 		puts("LD20 (SC1401AJ1)");
54*e27d6c7dSMasahiro Yamada 		break;
55*e27d6c7dSMasahiro Yamada 	default:
56*e27d6c7dSMasahiro Yamada 		printf("Unknown Processor ID (0x%x)\n", id);
57*e27d6c7dSMasahiro Yamada 		return -ENOTSUPP;
58*e27d6c7dSMasahiro Yamada 	}
59*e27d6c7dSMasahiro Yamada 
60*e27d6c7dSMasahiro Yamada 	printf(" model %d (revision %d)\n", model, rev);
61*e27d6c7dSMasahiro Yamada 
62*e27d6c7dSMasahiro Yamada 	if (model < required_model) {
63*e27d6c7dSMasahiro Yamada 		printf("Only model %d or newer is supported.\n",
64*e27d6c7dSMasahiro Yamada 		       required_model);
65*e27d6c7dSMasahiro Yamada 		return -ENOTSUPP;
66*e27d6c7dSMasahiro Yamada 	} else if (rev < required_rev) {
67*e27d6c7dSMasahiro Yamada 		printf("Only revision %d or newer is supported.\n",
68*e27d6c7dSMasahiro Yamada 		       required_rev);
69*e27d6c7dSMasahiro Yamada 		return -ENOTSUPP;
70*e27d6c7dSMasahiro Yamada 	}
71*e27d6c7dSMasahiro Yamada 
72*e27d6c7dSMasahiro Yamada 	return 0;
73*e27d6c7dSMasahiro Yamada }
74