projects
/
platform
/
kernel
/
u-boot.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
nand: davinci: add support for driver model
[platform/kernel/u-boot.git]
/
cmd
/
cpu.c
diff --git
a/cmd/cpu.c
b/cmd/cpu.c
index
b4af64f
..
8c0abc1
100644
(file)
--- a/
cmd/cpu.c
+++ b/
cmd/cpu.c
@@
-1,8
+1,8
@@
+// SPDX-License-Identifier: GPL-2.0+
/*
* Copyright (c) 2015 Google, Inc
* Written by Simon Glass <sjg@chromium.org>
/*
* Copyright (c) 2015 Google, Inc
* Written by Simon Glass <sjg@chromium.org>
- *
- * SPDX-License-Identifier: GPL-2.0+
+ * Copyright (c) 2017 Álvaro Fernández Rojas <noltari@gmail.com>
*/
#include <common.h>
*/
#include <common.h>
@@
-14,25
+14,22
@@
static const char *cpu_feature_name[CPU_FEAT_COUNT] = {
"L1 cache",
"MMU",
static const char *cpu_feature_name[CPU_FEAT_COUNT] = {
"L1 cache",
"MMU",
+ "Microcode",
+ "Device ID",
};
static int print_cpu_list(bool detail)
{
struct udevice *dev;
};
static int print_cpu_list(bool detail)
{
struct udevice *dev;
- struct uclass *uc;
char buf[100];
char buf[100];
- int ret;
- ret = uclass_get(UCLASS_CPU, &uc);
- if (ret) {
- printf("Cannot find CPU uclass\n");
- return ret;
- }
- uclass_foreach_dev(dev, uc) {
+ for (uclass_first_device(UCLASS_CPU, &dev);
+ dev;
+ uclass_next_device(&dev)) {
struct cpu_platdata *plat = dev_get_parent_platdata(dev);
struct cpu_info info;
struct cpu_platdata *plat = dev_get_parent_platdata(dev);
struct cpu_info info;
- bool first;
- int i;
+ bool first
= true
;
+ int
ret,
i;
ret = cpu_get_desc(dev, buf, sizeof(buf));
printf("%3d: %-10s %s\n", dev->seq, dev->name,
ret = cpu_get_desc(dev, buf, sizeof(buf));
printf("%3d: %-10s %s\n", dev->seq, dev->name,
@@
-43,13
+40,12
@@
static int print_cpu_list(bool detail)
if (ret) {
printf("\t(no detail available");
if (ret != -ENOSYS)
if (ret) {
printf("\t(no detail available");
if (ret != -ENOSYS)
- printf(": err=%d
\n
", ret);
+ printf(": err=%d", ret);
printf(")\n");
continue;
}
printf("\tID = %d, freq = ", plat->cpu_id);
print_freq(info.cpu_freq, "");
printf(")\n");
continue;
}
printf("\tID = %d, freq = ", plat->cpu_id);
print_freq(info.cpu_freq, "");
- first = true;
for (i = 0; i < CPU_FEAT_COUNT; i++) {
if (info.features & (1 << i)) {
printf("%s%s", first ? ": " : ", ",
for (i = 0; i < CPU_FEAT_COUNT; i++) {
if (info.features & (1 << i)) {
printf("%s%s", first ? ": " : ", ",
@@
-58,12
+54,18
@@
static int print_cpu_list(bool detail)
}
}
printf("\n");
}
}
printf("\n");
+ if (info.features & (1 << CPU_FEAT_UCODE))
+ printf("\tMicrocode version %#x\n",
+ plat->ucode_version);
+ if (info.features & (1 << CPU_FEAT_DEVICE_ID))
+ printf("\tDevice ID %#lx\n", plat->device_id);
}
return 0;
}
}
return 0;
}
-static int do_cpu_list(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
+static int do_cpu_list(cmd_tbl_t *cmdtp, int flag, int argc,
+ char *const argv[])
{
if (print_cpu_list(false))
return CMD_RET_FAILURE;
{
if (print_cpu_list(false))
return CMD_RET_FAILURE;
@@
-89,7
+91,7
@@
static cmd_tbl_t cmd_cpu_sub[] = {
* Process a cpu sub-command
*/
static int do_cpu(cmd_tbl_t *cmdtp, int flag, int argc,
* Process a cpu sub-command
*/
static int do_cpu(cmd_tbl_t *cmdtp, int flag, int argc,
-
char * const argv[])
+ char * const argv[])
{
cmd_tbl_t *c = NULL;
{
cmd_tbl_t *c = NULL;
@@
-98,7
+100,8
@@
static int do_cpu(cmd_tbl_t *cmdtp, int flag, int argc,
argv++;
if (argc)
argv++;
if (argc)
- c = find_cmd_tbl(argv[0], cmd_cpu_sub, ARRAY_SIZE(cmd_cpu_sub));
+ c = find_cmd_tbl(argv[0], cmd_cpu_sub,
+ ARRAY_SIZE(cmd_cpu_sub));
if (c)
return c->cmd(cmdtp, flag, argc, argv);
if (c)
return c->cmd(cmdtp, flag, argc, argv);