diff options
author | Masahiro Yamada <yamada.masahiro@socionext.com> | 2017-01-21 18:05:26 +0900 |
---|---|---|
committer | Masahiro Yamada <yamada.masahiro@socionext.com> | 2017-01-22 16:49:27 +0900 |
commit | e27d6c7d328caf75bd7680109bc6610bc681f46e (patch) | |
tree | 0e199c982bc274b223123ce027e2f9263c961356 /arch/arm/mach-uniphier/cpu-info.c | |
parent | d9a70368dbe4a9b0e81b60ffbe3fda4a09e0ad5a (diff) | |
download | u-boot-e27d6c7d328caf75bd7680109bc6610bc681f46e.tar.gz |
ARM: uniphier: simplify SoC ID get function
Currently, uniphier_get_soc_type() converts the SoC ID (this is
read from the revision register) to an enum symbol to use it for SoC
identification. Come to think of it, there is no need for the
conversion in the first place. Using the SoC ID from the register
as-is a straightforward way.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Diffstat (limited to 'arch/arm/mach-uniphier/cpu-info.c')
-rw-r--r-- | arch/arm/mach-uniphier/cpu-info.c | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/arch/arm/mach-uniphier/cpu-info.c b/arch/arm/mach-uniphier/cpu-info.c new file mode 100644 index 0000000000..a9c8167f3e --- /dev/null +++ b/arch/arm/mach-uniphier/cpu-info.c @@ -0,0 +1,73 @@ +/* + * Copyright (C) 2013-2014 Panasonic Corporation + * Copyright (C) 2015-2017 Socionext Inc. + * Author: Masahiro Yamada <yamada.masahiro@socionext.com> + * + * SPDX-License-Identifier: GPL-2.0+ + */ + +#include <common.h> +#include <linux/errno.h> +#include <linux/io.h> + +#include "soc-info.h" + +int print_cpuinfo(void) +{ + unsigned int id, model, rev, required_model = 1, required_rev = 1; + + id = uniphier_get_soc_id(); + model = uniphier_get_soc_model(); + rev = uniphier_get_soc_revision(); + + puts("CPU: "); + + switch (id) { + case UNIPHIER_SLD3_ID: + puts("sLD3 (MN2WS0220)"); + required_model = 2; + break; + case UNIPHIER_LD4_ID: + puts("LD4 (MN2WS0250)"); + required_rev = 2; + break; + case UNIPHIER_PRO4_ID: + puts("Pro4 (MN2WS0230)"); + break; + case UNIPHIER_SLD8_ID: + puts("sLD8 (MN2WS0270)"); + break; + case UNIPHIER_PRO5_ID: + puts("Pro5 (MN2WS0300)"); + break; + case UNIPHIER_PXS2_ID: + puts("PXs2 (MN2WS0310)"); + break; + case UNIPHIER_LD6B_ID: + puts("LD6b (MN2WS0320)"); + break; + case UNIPHIER_LD11_ID: + puts("LD11 (SC1405AP1)"); + break; + case UNIPHIER_LD20_ID: + puts("LD20 (SC1401AJ1)"); + break; + default: + printf("Unknown Processor ID (0x%x)\n", id); + return -ENOTSUPP; + } + + printf(" model %d (revision %d)\n", model, rev); + + if (model < required_model) { + printf("Only model %d or newer is supported.\n", + required_model); + return -ENOTSUPP; + } else if (rev < required_rev) { + printf("Only revision %d or newer is supported.\n", + required_rev); + return -ENOTSUPP; + } + + return 0; +} |