Masahiro Yamada | 5894ca0 | 2014-10-03 19:21:06 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2013-2014 Panasonic Corporation |
| 3 | * Author: Masahiro Yamada <yamada.m@jp.panasonic.com> |
| 4 | * |
| 5 | * SPDX-License-Identifier: GPL-2.0+ |
| 6 | */ |
| 7 | |
| 8 | #include <common.h> |
| 9 | #include <asm/io.h> |
Masahiro Yamada | a86ac95 | 2015-02-27 02:26:44 +0900 | [diff] [blame] | 10 | #include <mach/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; |
| 38 | default: |
| 39 | printf("Unknown Processor ID (0x%x)\n", revision); |
| 40 | return -1; |
| 41 | } |
| 42 | |
| 43 | if (model > 1) |
| 44 | printf(" model %d", model); |
| 45 | |
| 46 | printf(" (rev. %d)\n", rev); |
| 47 | |
| 48 | if (model < required_model) { |
| 49 | printf("Sorry, this model is not supported.\n"); |
| 50 | printf("Required model is %d.", required_model); |
| 51 | return -1; |
| 52 | } else if (rev < required_rev) { |
| 53 | printf("Sorry, this revision is not supported.\n"); |
| 54 | printf("Required revision is %d.", required_rev); |
| 55 | return -1; |
| 56 | } |
| 57 | |
| 58 | return 0; |
| 59 | } |