summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--arch/riscv/cpu/cpu.c12
-rw-r--r--drivers/cpu/riscv_cpu.c8
2 files changed, 11 insertions, 9 deletions
diff --git a/arch/riscv/cpu/cpu.c b/arch/riscv/cpu/cpu.c
index ecfefa1a025..99083e11dfa 100644
--- a/arch/riscv/cpu/cpu.c
+++ b/arch/riscv/cpu/cpu.c
@@ -39,7 +39,7 @@ static inline bool supports_extension(char ext)
return csr_read(CSR_MISA) & (1 << (ext - 'a'));
#elif CONFIG_CPU
struct udevice *dev;
- char desc[32];
+ const char *isa;
int i;
uclass_find_first_device(UCLASS_CPU, &dev);
@@ -47,12 +47,14 @@ static inline bool supports_extension(char ext)
debug("unable to find the RISC-V cpu device\n");
return false;
}
- if (!cpu_get_desc(dev, desc, sizeof(desc))) {
+
+ isa = dev_read_string(dev, "riscv,isa");
+ if (isa) {
/*
* skip the first 4 characters (rv32|rv64)
*/
- for (i = 4; i < sizeof(desc); i++) {
- switch (desc[i]) {
+ for (i = 4; i < sizeof(isa); i++) {
+ switch (isa[i]) {
case 's':
case 'x':
case 'z':
@@ -64,7 +66,7 @@ static inline bool supports_extension(char ext)
*/
return false;
default:
- if (desc[i] == ext)
+ if (isa[i] == ext)
return true;
}
}
diff --git a/drivers/cpu/riscv_cpu.c b/drivers/cpu/riscv_cpu.c
index 5d1026b37da..9b1950efe05 100644
--- a/drivers/cpu/riscv_cpu.c
+++ b/drivers/cpu/riscv_cpu.c
@@ -21,13 +21,13 @@ DECLARE_GLOBAL_DATA_PTR;
static int riscv_cpu_get_desc(const struct udevice *dev, char *buf, int size)
{
- const char *isa;
+ const char *cpu;
- isa = dev_read_string(dev, "riscv,isa");
- if (size < (strlen(isa) + 1))
+ cpu = dev_read_string(dev, "compatible");
+ if (size < (strlen(cpu) + 1))
return -ENOSPC;
- strcpy(buf, isa);
+ strcpy(buf, cpu);
return 0;
}