blob: bf41d0561cf24a9448b96f82845fbfeeeaead83a [file] [log] [blame]
Masahiro Yamada31649052017-01-21 18:05:26 +09001/*
2 * Copyright (C) 2013-2014 Panasonic Corporation
3 * Copyright (C) 2015-2017 Socionext Inc.
4 * Author: Masahiro Yamada <yamada.masahiro@socionext.com>
5 *
6 * SPDX-License-Identifier: GPL-2.0+
7 */
8
Masahiro Yamada609cd532017-10-13 19:21:55 +09009#include <stdio.h>
Masahiro Yamada31649052017-01-21 18:05:26 +090010#include <linux/errno.h>
11#include <linux/io.h>
Masahiro Yamada609cd532017-10-13 19:21:55 +090012#include <linux/printk.h>
Masahiro Yamada31649052017-01-21 18:05:26 +090013
14#include "soc-info.h"
15
16int print_cpuinfo(void)
17{
18 unsigned int id, model, rev, required_model = 1, required_rev = 1;
19
20 id = uniphier_get_soc_id();
21 model = uniphier_get_soc_model();
22 rev = uniphier_get_soc_revision();
23
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090024 puts("SoC: ");
Masahiro Yamada31649052017-01-21 18:05:26 +090025
26 switch (id) {
Masahiro Yamada31649052017-01-21 18:05:26 +090027 case UNIPHIER_LD4_ID:
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090028 puts("LD4");
Masahiro Yamada31649052017-01-21 18:05:26 +090029 required_rev = 2;
30 break;
31 case UNIPHIER_PRO4_ID:
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090032 puts("Pro4");
Masahiro Yamada31649052017-01-21 18:05:26 +090033 break;
34 case UNIPHIER_SLD8_ID:
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090035 puts("sLD8");
Masahiro Yamada31649052017-01-21 18:05:26 +090036 break;
37 case UNIPHIER_PRO5_ID:
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090038 puts("Pro5");
Masahiro Yamada31649052017-01-21 18:05:26 +090039 break;
40 case UNIPHIER_PXS2_ID:
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090041 puts("PXs2");
Masahiro Yamada31649052017-01-21 18:05:26 +090042 break;
43 case UNIPHIER_LD6B_ID:
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090044 puts("LD6b");
Masahiro Yamada31649052017-01-21 18:05:26 +090045 break;
46 case UNIPHIER_LD11_ID:
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090047 puts("LD11");
Masahiro Yamada31649052017-01-21 18:05:26 +090048 break;
49 case UNIPHIER_LD20_ID:
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090050 puts("LD20");
Masahiro Yamada31649052017-01-21 18:05:26 +090051 break;
Masahiro Yamada133b1262017-01-21 18:05:31 +090052 case UNIPHIER_PXS3_ID:
53 puts("PXs3");
54 break;
Masahiro Yamada31649052017-01-21 18:05:26 +090055 default:
56 printf("Unknown Processor ID (0x%x)\n", id);
57 return -ENOTSUPP;
58 }
59
Masahiro Yamadaa7e5ba92017-07-13 20:32:17 +090060 printf(" (model %d, revision %d)\n", model, rev);
Masahiro Yamada31649052017-01-21 18:05:26 +090061
62 if (model < required_model) {
Masahiro Yamada609cd532017-10-13 19:21:55 +090063 pr_err("Only model %d or newer is supported.\n",
Masahiro Yamada31649052017-01-21 18:05:26 +090064 required_model);
65 return -ENOTSUPP;
66 } else if (rev < required_rev) {
Masahiro Yamada609cd532017-10-13 19:21:55 +090067 pr_err("Only revision %d or newer is supported.\n",
Masahiro Yamada31649052017-01-21 18:05:26 +090068 required_rev);
69 return -ENOTSUPP;
70 }
71
72 return 0;
73}