]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
[MTD] XIP cleanup
authorThomas Gleixner <tglx@tglx.tec.linutronix.de>
Thu, 7 Jul 2005 14:50:16 +0000 (16:50 +0200)
committerThomas Gleixner <tglx@mtd.linutronix.de>
Thu, 7 Jul 2005 14:50:16 +0000 (16:50 +0200)
Move the architecture dependend code into include/asm/mtd-xip.h

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
drivers/mtd/chips/cfi_cmdset_0001.c
drivers/mtd/chips/cfi_cmdset_0002.c
include/asm-arm/arch-pxa/mtd-xip.h [new file with mode: 0644]
include/asm-arm/arch-sa1100/mtd-xip.h [new file with mode: 0644]
include/asm-arm/mtd-xip.h [new file with mode: 0644]
include/linux/mtd/xip.h

index 8b1304531d8f13dfdb69a4d3b9881df7450b17c6..0cfcd88468e0ed3c2db5da780bc3d7e428c3ab3c 100644 (file)
@@ -845,7 +845,7 @@ static void __xipram xip_enable(struct map_info *map, struct flchip *chip,
                chip->state = FL_READY;
        }
        (void) map_read(map, adr);
-       asm volatile (".rep 8; nop; .endr"); /* fill instruction prefetch */
+       xip_iprefetch();
        local_irq_enable();
 }
 
index c76c30de48fb37a964e022be3b22165a06b3e0e1..8505f118f2dbfcd8d7275c3cb1af5292eaaaca0d 100644 (file)
@@ -600,7 +600,7 @@ static void __xipram xip_enable(struct map_info *map, struct flchip *chip,
                chip->state = FL_READY;
        }
        (void) map_read(map, adr);
-       asm volatile (".rep 8; nop; .endr"); /* fill instruction prefetch */
+       xip_iprefetch();
        local_irq_enable();
 }
 
diff --git a/include/asm-arm/arch-pxa/mtd-xip.h b/include/asm-arm/arch-pxa/mtd-xip.h
new file mode 100644 (file)
index 0000000..8704dbc
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * MTD primitives for XIP support. Architecture specific functions
+ *
+ * Do not include this file directly. It's included from linux/mtd/xip.h
+ * 
+ * Author:     Nicolas Pitre
+ * Created:    Nov 2, 2004
+ * Copyright:  (C) 2004 MontaVista Software, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * $Id: xip.h,v 1.2 2004/12/01 15:49:10 nico Exp $
+ */
+
+#ifndef __ARCH_PXA_MTD_XIP_H__
+#define __ARCH_PXA_MTD_XIP_H__
+
+#include <asm/arch/pxa-regs.h>
+
+#define xip_irqpending()       (ICIP & ICMR)
+
+/* we sample OSCR and convert desired delta to usec (1/4 ~= 1000000/3686400) */
+#define xip_currtime()         (OSCR)
+#define xip_elapsed_since(x)   (signed)((OSCR - (x)) / 4)
+
+/*
+ * xip_cpu_idle() is used when waiting for a delay equal or larger than
+ * the system timer tick period.  This should put the CPU into idle mode
+ * to save power and to be woken up only when some interrupts are pending.
+ * As above, this should not rely upon standard kernel code.
+ */
+
+#define xip_cpu_idle()  asm volatile ("mcr p14, 0, %0, c7, c0, 0" :: "r" (1))
+
+#endif /* __ARCH_PXA_MTD_XIP_H__ */
diff --git a/include/asm-arm/arch-sa1100/mtd-xip.h b/include/asm-arm/arch-sa1100/mtd-xip.h
new file mode 100644 (file)
index 0000000..80cfdac
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * MTD primitives for XIP support. Architecture specific functions
+ *
+ * Do not include this file directly. It's included from linux/mtd/xip.h
+ * 
+ * Author:     Nicolas Pitre
+ * Created:    Nov 2, 2004
+ * Copyright:  (C) 2004 MontaVista Software, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * $Id: xip.h,v 1.2 2004/12/01 15:49:10 nico Exp $
+ */
+
+#ifndef __ARCH_SA1100_MTD_XIP_H__
+#define __ARCH_SA1100_MTD_XIP_H__
+
+#define xip_irqpending()       (ICIP & ICMR)
+
+/* we sample OSCR and convert desired delta to usec (1/4 ~= 1000000/3686400) */
+#define xip_currtime()         (OSCR)
+#define xip_elapsed_since(x)   (signed)((OSCR - (x)) / 4)
+
+#endif /* __ARCH_SA1100_MTD_XIP_H__ */
diff --git a/include/asm-arm/mtd-xip.h b/include/asm-arm/mtd-xip.h
new file mode 100644 (file)
index 0000000..9eb127c
--- /dev/null
@@ -0,0 +1,26 @@
+/*
+ * MTD primitives for XIP support. Architecture specific functions
+ *
+ * Do not include this file directly. It's included from linux/mtd/xip.h
+ * 
+ * Author:     Nicolas Pitre
+ * Created:    Nov 2, 2004
+ * Copyright:  (C) 2004 MontaVista Software, Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ * $Id: xip.h,v 1.2 2004/12/01 15:49:10 nico Exp $
+ */
+
+#ifndef __ARM_MTD_XIP_H__
+#define __ARM_MTD_XIP_H__
+
+#include <asm/hardware.h>
+#include <asm/arch/mtd-xip.h>
+
+/* fill instruction prefetch */
+#define xip_iprefetch()        do { asm volatile (".rep 8; nop; .endr"); } while (0)
+
+#endif /* __ARM_MTD_XIP_H__ */
index fc071125cbccf7e01f09382afd3f16540228ea6f..7b7deef6b180a920fd491f1d1d1660cf2b848745 100644 (file)
  *             returned value is <= the real elapsed time.
  *     note 2: this should be able to cope with a few seconds without
  *             overflowing.
+ *
+ * xip_iprefetch()
+ *  
+ *      Macro to fill instruction prefetch
+ *     e.g. a series of nops:  asm volatile (".rep 8; nop; .endr"); 
  */
 
-#if defined(CONFIG_ARCH_SA1100) || defined(CONFIG_ARCH_PXA)
-
-#include <asm/hardware.h>
-#ifdef CONFIG_ARCH_PXA
-#include <asm/arch/pxa-regs.h>
-#endif
-
-#define xip_irqpending()       (ICIP & ICMR)
-
-/* we sample OSCR and convert desired delta to usec (1/4 ~= 1000000/3686400) */
-#define xip_currtime()         (OSCR)
-#define xip_elapsed_since(x)   (signed)((OSCR - (x)) / 4)
+#include <asm/mtd-xip.h>
 
-#else
+#ifndef xip_irqpending
 
 #warning "missing IRQ and timer primitives for XIP MTD support"
 #warning "some of the XIP MTD support code will be disabled"
 
 #endif
 
+#ifndef xip_iprefetch
+#define xip_iprefetch()                do { } while (0)
+#endif
+
 /*
  * xip_cpu_idle() is used when waiting for a delay equal or larger than
  * the system timer tick period.  This should put the CPU into idle mode
  * to save power and to be woken up only when some interrupts are pending.
- * As above, this should not rely upon standard kernel code.
+ * This should not rely upon standard kernel code.
  */
-
-#if defined(CONFIG_CPU_XSCALE)
-#define xip_cpu_idle()  asm volatile ("mcr p14, 0, %0, c7, c0, 0" :: "r" (1))
-#else
+#ifndef xip_cpu_idle
 #define xip_cpu_idle()  do { } while (0)
 #endif