diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-arm/arch-pxa/mtd-xip.h | 37 | ||||
-rw-r--r-- | include/asm-arm/arch-sa1100/mtd-xip.h | 26 | ||||
-rw-r--r-- | include/asm-arm/mtd-xip.h | 26 | ||||
-rw-r--r-- | include/linux/mtd/xip.h | 31 |
4 files changed, 102 insertions, 18 deletions
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 | ||