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