m68knommu: add ffs and __ffs plattform which support ISA A+ or ISA C
authorSebastian Siewior <bigeasy@linutronix.de>
Fri, 9 May 2008 14:10:37 +0000 (16:10 +0200)
committerGreg Ungerer <gerg@uclinux.org>
Wed, 23 Jul 2008 05:11:28 +0000 (15:11 +1000)
the ff1 and bitrev opcode appears in ISA C and ISA A+ what isn't
supported by all plattforms. The assembly optimization is automaticly
enabled if the compiler understand the required cpu keyword.
My m5235 seems to boot and run fine so far.

Signed-off-by: Sebastian Siewior <bigeasy@linutronix.de>
Signed-off-by: Greg Ungerer <gerg@uclinux.org>
arch/m68knommu/Makefile
include/asm-m68knommu/bitops.h

index e0b5f62..b63bbcf 100644 (file)
@@ -8,6 +8,8 @@
 # (C) Copyright 2002, Greg Ungerer <gerg@snapgear.com>
 #
 
+KBUILD_DEFCONFIG := m5208evb_defconfig
+
 platform-$(CONFIG_M68328)      := 68328
 platform-$(CONFIG_M68EZ328)    := 68EZ328
 platform-$(CONFIG_M68VZ328)    := 68VZ328
@@ -90,13 +92,14 @@ export PLATFORM BOARD MODEL CPUCLASS
 cflags-$(CONFIG_M5206)         := -m5200
 cflags-$(CONFIG_M5206e)                := -m5200
 cflags-$(CONFIG_M520x)         := -m5307
-cflags-$(CONFIG_M523x)         := -m5307
+cflags-$(CONFIG_M523x)         := $(call cc-option,-mcpu=523x,-m5307)
 cflags-$(CONFIG_M5249)         := -m5200
-cflags-$(CONFIG_M527x)         := -m5307
+cflags-$(CONFIG_M5271)         := $(call cc-option,-mcpu=5271,-m5307)
 cflags-$(CONFIG_M5272)         := -m5307
-cflags-$(CONFIG_M528x)         := -m5307
+cflags-$(CONFIG_M5275)         := $(call cc-option,-mcpu=5275,-m5307)
+cflags-$(CONFIG_M528x)         := $(call cc-option,-m528x,-m5307)
 cflags-$(CONFIG_M5307)         := -m5307
-cflags-$(CONFIG_M532x)         := -m5307
+cflags-$(CONFIG_M532x)         := $(call cc-option,-mcpu=532x,-m5307)
 cflags-$(CONFIG_M5407)         := -m5200
 cflags-$(CONFIG_M68328)                := -m68000
 cflags-$(CONFIG_M68EZ328)      := -m68000
index c142fbf..6f3685e 100644 (file)
 #error only <linux/bitops.h> can be included directly
 #endif
 
+#if defined (__mcfisaaplus__) || defined (__mcfisac__)
+static inline int ffs(unsigned int val)
+{
+        if (!val)
+                return 0;
+
+        asm volatile(
+                        "bitrev %0\n\t"
+                        "ff1 %0\n\t"
+                        : "=d" (val)
+                        : "0" (val)
+                   );
+        val++;
+        return val;
+}
+
+static inline int __ffs(unsigned int val)
+{
+        asm volatile(
+                        "bitrev %0\n\t"
+                        "ff1 %0\n\t"
+                        : "=d" (val)
+                        : "0" (val)
+                   );
+        return val;
+}
+
+#else
 #include <asm-generic/bitops/ffs.h>
 #include <asm-generic/bitops/__ffs.h>
+#endif
+
 #include <asm-generic/bitops/sched.h>
 #include <asm-generic/bitops/ffz.h>