Tom Rini | 10e4779 | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 2 | /* |
| 3 | * Copyright (C) 2013-2014 Panasonic Corporation |
| 4 | * Copyright (C) 2015-2017 Socionext Inc. |
| 5 | * Author: Masahiro Yamada <yamada.masahiro@socionext.com> |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 6 | */ |
| 7 | |
Masahiro Yamada | 609cd53 | 2017-10-13 19:21:55 +0900 | [diff] [blame] | 8 | #include <stdio.h> |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 9 | #include <linux/errno.h> |
| 10 | #include <linux/io.h> |
Masahiro Yamada | 609cd53 | 2017-10-13 19:21:55 +0900 | [diff] [blame] | 11 | #include <linux/printk.h> |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 12 | |
Masahiro Yamada | 8f74e79 | 2019-07-10 20:07:42 +0900 | [diff] [blame] | 13 | #include "base-address.h" |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 14 | #include "soc-info.h" |
| 15 | |
| 16 | int print_cpuinfo(void) |
| 17 | { |
| 18 | unsigned int id, model, rev, required_model = 1, required_rev = 1; |
Masahiro Yamada | 8f74e79 | 2019-07-10 20:07:42 +0900 | [diff] [blame] | 19 | int ret; |
| 20 | |
| 21 | ret = uniphier_base_address_init(); |
| 22 | if (ret) |
| 23 | return ret; |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 24 | |
| 25 | id = uniphier_get_soc_id(); |
| 26 | model = uniphier_get_soc_model(); |
| 27 | rev = uniphier_get_soc_revision(); |
| 28 | |
Masahiro Yamada | a7e5ba9 | 2017-07-13 20:32:17 +0900 | [diff] [blame] | 29 | puts("SoC: "); |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 30 | |
| 31 | switch (id) { |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 32 | case UNIPHIER_LD4_ID: |
Masahiro Yamada | a7e5ba9 | 2017-07-13 20:32:17 +0900 | [diff] [blame] | 33 | puts("LD4"); |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 34 | required_rev = 2; |
| 35 | break; |
| 36 | case UNIPHIER_PRO4_ID: |
Masahiro Yamada | a7e5ba9 | 2017-07-13 20:32:17 +0900 | [diff] [blame] | 37 | puts("Pro4"); |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 38 | break; |
| 39 | case UNIPHIER_SLD8_ID: |
Masahiro Yamada | a7e5ba9 | 2017-07-13 20:32:17 +0900 | [diff] [blame] | 40 | puts("sLD8"); |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 41 | break; |
| 42 | case UNIPHIER_PRO5_ID: |
Masahiro Yamada | a7e5ba9 | 2017-07-13 20:32:17 +0900 | [diff] [blame] | 43 | puts("Pro5"); |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 44 | break; |
| 45 | case UNIPHIER_PXS2_ID: |
Masahiro Yamada | a7e5ba9 | 2017-07-13 20:32:17 +0900 | [diff] [blame] | 46 | puts("PXs2"); |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 47 | break; |
| 48 | case UNIPHIER_LD6B_ID: |
Masahiro Yamada | a7e5ba9 | 2017-07-13 20:32:17 +0900 | [diff] [blame] | 49 | puts("LD6b"); |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 50 | break; |
| 51 | case UNIPHIER_LD11_ID: |
Masahiro Yamada | a7e5ba9 | 2017-07-13 20:32:17 +0900 | [diff] [blame] | 52 | puts("LD11"); |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 53 | break; |
| 54 | case UNIPHIER_LD20_ID: |
Masahiro Yamada | a7e5ba9 | 2017-07-13 20:32:17 +0900 | [diff] [blame] | 55 | puts("LD20"); |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 56 | break; |
Masahiro Yamada | 133b126 | 2017-01-21 18:05:31 +0900 | [diff] [blame] | 57 | case UNIPHIER_PXS3_ID: |
| 58 | puts("PXs3"); |
| 59 | break; |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 60 | default: |
| 61 | printf("Unknown Processor ID (0x%x)\n", id); |
| 62 | return -ENOTSUPP; |
| 63 | } |
| 64 | |
Masahiro Yamada | a7e5ba9 | 2017-07-13 20:32:17 +0900 | [diff] [blame] | 65 | printf(" (model %d, revision %d)\n", model, rev); |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 66 | |
| 67 | if (model < required_model) { |
Masahiro Yamada | 609cd53 | 2017-10-13 19:21:55 +0900 | [diff] [blame] | 68 | pr_err("Only model %d or newer is supported.\n", |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 69 | required_model); |
| 70 | return -ENOTSUPP; |
| 71 | } else if (rev < required_rev) { |
Masahiro Yamada | 609cd53 | 2017-10-13 19:21:55 +0900 | [diff] [blame] | 72 | pr_err("Only revision %d or newer is supported.\n", |
Masahiro Yamada | 3164905 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 73 | required_rev); |
| 74 | return -ENOTSUPP; |
| 75 | } |
| 76 | |
| 77 | return 0; |
| 78 | } |