Merge git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
[wrt350n-kernel.git] / include / linux / mtd / xip.h
blobe9d40bdde48cba0f5d3083028e152aa6bac60269
1 /*
2 * MTD primitives for XIP support
4 * Author: Nicolas Pitre
5 * Created: Nov 2, 2004
6 * Copyright: (C) 2004 MontaVista Software, Inc.
8 * This XIP support for MTD has been loosely inspired
9 * by an earlier patch authored by David Woodhouse.
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
15 * $Id: xip.h,v 1.5 2005/11/07 11:14:55 gleixner Exp $
18 #ifndef __LINUX_MTD_XIP_H__
19 #define __LINUX_MTD_XIP_H__
22 #ifdef CONFIG_MTD_XIP
25 * We really don't want gcc to guess anything.
26 * We absolutely _need_ proper inlining.
28 #include <linux/compiler.h>
31 * Function that are modifying the flash state away from array mode must
32 * obviously not be running from flash. The __xipram is therefore marking
33 * those functions so they get relocated to ram.
35 #define __xipram noinline __attribute__ ((__section__ (".data")))
38 * Each architecture has to provide the following macros. They must access
39 * the hardware directly and not rely on any other (XIP) functions since they
40 * won't be available when used (flash not in array mode).
42 * xip_irqpending()
44 * return non zero when any hardware interrupt is pending.
46 * xip_currtime()
48 * return a platform specific time reference to be used with
49 * xip_elapsed_since().
51 * xip_elapsed_since(x)
53 * return in usecs the elapsed timebetween now and the reference x as
54 * returned by xip_currtime().
56 * note 1: convertion to usec can be approximated, as long as the
57 * returned value is <= the real elapsed time.
58 * note 2: this should be able to cope with a few seconds without
59 * overflowing.
61 * xip_iprefetch()
63 * Macro to fill instruction prefetch
64 * e.g. a series of nops: asm volatile (".rep 8; nop; .endr");
67 #include <asm/mtd-xip.h>
69 #ifndef xip_irqpending
71 #warning "missing IRQ and timer primitives for XIP MTD support"
72 #warning "some of the XIP MTD support code will be disabled"
73 #warning "your system will therefore be unresponsive when writing or erasing flash"
75 #define xip_irqpending() (0)
76 #define xip_currtime() (0)
77 #define xip_elapsed_since(x) (0)
79 #endif
81 #ifndef xip_iprefetch
82 #define xip_iprefetch() do { } while (0)
83 #endif
86 * xip_cpu_idle() is used when waiting for a delay equal or larger than
87 * the system timer tick period. This should put the CPU into idle mode
88 * to save power and to be woken up only when some interrupts are pending.
89 * This should not rely upon standard kernel code.
91 #ifndef xip_cpu_idle
92 #define xip_cpu_idle() do { } while (0)
93 #endif
95 #else
97 #define __xipram
99 #endif /* CONFIG_MTD_XIP */
101 #endif /* __LINUX_MTD_XIP_H__ */