initial commit with v2.6.9
[linux-2.6.9-moxart.git] / include / linux / mtd / flashchip.h
blobc3ac4df7273f9b9262d282ca49ff99e6b0b9665e
2 /*
3 * struct flchip definition
4 *
5 * Contains information about the location and state of a given flash device
7 * (C) 2000 Red Hat. GPLd.
9 * $Id: flashchip.h,v 1.14 2004/06/15 16:44:59 nico Exp $
13 #ifndef __MTD_FLASHCHIP_H__
14 #define __MTD_FLASHCHIP_H__
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
20 #include <linux/sched.h>
22 typedef 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_UNKNOWN
41 } flstate_t;
45 /* NOTE: confusingly, this can be used to refer to more than one chip at a time,
46 if they're interleaved. This can even refer to individual partitions on
47 the same physical chip when present. */
49 struct flchip {
50 unsigned long start; /* Offset within the map */
51 // unsigned long len;
52 /* We omit len for now, because when we group them together
53 we insist that they're all of the same size, and the chip size
54 is held in the next level up. If we get more versatile later,
55 it'll make it a damn sight harder to find which chip we want from
56 a given offset, and we'll want to add the per-chip length field
57 back in.
59 int ref_point_counter;
60 flstate_t state;
61 flstate_t oldstate;
63 int write_suspended:1;
64 int erase_suspended:1;
65 unsigned long in_progress_block_addr;
67 spinlock_t *mutex;
68 spinlock_t _spinlock; /* We do it like this because sometimes they'll be shared. */
69 wait_queue_head_t wq; /* Wait on here when we're waiting for the chip
70 to be ready */
71 int word_write_time;
72 int buffer_write_time;
73 int erase_time;
75 void *priv;
78 /* This is used to handle contention on write/erase operations
79 between partitions of the same physical chip. */
80 struct flchip_shared {
81 spinlock_t lock;
82 struct flchip *writing;
83 struct flchip *erasing;
87 #endif /* __MTD_FLASHCHIP_H__ */