Commit edebea98 authored by Marek Vasut's avatar Marek Vasut Committed by Ley Foon Tan

nios2: Add CDX support

Add support for the CDX Code Density Extensions present in
Nios II R2 . This introduces new 16bit instruction set to
improve code density while retaining support for the 32bit
Nios II R2 instructions.
Signed-off-by: default avatarMarek Vasut <marex@denx.de>
Cc: Ley Foon Tan <lftan@altera.com>
parent 23460839
...@@ -30,6 +30,7 @@ KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_MUL_SUPPORT),-mhw-mul,-mno-hw-mul) ...@@ -30,6 +30,7 @@ KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_MUL_SUPPORT),-mhw-mul,-mno-hw-mul)
KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_MULX_SUPPORT),-mhw-mulx,-mno-hw-mulx) KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_MULX_SUPPORT),-mhw-mulx,-mno-hw-mulx)
KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_DIV_SUPPORT),-mhw-div,-mno-hw-div) KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_HW_DIV_SUPPORT),-mhw-div,-mno-hw-div)
KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_BMX_SUPPORT),-mbmx,-mno-bmx) KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_BMX_SUPPORT),-mbmx,-mno-bmx)
KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_CDX_SUPPORT),-mcdx,-mno-cdx)
KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_FPU_SUPPORT),-mcustom-fpu-cfg=60-1,) KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_FPU_SUPPORT),-mcustom-fpu-cfg=60-1,)
KBUILD_CFLAGS += -fno-optimize-sibling-calls KBUILD_CFLAGS += -fno-optimize-sibling-calls
......
...@@ -30,6 +30,7 @@ struct cpuinfo { ...@@ -30,6 +30,7 @@ struct cpuinfo {
bool has_mul; bool has_mul;
bool has_mulx; bool has_mulx;
bool has_bmx; bool has_bmx;
bool has_cdx;
/* CPU caches */ /* CPU caches */
u32 icache_line_size; u32 icache_line_size;
......
...@@ -68,6 +68,7 @@ void __init setup_cpuinfo(void) ...@@ -68,6 +68,7 @@ void __init setup_cpuinfo(void)
cpuinfo.has_mul = of_property_read_bool(cpu, "altr,has-mul"); cpuinfo.has_mul = of_property_read_bool(cpu, "altr,has-mul");
cpuinfo.has_mulx = of_property_read_bool(cpu, "altr,has-mulx"); cpuinfo.has_mulx = of_property_read_bool(cpu, "altr,has-mulx");
cpuinfo.has_bmx = of_property_read_bool(cpu, "altr,has-bmx"); cpuinfo.has_bmx = of_property_read_bool(cpu, "altr,has-bmx");
cpuinfo.has_cdx = of_property_read_bool(cpu, "altr,has-cdx");
cpuinfo.mmu = of_property_read_bool(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)
...@@ -82,6 +83,9 @@ void __init setup_cpuinfo(void) ...@@ -82,6 +83,9 @@ void __init setup_cpuinfo(void)
if (IS_ENABLED(CONFIG_NIOS2_BMX_SUPPORT) && !cpuinfo.has_bmx) if (IS_ENABLED(CONFIG_NIOS2_BMX_SUPPORT) && !cpuinfo.has_bmx)
err_cpu("BMX"); err_cpu("BMX");
if (IS_ENABLED(CONFIG_NIOS2_CDX_SUPPORT) && !cpuinfo.has_cdx)
err_cpu("CDX");
cpuinfo.tlb_num_ways = fcpu(cpu, "altr,tlb-num-ways"); cpuinfo.tlb_num_ways = fcpu(cpu, "altr,tlb-num-ways");
if (!cpuinfo.tlb_num_ways) if (!cpuinfo.tlb_num_ways)
panic("altr,tlb-num-ways can't be 0. Please check your hardware " panic("altr,tlb-num-ways can't be 0. Please check your hardware "
...@@ -148,11 +152,13 @@ static int show_cpuinfo(struct seq_file *m, void *v) ...@@ -148,11 +152,13 @@ static int show_cpuinfo(struct seq_file *m, void *v)
" MUL:\t\t%s\n" " MUL:\t\t%s\n"
" MULX:\t\t%s\n" " MULX:\t\t%s\n"
" DIV:\t\t%s\n" " DIV:\t\t%s\n"
" BMX:\t\t%s\n", " BMX:\t\t%s\n"
" CDX:\t\t%s\n",
cpuinfo.has_mul ? "yes" : "no", cpuinfo.has_mul ? "yes" : "no",
cpuinfo.has_mulx ? "yes" : "no", cpuinfo.has_mulx ? "yes" : "no",
cpuinfo.has_div ? "yes" : "no", cpuinfo.has_div ? "yes" : "no",
cpuinfo.has_bmx ? "yes" : "no"); cpuinfo.has_bmx ? "yes" : "no",
cpuinfo.has_cdx ? "yes" : "no");
seq_printf(m, seq_printf(m,
"Icache:\t\t%ukB, line length: %u\n", "Icache:\t\t%ukB, line length: %u\n",
......
...@@ -90,6 +90,15 @@ config NIOS2_BMX_SUPPORT ...@@ -90,6 +90,15 @@ config NIOS2_BMX_SUPPORT
the BMX Bit Manipulation Extension instructions. Enables the BMX Bit Manipulation Extension instructions. Enables
the -mbmx compiler flag. the -mbmx compiler flag.
config NIOS2_CDX_SUPPORT
bool "Enable CDX instructions"
depends on NIOS2_ARCH_REVISION = 2
default n
help
Set to true if you configured the Nios II R2 to include
the CDX Bit Manipulation Extension instructions. Enables
the -mcdx compiler flag.
config NIOS2_FPU_SUPPORT config NIOS2_FPU_SUPPORT
bool "Custom floating point instr support" bool "Custom floating point instr support"
default n default n
......
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