aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/mtd/flashchip.h
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-04-16 18:20:36 -0400
commit1da177e4c3f41524e886b7f1b8a0c1fc7321cac2 (patch)
tree0bba044c4ce775e45a88a51686b5d9f90697ea9d /include/linux/mtd/flashchip.h
Linux-2.6.12-rc2v2.6.12-rc2
Initial git repository build. I'm not bothering with the full history, even though we have it. We can create a separate "historical" git archive of that later if we want to, and in the meantime it's about 3.2GB when imported into git - space that would just make the early git days unnecessarily complicated, when we don't have a lot of good infrastructure for it. Let it rip!
Diffstat (limited to 'include/linux/mtd/flashchip.h')
-rw-r--r--include/linux/mtd/flashchip.h89
1 files changed, 89 insertions, 0 deletions
diff --git a/include/linux/mtd/flashchip.h b/include/linux/mtd/flashchip.h
new file mode 100644
index 000000000000..c66ba812bf90
--- /dev/null
+++ b/include/linux/mtd/flashchip.h
@@ -0,0 +1,89 @@
1
2/*
3 * struct flchip definition
4 *
5 * Contains information about the location and state of a given flash device
6 *
7 * (C) 2000 Red Hat. GPLd.
8 *
9 * $Id: flashchip.h,v 1.15 2004/11/05 22:41:06 nico Exp $
10 *
11 */
12
13#ifndef __MTD_FLASHCHIP_H__
14#define __MTD_FLASHCHIP_H__
15
16/* For spinlocks. sched.h includes spinlock.h from whichever directory it
17 * happens to be in - so we don't have to care whether we're on 2.2, which
18 * has asm/spinlock.h, or 2.4, which has linux/spinlock.h
19 */
20#include <linux/sched.h>
21
22typedef enum {
23 FL_READY,
24 FL_STATUS,
25 FL_CFI_QUERY,
26 FL_JEDEC_QUERY,
27 FL_ERASING,
28 FL_ERASE_SUSPENDING,
29 FL_ERASE_SUSPENDED,
30 FL_WRITING,
31 FL_WRITING_TO_BUFFER,
32 FL_WRITE_SUSPENDING,
33 FL_WRITE_SUSPENDED,
34 FL_PM_SUSPENDED,
35 FL_SYNCING,
36 FL_UNLOADING,
37 FL_LOCKING,
38 FL_UNLOCKING,
39 FL_POINT,
40 FL_XIP_WHILE_ERASING,
41 FL_XIP_WHILE_WRITING,
42 FL_UNKNOWN
43} flstate_t;
44
45
46
47/* NOTE: confusingly, this can be used to refer to more than one chip at a time,
48 if they're interleaved. This can even refer to individual partitions on
49 the same physical chip when present. */
50
51struct flchip {
52 unsigned long start; /* Offset within the map */
53 // unsigned long len;
54 /* We omit len for now, because when we group them together
55 we insist that they're all of the same size, and the chip size
56 is held in the next level up. If we get more versatile later,
57 it'll make it a damn sight harder to find which chip we want from
58 a given offset, and we'll want to add the per-chip length field
59 back in.
60 */
61 int ref_point_counter;
62 flstate_t state;
63 flstate_t oldstate;
64
65 int write_suspended:1;
66 int erase_suspended:1;
67 unsigned long in_progress_block_addr;
68
69 spinlock_t *mutex;
70 spinlock_t _spinlock; /* We do it like this because sometimes they'll be shared. */
71 wait_queue_head_t wq; /* Wait on here when we're waiting for the chip
72 to be ready */
73 int word_write_time;
74 int buffer_write_time;
75 int erase_time;
76
77 void *priv;
78};
79
80/* This is used to handle contention on write/erase operations
81 between partitions of the same physical chip. */
82struct flchip_shared {
83 spinlock_t lock;
84 struct flchip *writing;
85 struct flchip *erasing;
86};
87
88
89#endif /* __MTD_FLASHCHIP_H__ */