]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blame - include/linux/mtd/xip.h
UBUNTU: Ubuntu-4.15.0-96.97
[mirror_ubuntu-bionic-kernel.git] / include / linux / mtd / xip.h
CommitLineData
1da177e4
LT
1/*
2 * MTD primitives for XIP support
3 *
4 * Author: Nicolas Pitre
5 * Created: Nov 2, 2004
6 * Copyright: (C) 2004 MontaVista Software, Inc.
7 *
8 * This XIP support for MTD has been loosely inspired
9 * by an earlier patch authored by David Woodhouse.
10 *
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.
1da177e4
LT
14 */
15
16#ifndef __LINUX_MTD_XIP_H__
17#define __LINUX_MTD_XIP_H__
18
1da177e4
LT
19
20#ifdef CONFIG_MTD_XIP
21
1da177e4
LT
22/*
23 * We really don't want gcc to guess anything.
24 * We absolutely _need_ proper inlining.
25 */
26#include <linux/compiler.h>
27
fb025873
NP
28/*
29 * Function that are modifying the flash state away from array mode must
30 * obviously not be running from flash. The __xipram is therefore marking
31 * those functions so they get relocated to ram.
32 */
129f6c48
AB
33#ifdef CONFIG_XIP_KERNEL
34#define __xipram noinline __attribute__ ((__section__ (".xiptext")))
35#endif
fb025873 36
1da177e4
LT
37/*
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).
41 *
42 * xip_irqpending()
43 *
44 * return non zero when any hardware interrupt is pending.
45 *
46 * xip_currtime()
47 *
48 * return a platform specific time reference to be used with
49 * xip_elapsed_since().
50 *
51 * xip_elapsed_since(x)
52 *
53 * return in usecs the elapsed timebetween now and the reference x as
54 * returned by xip_currtime().
55 *
25985edc 56 * note 1: conversion to usec can be approximated, as long as the
1da177e4
LT
57 * returned value is <= the real elapsed time.
58 * note 2: this should be able to cope with a few seconds without
59 * overflowing.
97f927a4
TG
60 *
61 * xip_iprefetch()
61ecfa87 62 *
97f927a4 63 * Macro to fill instruction prefetch
61ecfa87 64 * e.g. a series of nops: asm volatile (".rep 8; nop; .endr");
1da177e4
LT
65 */
66
97f927a4 67#include <asm/mtd-xip.h>
1da177e4 68
97f927a4 69#ifndef xip_irqpending
1da177e4
LT
70
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"
74
75#define xip_irqpending() (0)
76#define xip_currtime() (0)
77#define xip_elapsed_since(x) (0)
78
79#endif
80
97f927a4
TG
81#ifndef xip_iprefetch
82#define xip_iprefetch() do { } while (0)
83#endif
84
1da177e4
LT
85/*
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.
97f927a4 89 * This should not rely upon standard kernel code.
1da177e4 90 */
97f927a4 91#ifndef xip_cpu_idle
1da177e4
LT
92#define xip_cpu_idle() do { } while (0)
93#endif
94
129f6c48 95#endif /* CONFIG_MTD_XIP */
1da177e4 96
129f6c48 97#ifndef __xipram
1da177e4 98#define __xipram
129f6c48 99#endif
1da177e4
LT
100
101#endif /* __LINUX_MTD_XIP_H__ */