Commit 476080a7 authored by Ley Foon Tan's avatar Ley Foon Tan

nios2: use of_property_read_bool

Use of_property_read_bool instead of open-coding it as fpcu_has.
Convert the members of struct cpuinfo from u32 to bool accordingly as
they are only used as boolean anyhow.
Signed-off-by: default avatarTobias Klauser <tklauser@distanz.ch>
Acked-by: default avatarLey Foon Tan <lftan@altera.com>
parent c8d2bc9b
...@@ -25,10 +25,10 @@ struct cpuinfo { ...@@ -25,10 +25,10 @@ struct cpuinfo {
/* Core CPU configuration */ /* Core CPU configuration */
char cpu_impl[12]; char cpu_impl[12];
u32 cpu_clock_freq; u32 cpu_clock_freq;
u32 mmu; bool mmu;
u32 has_div; bool has_div;
u32 has_mul; bool has_mul;
u32 has_mulx; bool has_mulx;
/* CPU caches */ /* CPU caches */
u32 icache_line_size; u32 icache_line_size;
......
...@@ -41,11 +41,6 @@ static inline u32 fcpu(struct device_node *cpu, const char *n) ...@@ -41,11 +41,6 @@ static inline u32 fcpu(struct device_node *cpu, const char *n)
return val; return val;
} }
static inline u32 fcpu_has(struct device_node *cpu, const char *n)
{
return of_get_property(cpu, n, NULL) ? 1 : 0;
}
void __init setup_cpuinfo(void) void __init setup_cpuinfo(void)
{ {
struct device_node *cpu; struct device_node *cpu;
...@@ -56,7 +51,7 @@ void __init setup_cpuinfo(void) ...@@ -56,7 +51,7 @@ void __init setup_cpuinfo(void)
if (!cpu) if (!cpu)
panic("%s: No CPU found in devicetree!\n", __func__); panic("%s: No CPU found in devicetree!\n", __func__);
if (!fcpu_has(cpu, "altr,has-initda")) if (!of_property_read_bool(cpu, "altr,has-initda"))
panic("initda instruction is unimplemented. Please update your " panic("initda instruction is unimplemented. Please update your "
"hardware system to have more than 4-byte line data " "hardware system to have more than 4-byte line data "
"cache\n"); "cache\n");
...@@ -69,10 +64,10 @@ void __init setup_cpuinfo(void) ...@@ -69,10 +64,10 @@ void __init setup_cpuinfo(void)
else else
strcpy(cpuinfo.cpu_impl, "<unknown>"); strcpy(cpuinfo.cpu_impl, "<unknown>");
cpuinfo.has_div = fcpu_has(cpu, "altr,has-div"); cpuinfo.has_div = of_property_read_bool(cpu, "altr,has-div");
cpuinfo.has_mul = fcpu_has(cpu, "altr,has-mul"); cpuinfo.has_mul = of_property_read_bool(cpu, "altr,has-mul");
cpuinfo.has_mulx = fcpu_has(cpu, "altr,has-mulx"); cpuinfo.has_mulx = of_property_read_bool(cpu, "altr,has-mulx");
cpuinfo.mmu = fcpu_has(cpu, "altr,has-mmu"); cpuinfo.mmu = of_property_read_bool(cpu, "altr,has-mmu");
if (IS_ENABLED(CONFIG_NIOS2_HW_DIV_SUPPORT) && !cpuinfo.has_div) if (IS_ENABLED(CONFIG_NIOS2_HW_DIV_SUPPORT) && !cpuinfo.has_div)
err_cpu("DIV"); err_cpu("DIV");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment