1*83d290c5STom Rini // SPDX-License-Identifier: GPL-2.0+
2e27d6c7dSMasahiro Yamada /*
3e27d6c7dSMasahiro Yamada  * Copyright (C) 2013-2014 Panasonic Corporation
4e27d6c7dSMasahiro Yamada  * Copyright (C) 2015-2017 Socionext Inc.
5e27d6c7dSMasahiro Yamada  *   Author: Masahiro Yamada <yamada.masahiro@socionext.com>
6e27d6c7dSMasahiro Yamada  */
7e27d6c7dSMasahiro Yamada 
8dd74b945SMasahiro Yamada #include <stdio.h>
9e27d6c7dSMasahiro Yamada #include <linux/errno.h>
10e27d6c7dSMasahiro Yamada #include <linux/io.h>
11dd74b945SMasahiro Yamada #include <linux/printk.h>
12e27d6c7dSMasahiro Yamada 
13e27d6c7dSMasahiro Yamada #include "soc-info.h"
14e27d6c7dSMasahiro Yamada 
print_cpuinfo(void)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 
23b8faf5f1SMasahiro Yamada 	puts("SoC:   ");
24e27d6c7dSMasahiro Yamada 
25e27d6c7dSMasahiro Yamada 	switch (id) {
26e27d6c7dSMasahiro Yamada 	case UNIPHIER_LD4_ID:
27b8faf5f1SMasahiro Yamada 		puts("LD4");
28e27d6c7dSMasahiro Yamada 		required_rev = 2;
29e27d6c7dSMasahiro Yamada 		break;
30e27d6c7dSMasahiro Yamada 	case UNIPHIER_PRO4_ID:
31b8faf5f1SMasahiro Yamada 		puts("Pro4");
32e27d6c7dSMasahiro Yamada 		break;
33e27d6c7dSMasahiro Yamada 	case UNIPHIER_SLD8_ID:
34b8faf5f1SMasahiro Yamada 		puts("sLD8");
35e27d6c7dSMasahiro Yamada 		break;
36e27d6c7dSMasahiro Yamada 	case UNIPHIER_PRO5_ID:
37b8faf5f1SMasahiro Yamada 		puts("Pro5");
38e27d6c7dSMasahiro Yamada 		break;
39e27d6c7dSMasahiro Yamada 	case UNIPHIER_PXS2_ID:
40b8faf5f1SMasahiro Yamada 		puts("PXs2");
41e27d6c7dSMasahiro Yamada 		break;
42e27d6c7dSMasahiro Yamada 	case UNIPHIER_LD6B_ID:
43b8faf5f1SMasahiro Yamada 		puts("LD6b");
44e27d6c7dSMasahiro Yamada 		break;
45e27d6c7dSMasahiro Yamada 	case UNIPHIER_LD11_ID:
46b8faf5f1SMasahiro Yamada 		puts("LD11");
47e27d6c7dSMasahiro Yamada 		break;
48e27d6c7dSMasahiro Yamada 	case UNIPHIER_LD20_ID:
49b8faf5f1SMasahiro Yamada 		puts("LD20");
50e27d6c7dSMasahiro Yamada 		break;
512c2ab3d4SMasahiro Yamada 	case UNIPHIER_PXS3_ID:
522c2ab3d4SMasahiro Yamada 		puts("PXs3");
532c2ab3d4SMasahiro Yamada 		break;
54e27d6c7dSMasahiro Yamada 	default:
55e27d6c7dSMasahiro Yamada 		printf("Unknown Processor ID (0x%x)\n", id);
56e27d6c7dSMasahiro Yamada 		return -ENOTSUPP;
57e27d6c7dSMasahiro Yamada 	}
58e27d6c7dSMasahiro Yamada 
59b8faf5f1SMasahiro Yamada 	printf(" (model %d, revision %d)\n", model, rev);
60e27d6c7dSMasahiro Yamada 
61e27d6c7dSMasahiro Yamada 	if (model < required_model) {
62dd74b945SMasahiro Yamada 		pr_err("Only model %d or newer is supported.\n",
63e27d6c7dSMasahiro Yamada 		       required_model);
64e27d6c7dSMasahiro Yamada 		return -ENOTSUPP;
65e27d6c7dSMasahiro Yamada 	} else if (rev < required_rev) {
66dd74b945SMasahiro Yamada 		pr_err("Only revision %d or newer is supported.\n",
67e27d6c7dSMasahiro Yamada 		       required_rev);
68e27d6c7dSMasahiro Yamada 		return -ENOTSUPP;
69e27d6c7dSMasahiro Yamada 	}
70e27d6c7dSMasahiro Yamada 
71e27d6c7dSMasahiro Yamada 	return 0;
72e27d6c7dSMasahiro Yamada }
73