]> git.ipfire.org Git - people/arne_f/kernel.git/commitdiff
nios2: Add BMX support
authorMarek Vasut <marex@denx.de>
Wed, 19 Apr 2017 11:19:01 +0000 (13:19 +0200)
committerLey Foon Tan <ley.foon.tan@intel.com>
Mon, 8 May 2017 08:59:19 +0000 (16:59 +0800)
Add support for the BMX Bit Manipulation Extensions present in
Nios II R2 . This introduces three new instructions, EXTRACT,
INSERT and MERGE.

Signed-off-by: Marek Vasut <marex@denx.de>
Cc: Ley Foon Tan <lftan@altera.com>
arch/nios2/Makefile
arch/nios2/include/asm/cpuinfo.h
arch/nios2/kernel/cpuinfo.c
arch/nios2/platform/Kconfig.platform

index 38da17e4c90821d88fa03390bb8d9bf87912f181..74109c01eaeab64895692ac3a9e0159772263892 100644 (file)
@@ -29,6 +29,7 @@ KBUILD_CFLAGS += -march=r$(CONFIG_NIOS2_ARCH_REVISION)
 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_DIV_SUPPORT),-mhw-div,-mno-hw-div)
+KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_BMX_SUPPORT),-mbmx,-mno-bmx)
 KBUILD_CFLAGS += $(if $(CONFIG_NIOS2_FPU_SUPPORT),-mcustom-fpu-cfg=60-1,)
 
 KBUILD_CFLAGS += -fno-optimize-sibling-calls
index 348bb228fec90e40245b357e3f53a10641a354c5..79d376435d7d6c5b48f24d91fd52e60b825021b6 100644 (file)
@@ -29,6 +29,7 @@ struct cpuinfo {
        bool has_div;
        bool has_mul;
        bool has_mulx;
+       bool has_bmx;
 
        /* CPU caches */
        u32 icache_line_size;
index b4a6242b0f1c703bb7965c6bb45794fe2f2bbc47..4c84fec348827672ac5a488e74fd7de8fae8829e 100644 (file)
@@ -67,6 +67,7 @@ void __init setup_cpuinfo(void)
        cpuinfo.has_div = of_property_read_bool(cpu, "altr,has-div");
        cpuinfo.has_mul = of_property_read_bool(cpu, "altr,has-mul");
        cpuinfo.has_mulx = of_property_read_bool(cpu, "altr,has-mulx");
+       cpuinfo.has_bmx = of_property_read_bool(cpu, "altr,has-bmx");
        cpuinfo.mmu = of_property_read_bool(cpu, "altr,has-mmu");
 
        if (IS_ENABLED(CONFIG_NIOS2_HW_DIV_SUPPORT) && !cpuinfo.has_div)
@@ -78,6 +79,9 @@ void __init setup_cpuinfo(void)
        if (IS_ENABLED(CONFIG_NIOS2_HW_MULX_SUPPORT) && !cpuinfo.has_mulx)
                err_cpu("MULX");
 
+       if (IS_ENABLED(CONFIG_NIOS2_BMX_SUPPORT) && !cpuinfo.has_bmx)
+               err_cpu("BMX");
+
        cpuinfo.tlb_num_ways = fcpu(cpu, "altr,tlb-num-ways");
        if (!cpuinfo.tlb_num_ways)
                panic("altr,tlb-num-ways can't be 0. Please check your hardware "
@@ -143,10 +147,12 @@ static int show_cpuinfo(struct seq_file *m, void *v)
                   "HW:\n"
                   " MUL:\t\t%s\n"
                   " MULX:\t\t%s\n"
-                  " DIV:\t\t%s\n",
+                  " DIV:\t\t%s\n"
+                  " BMX:\t\t%s\n",
                   cpuinfo.has_mul ? "yes" : "no",
                   cpuinfo.has_mulx ? "yes" : "no",
-                  cpuinfo.has_div ? "yes" : "no");
+                  cpuinfo.has_div ? "yes" : "no",
+                  cpuinfo.has_bmx ? "yes" : "no");
 
        seq_printf(m,
                   "Icache:\t\t%ukB, line length: %u\n",
index b7ac5b90c3999c03dabb5da6a43629737e928490..b6a8bfd59491ec72a1c89b4a2f06e17a3fb8e759 100644 (file)
@@ -81,6 +81,15 @@ config NIOS2_HW_DIV_SUPPORT
          Set to true if you configured the Nios II to include the DIV
          instruction.  Enables the -mhw-div compiler flag.
 
+config NIOS2_BMX_SUPPORT
+       bool "Enable BMX instructions"
+       depends on NIOS2_ARCH_REVISION = 2
+       default n
+       help
+         Set to true if you configured the Nios II R2 to include
+         the BMX Bit Manipulation Extension instructions. Enables
+         the -mbmx compiler flag.
+
 config NIOS2_FPU_SUPPORT
        bool "Custom floating point instr support"
        default n