Tom Rini | 83d290c | 2018-05-06 17:58:06 -0400 | [diff] [blame] | 1 | // SPDX-License-Identifier: GPL-2.0+ |
Masahiro Yamada | e27d6c7 | 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 | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 6 | */ |
| 7 | |
Masahiro Yamada | dd74b94 | 2017-10-13 19:21:55 +0900 | [diff] [blame] | 8 | #include <stdio.h> |
Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 9 | #include <linux/errno.h> |
| 10 | #include <linux/io.h> |
Masahiro Yamada | dd74b94 | 2017-10-13 19:21:55 +0900 | [diff] [blame] | 11 | #include <linux/printk.h> |
Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 12 | |
| 13 | #include "soc-info.h" |
| 14 | |
| 15 | int print_cpuinfo(void) |
| 16 | { |
| 17 | unsigned int id, model, rev, required_model = 1, required_rev = 1; |
| 18 | |
| 19 | id = uniphier_get_soc_id(); |
| 20 | model = uniphier_get_soc_model(); |
| 21 | rev = uniphier_get_soc_revision(); |
| 22 | |
Masahiro Yamada | b8faf5f | 2017-07-13 20:32:17 +0900 | [diff] [blame] | 23 | puts("SoC: "); |
Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 24 | |
| 25 | switch (id) { |
Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 26 | case UNIPHIER_LD4_ID: |
Masahiro Yamada | b8faf5f | 2017-07-13 20:32:17 +0900 | [diff] [blame] | 27 | puts("LD4"); |
Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 28 | required_rev = 2; |
| 29 | break; |
| 30 | case UNIPHIER_PRO4_ID: |
Masahiro Yamada | b8faf5f | 2017-07-13 20:32:17 +0900 | [diff] [blame] | 31 | puts("Pro4"); |
Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 32 | break; |
| 33 | case UNIPHIER_SLD8_ID: |
Masahiro Yamada | b8faf5f | 2017-07-13 20:32:17 +0900 | [diff] [blame] | 34 | puts("sLD8"); |
Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 35 | break; |
| 36 | case UNIPHIER_PRO5_ID: |
Masahiro Yamada | b8faf5f | 2017-07-13 20:32:17 +0900 | [diff] [blame] | 37 | puts("Pro5"); |
Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 38 | break; |
| 39 | case UNIPHIER_PXS2_ID: |
Masahiro Yamada | b8faf5f | 2017-07-13 20:32:17 +0900 | [diff] [blame] | 40 | puts("PXs2"); |
Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 41 | break; |
| 42 | case UNIPHIER_LD6B_ID: |
Masahiro Yamada | b8faf5f | 2017-07-13 20:32:17 +0900 | [diff] [blame] | 43 | puts("LD6b"); |
Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 44 | break; |
| 45 | case UNIPHIER_LD11_ID: |
Masahiro Yamada | b8faf5f | 2017-07-13 20:32:17 +0900 | [diff] [blame] | 46 | puts("LD11"); |
Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 47 | break; |
| 48 | case UNIPHIER_LD20_ID: |
Masahiro Yamada | b8faf5f | 2017-07-13 20:32:17 +0900 | [diff] [blame] | 49 | puts("LD20"); |
Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 50 | break; |
Masahiro Yamada | 2c2ab3d | 2017-01-21 18:05:31 +0900 | [diff] [blame] | 51 | case UNIPHIER_PXS3_ID: |
| 52 | puts("PXs3"); |
| 53 | break; |
Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 54 | default: |
| 55 | printf("Unknown Processor ID (0x%x)\n", id); |
| 56 | return -ENOTSUPP; |
| 57 | } |
| 58 | |
Masahiro Yamada | b8faf5f | 2017-07-13 20:32:17 +0900 | [diff] [blame] | 59 | printf(" (model %d, revision %d)\n", model, rev); |
Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 60 | |
| 61 | if (model < required_model) { |
Masahiro Yamada | dd74b94 | 2017-10-13 19:21:55 +0900 | [diff] [blame] | 62 | pr_err("Only model %d or newer is supported.\n", |
Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 63 | required_model); |
| 64 | return -ENOTSUPP; |
| 65 | } else if (rev < required_rev) { |
Masahiro Yamada | dd74b94 | 2017-10-13 19:21:55 +0900 | [diff] [blame] | 66 | pr_err("Only revision %d or newer is supported.\n", |
Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 67 | required_rev); |
| 68 | return -ENOTSUPP; |
| 69 | } |
| 70 | |
| 71 | return 0; |
| 72 | } |