aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@tglx.tec.linutronix.de>2005-07-07 10:50:16 -0400
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-07-07 10:50:16 -0400
commit97f927a4d7dbccde0a854a62c3ea54d90bae8679 (patch)
treed571cdae6507be90d4ee67d4937b765e2b332d77
parentb9c86d595d2a11009c58c84a9a8792aeb4a8f278 (diff)
[MTD] XIP cleanup
Move the architecture dependend code into include/asm/mtd-xip.h Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0001.c2
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0002.c2
-rw-r--r--include/asm-arm/arch-pxa/mtd-xip.h37
-rw-r--r--include/asm-arm/arch-sa1100/mtd-xip.h26
-rw-r--r--include/asm-arm/mtd-xip.h26
-rw-r--r--include/linux/mtd/xip.h31
6 files changed, 104 insertions, 20 deletions
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c
index 8b1304531d8f..0cfcd88468e0 100644
--- a/drivers/mtd/chips/cfi_cmdset_0001.c
+++ b/drivers/mtd/chips/cfi_cmdset_0001.c
@@ -845,7 +845,7 @@ static void __xipram xip_enable(struct map_info *map, struct flchip *chip,
845 chip->state = FL_READY; 845 chip->state = FL_READY;
846 } 846 }
847 (void) map_read(map, adr); 847 (void) map_read(map, adr);
848 asm volatile (".rep 8; nop; .endr"); /* fill instruction prefetch */ 848 xip_iprefetch();
849 local_irq_enable(); 849 local_irq_enable();
850} 850}
851 851
diff --git a/drivers/mtd/chips/cfi_cmdset_0002.c b/drivers/mtd/chips/cfi_cmdset_0002.c
index c76c30de48fb..8505f118f2db 100644
--- a/drivers/mtd/chips/cfi_cmdset_0002.c
+++ b/drivers/mtd/chips/cfi_cmdset_0002.c
@@ -600,7 +600,7 @@ static void __xipram xip_enable(struct map_info *map, struct flchip *chip,
600 chip->state = FL_READY; 600 chip->state = FL_READY;
601 } 601 }
602 (void) map_read(map, adr); 602 (void) map_read(map, adr);
603 asm volatile (".rep 8; nop; .endr"); /* fill instruction prefetch */ 603 xip_iprefetch();
604 local_irq_enable(); 604 local_irq_enable();
605} 605}
606 606
diff --git a/include/asm-arm/arch-pxa/mtd-xip.h b/include/asm-arm/arch-pxa/mtd-xip.h
new file mode 100644
index 000000000000..8704dbceb432
--- /dev/null
+++ b/include/asm-arm/arch-pxa/mtd-xip.h
@@ -0,0 +1,37 @@
1/*
2 * MTD primitives for XIP support. Architecture specific functions
3 *
4 * Do not include this file directly. It's included from linux/mtd/xip.h
5 *
6 * Author: Nicolas Pitre
7 * Created: Nov 2, 2004
8 * Copyright: (C) 2004 MontaVista Software, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 * $Id: xip.h,v 1.2 2004/12/01 15:49:10 nico Exp $
15 */
16
17#ifndef __ARCH_PXA_MTD_XIP_H__
18#define __ARCH_PXA_MTD_XIP_H__
19
20#include <asm/arch/pxa-regs.h>
21
22#define xip_irqpending() (ICIP & ICMR)
23
24/* we sample OSCR and convert desired delta to usec (1/4 ~= 1000000/3686400) */
25#define xip_currtime() (OSCR)
26#define xip_elapsed_since(x) (signed)((OSCR - (x)) / 4)
27
28/*
29 * xip_cpu_idle() is used when waiting for a delay equal or larger than
30 * the system timer tick period. This should put the CPU into idle mode
31 * to save power and to be woken up only when some interrupts are pending.
32 * As above, this should not rely upon standard kernel code.
33 */
34
35#define xip_cpu_idle() asm volatile ("mcr p14, 0, %0, c7, c0, 0" :: "r" (1))
36
37#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
index 000000000000..80cfdac2b944
--- /dev/null
+++ b/include/asm-arm/arch-sa1100/mtd-xip.h
@@ -0,0 +1,26 @@
1/*
2 * MTD primitives for XIP support. Architecture specific functions
3 *
4 * Do not include this file directly. It's included from linux/mtd/xip.h
5 *
6 * Author: Nicolas Pitre
7 * Created: Nov 2, 2004
8 * Copyright: (C) 2004 MontaVista Software, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 * $Id: xip.h,v 1.2 2004/12/01 15:49:10 nico Exp $
15 */
16
17#ifndef __ARCH_SA1100_MTD_XIP_H__
18#define __ARCH_SA1100_MTD_XIP_H__
19
20#define xip_irqpending() (ICIP & ICMR)
21
22/* we sample OSCR and convert desired delta to usec (1/4 ~= 1000000/3686400) */
23#define xip_currtime() (OSCR)
24#define xip_elapsed_since(x) (signed)((OSCR - (x)) / 4)
25
26#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
index 000000000000..9eb127cc7db2
--- /dev/null
+++ b/include/asm-arm/mtd-xip.h
@@ -0,0 +1,26 @@
1/*
2 * MTD primitives for XIP support. Architecture specific functions
3 *
4 * Do not include this file directly. It's included from linux/mtd/xip.h
5 *
6 * Author: Nicolas Pitre
7 * Created: Nov 2, 2004
8 * Copyright: (C) 2004 MontaVista Software, Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 *
14 * $Id: xip.h,v 1.2 2004/12/01 15:49:10 nico Exp $
15 */
16
17#ifndef __ARM_MTD_XIP_H__
18#define __ARM_MTD_XIP_H__
19
20#include <asm/hardware.h>
21#include <asm/arch/mtd-xip.h>
22
23/* fill instruction prefetch */
24#define xip_iprefetch() do { asm volatile (".rep 8; nop; .endr"); } while (0)
25
26#endif /* __ARM_MTD_XIP_H__ */
diff --git a/include/linux/mtd/xip.h b/include/linux/mtd/xip.h
index fc071125cbcc..7b7deef6b180 100644
--- a/include/linux/mtd/xip.h
+++ b/include/linux/mtd/xip.h
@@ -58,22 +58,16 @@
58 * returned value is <= the real elapsed time. 58 * returned value is <= the real elapsed time.
59 * note 2: this should be able to cope with a few seconds without 59 * note 2: this should be able to cope with a few seconds without
60 * overflowing. 60 * overflowing.
61 *
62 * xip_iprefetch()
63 *
64 * Macro to fill instruction prefetch
65 * e.g. a series of nops: asm volatile (".rep 8; nop; .endr");
61 */ 66 */
62 67
63#if defined(CONFIG_ARCH_SA1100) || defined(CONFIG_ARCH_PXA) 68#include <asm/mtd-xip.h>
64
65#include <asm/hardware.h>
66#ifdef CONFIG_ARCH_PXA
67#include <asm/arch/pxa-regs.h>
68#endif
69
70#define xip_irqpending() (ICIP & ICMR)
71
72/* we sample OSCR and convert desired delta to usec (1/4 ~= 1000000/3686400) */
73#define xip_currtime() (OSCR)
74#define xip_elapsed_since(x) (signed)((OSCR - (x)) / 4)
75 69
76#else 70#ifndef xip_irqpending
77 71
78#warning "missing IRQ and timer primitives for XIP MTD support" 72#warning "missing IRQ and timer primitives for XIP MTD support"
79#warning "some of the XIP MTD support code will be disabled" 73#warning "some of the XIP MTD support code will be disabled"
@@ -85,16 +79,17 @@
85 79
86#endif 80#endif
87 81
82#ifndef xip_iprefetch
83#define xip_iprefetch() do { } while (0)
84#endif
85
88/* 86/*
89 * xip_cpu_idle() is used when waiting for a delay equal or larger than 87 * xip_cpu_idle() is used when waiting for a delay equal or larger than
90 * the system timer tick period. This should put the CPU into idle mode 88 * the system timer tick period. This should put the CPU into idle mode
91 * to save power and to be woken up only when some interrupts are pending. 89 * to save power and to be woken up only when some interrupts are pending.
92 * As above, this should not rely upon standard kernel code. 90 * This should not rely upon standard kernel code.
93 */ 91 */
94 92#ifndef xip_cpu_idle
95#if defined(CONFIG_CPU_XSCALE)
96#define xip_cpu_idle() asm volatile ("mcr p14, 0, %0, c7, c0, 0" :: "r" (1))
97#else
98#define xip_cpu_idle() do { } while (0) 93#define xip_cpu_idle() do { } while (0)
99#endif 94#endif
100 95