Masahiro Yamada | 5894ca0 | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 1 | /* |
Masahiro Yamada | f6e7f07 | 2015-05-29 17:30:00 +0900 | [diff] [blame] | 2 | * Copyright (C) 2013-2015 Masahiro Yamada <yamada.masahiro@socionext.com> |
Masahiro Yamada | 5894ca0 | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0+ |
| 5 | */ |
| 6 | |
| 7 | #include <common.h> |
Masahiro Yamada | f6e7f07 | 2015-05-29 17:30:00 +0900 | [diff] [blame] | 8 | #include <linux/io.h> |
Masahiro Yamada | 107b3fb | 2016-01-09 01:51:13 +0900 | [diff] [blame] | 9 | |
| 10 | #include "sg-regs.h" |
Masahiro Yamada | 5894ca0 | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 11 | |
| 12 | int print_cpuinfo(void) |
| 13 | { |
| 14 | u32 revision, type, model, rev, required_model = 1, required_rev = 1; |
| 15 | |
| 16 | revision = readl(SG_REVISION); |
| 17 | type = (revision & SG_REVISION_TYPE_MASK) >> SG_REVISION_TYPE_SHIFT; |
| 18 | model = (revision & SG_REVISION_MODEL_MASK) >> SG_REVISION_MODEL_SHIFT; |
| 19 | rev = (revision & SG_REVISION_REV_MASK) >> SG_REVISION_REV_SHIFT; |
| 20 | |
| 21 | puts("CPU: "); |
| 22 | |
| 23 | switch (type) { |
| 24 | case 0x25: |
| 25 | puts("PH1-sLD3 (MN2WS0220)"); |
| 26 | required_model = 2; |
| 27 | break; |
| 28 | case 0x26: |
| 29 | puts("PH1-LD4 (MN2WS0250)"); |
| 30 | required_rev = 2; |
| 31 | break; |
| 32 | case 0x28: |
| 33 | puts("PH1-Pro4 (MN2WS0230)"); |
| 34 | break; |
| 35 | case 0x29: |
| 36 | puts("PH1-sLD8 (MN2WS0270)"); |
| 37 | break; |
Masahiro Yamada | 8101b98 | 2015-06-30 18:43:45 +0900 | [diff] [blame] | 38 | case 0x2A: |
| 39 | puts("PH1-Pro5 (MN2WS0300)"); |
| 40 | break; |
| 41 | case 0x2E: |
| 42 | puts("ProXstream2 (MN2WS0310)"); |
| 43 | break; |
| 44 | case 0x2F: |
| 45 | puts("PH1-LD6b (MN2WS0320)"); |
| 46 | break; |
Masahiro Yamada | 6f45a97 | 2015-12-17 17:47:45 +0900 | [diff] [blame] | 47 | case 0x31: |
Masahiro Yamada | 2247c33 | 2016-02-26 18:59:43 +0900 | [diff] [blame] | 48 | puts("PH1-LD11 ()"); |
Masahiro Yamada | 6f45a97 | 2015-12-17 17:47:45 +0900 | [diff] [blame] | 49 | break; |
| 50 | case 0x32: |
Masahiro Yamada | 2247c33 | 2016-02-26 18:59:43 +0900 | [diff] [blame] | 51 | puts("PH1-LD20 ()"); |
Masahiro Yamada | 6f45a97 | 2015-12-17 17:47:45 +0900 | [diff] [blame] | 52 | break; |
Masahiro Yamada | 5894ca0 | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 53 | default: |
| 54 | printf("Unknown Processor ID (0x%x)\n", revision); |
| 55 | return -1; |
| 56 | } |
| 57 | |
Masahiro Yamada | 6e1550f | 2015-12-17 17:47:46 +0900 | [diff] [blame] | 58 | printf(" model %d", model); |
Masahiro Yamada | 5894ca0 | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 59 | |
| 60 | printf(" (rev. %d)\n", rev); |
| 61 | |
| 62 | if (model < required_model) { |
| 63 | printf("Sorry, this model is not supported.\n"); |
| 64 | printf("Required model is %d.", required_model); |
| 65 | return -1; |
| 66 | } else if (rev < required_rev) { |
| 67 | printf("Sorry, this revision is not supported.\n"); |
| 68 | printf("Required revision is %d.", required_rev); |
| 69 | return -1; |
| 70 | } |
| 71 | |
| 72 | return 0; |
| 73 | } |