]> git.ipfire.org Git - people/ms/linux.git/blame - include/linux/mtd/flashchip.h
mtd: unify status enum from three headers
[people/ms/linux.git] / include / linux / mtd / flashchip.h
CommitLineData
1da177e4 1
61ecfa87 2/*
1da177e4 3 * struct flchip definition
61ecfa87
TG
4 *
5 * Contains information about the location and state of a given flash device
1da177e4
LT
6 *
7 * (C) 2000 Red Hat. GPLd.
1da177e4
LT
8 */
9
10#ifndef __MTD_FLASHCHIP_H__
11#define __MTD_FLASHCHIP_H__
12
13/* For spinlocks. sched.h includes spinlock.h from whichever directory it
14 * happens to be in - so we don't have to care whether we're on 2.2, which
61ecfa87 15 * has asm/spinlock.h, or 2.4, which has linux/spinlock.h
1da177e4
LT
16 */
17#include <linux/sched.h>
18
61ecfa87 19typedef enum {
1da177e4
LT
20 FL_READY,
21 FL_STATUS,
22 FL_CFI_QUERY,
23 FL_JEDEC_QUERY,
24 FL_ERASING,
25 FL_ERASE_SUSPENDING,
26 FL_ERASE_SUSPENDED,
27 FL_WRITING,
28 FL_WRITING_TO_BUFFER,
f77814dd 29 FL_OTP_WRITE,
1da177e4
LT
30 FL_WRITE_SUSPENDING,
31 FL_WRITE_SUSPENDED,
32 FL_PM_SUSPENDED,
33 FL_SYNCING,
34 FL_UNLOADING,
35 FL_LOCKING,
36 FL_UNLOCKING,
37 FL_POINT,
38 FL_XIP_WHILE_ERASING,
39 FL_XIP_WHILE_WRITING,
c4a9f88d 40 FL_SHUTDOWN,
30631cb8
AR
41 /* These 2 come from nand_state_t, which has been unified here */
42 FL_READING,
43 FL_CACHEDPRG,
44 /* These 2 come from onenand_state_t, which has been unified here */
45 FL_RESETING,
46 FL_OTPING,
47
1da177e4
LT
48 FL_UNKNOWN
49} flstate_t;
50
51
52
61ecfa87 53/* NOTE: confusingly, this can be used to refer to more than one chip at a time,
1da177e4
LT
54 if they're interleaved. This can even refer to individual partitions on
55 the same physical chip when present. */
56
57struct flchip {
58 unsigned long start; /* Offset within the map */
59 // unsigned long len;
60 /* We omit len for now, because when we group them together
61 we insist that they're all of the same size, and the chip size
62 is held in the next level up. If we get more versatile later,
63 it'll make it a damn sight harder to find which chip we want from
64 a given offset, and we'll want to add the per-chip length field
65 back in.
66 */
67 int ref_point_counter;
68 flstate_t state;
69 flstate_t oldstate;
70
0514cd93
BD
71 unsigned int write_suspended:1;
72 unsigned int erase_suspended:1;
1da177e4
LT
73 unsigned long in_progress_block_addr;
74
75 spinlock_t *mutex;
76 spinlock_t _spinlock; /* We do it like this because sometimes they'll be shared. */
77 wait_queue_head_t wq; /* Wait on here when we're waiting for the chip
78 to be ready */
79 int word_write_time;
80 int buffer_write_time;
81 int erase_time;
82
e93cafe4
AG
83 int word_write_time_max;
84 int buffer_write_time_max;
85 int erase_time_max;
86
1da177e4
LT
87 void *priv;
88};
89
90/* This is used to handle contention on write/erase operations
91 between partitions of the same physical chip. */
92struct flchip_shared {
93 spinlock_t lock;
94 struct flchip *writing;
95 struct flchip *erasing;
96};
97
98
99#endif /* __MTD_FLASHCHIP_H__ */