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