1
2
3
4
5
6
7#ifndef __MTD_FLASHCHIP_H__
8#define __MTD_FLASHCHIP_H__
9
10
11
12
13
14#include <linux/sched.h>
15#include <linux/mutex.h>
16
17typedef enum {
18 FL_READY,
19 FL_STATUS,
20 FL_CFI_QUERY,
21 FL_JEDEC_QUERY,
22 FL_ERASING,
23 FL_ERASE_SUSPENDING,
24 FL_ERASE_SUSPENDED,
25 FL_WRITING,
26 FL_WRITING_TO_BUFFER,
27 FL_OTP_WRITE,
28 FL_WRITE_SUSPENDING,
29 FL_WRITE_SUSPENDED,
30 FL_PM_SUSPENDED,
31 FL_SYNCING,
32 FL_UNLOADING,
33 FL_LOCKING,
34 FL_UNLOCKING,
35 FL_POINT,
36 FL_XIP_WHILE_ERASING,
37 FL_XIP_WHILE_WRITING,
38 FL_SHUTDOWN,
39
40 FL_READING,
41 FL_CACHEDPRG,
42
43 FL_RESETTING,
44 FL_OTPING,
45 FL_PREPARING_ERASE,
46 FL_VERIFYING_ERASE,
47
48 FL_UNKNOWN
49} flstate_t;
50
51
52
53
54
55
56
57struct flchip {
58 unsigned long start;
59
60
61
62
63
64
65
66
67 int ref_point_counter;
68 flstate_t state;
69 flstate_t oldstate;
70
71 unsigned int write_suspended:1;
72 unsigned int erase_suspended:1;
73 unsigned long in_progress_block_addr;
74 unsigned long in_progress_block_mask;
75
76 struct mutex mutex;
77 wait_queue_head_t wq;
78
79 int word_write_time;
80 int buffer_write_time;
81 int erase_time;
82
83 int word_write_time_max;
84 int buffer_write_time_max;
85 int erase_time_max;
86
87 void *priv;
88};
89
90
91
92struct flchip_shared {
93 struct mutex lock;
94 struct flchip *writing;
95 struct flchip *erasing;
96};
97
98
99#endif
100