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