Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 1 | /* |
| 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 | |
| 9 | #include <common.h> |
| 10 | #include <linux/errno.h> |
| 11 | #include <linux/io.h> |
| 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) { |
| 26 | case UNIPHIER_SLD3_ID: |
Masahiro Yamada | b8faf5f | 2017-07-13 20:32:17 +0900 | [diff] [blame^] | 27 | puts("sLD3"); |
Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 28 | required_model = 2; |
| 29 | break; |
| 30 | case UNIPHIER_LD4_ID: |
Masahiro Yamada | b8faf5f | 2017-07-13 20:32:17 +0900 | [diff] [blame^] | 31 | puts("LD4"); |
Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 32 | required_rev = 2; |
| 33 | break; |
| 34 | case UNIPHIER_PRO4_ID: |
Masahiro Yamada | b8faf5f | 2017-07-13 20:32:17 +0900 | [diff] [blame^] | 35 | puts("Pro4"); |
Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 36 | break; |
| 37 | case UNIPHIER_SLD8_ID: |
Masahiro Yamada | b8faf5f | 2017-07-13 20:32:17 +0900 | [diff] [blame^] | 38 | puts("sLD8"); |
Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 39 | break; |
| 40 | case UNIPHIER_PRO5_ID: |
Masahiro Yamada | b8faf5f | 2017-07-13 20:32:17 +0900 | [diff] [blame^] | 41 | puts("Pro5"); |
Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 42 | break; |
| 43 | case UNIPHIER_PXS2_ID: |
Masahiro Yamada | b8faf5f | 2017-07-13 20:32:17 +0900 | [diff] [blame^] | 44 | puts("PXs2"); |
Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 45 | break; |
| 46 | case UNIPHIER_LD6B_ID: |
Masahiro Yamada | b8faf5f | 2017-07-13 20:32:17 +0900 | [diff] [blame^] | 47 | puts("LD6b"); |
Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 48 | break; |
| 49 | case UNIPHIER_LD11_ID: |
Masahiro Yamada | b8faf5f | 2017-07-13 20:32:17 +0900 | [diff] [blame^] | 50 | puts("LD11"); |
Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 51 | break; |
| 52 | case UNIPHIER_LD20_ID: |
Masahiro Yamada | b8faf5f | 2017-07-13 20:32:17 +0900 | [diff] [blame^] | 53 | puts("LD20"); |
Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 54 | break; |
Masahiro Yamada | 2c2ab3d | 2017-01-21 18:05:31 +0900 | [diff] [blame] | 55 | case UNIPHIER_PXS3_ID: |
| 56 | puts("PXs3"); |
| 57 | break; |
Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 58 | default: |
| 59 | printf("Unknown Processor ID (0x%x)\n", id); |
| 60 | return -ENOTSUPP; |
| 61 | } |
| 62 | |
Masahiro Yamada | b8faf5f | 2017-07-13 20:32:17 +0900 | [diff] [blame^] | 63 | printf(" (model %d, revision %d)\n", model, rev); |
Masahiro Yamada | e27d6c7 | 2017-01-21 18:05:26 +0900 | [diff] [blame] | 64 | |
| 65 | if (model < required_model) { |
| 66 | printf("Only model %d or newer is supported.\n", |
| 67 | required_model); |
| 68 | return -ENOTSUPP; |
| 69 | } else if (rev < required_rev) { |
| 70 | printf("Only revision %d or newer is supported.\n", |
| 71 | required_rev); |
| 72 | return -ENOTSUPP; |
| 73 | } |
| 74 | |
| 75 | return 0; |
| 76 | } |