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.1.1.1 2008/10/15 03:27:31 james26_jang 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_UNKNOWN
40} flstate_t;
41
42
43
44/* NOTE: confusingly, this can be used to refer to more than one chip at a time,
45   if they're interleaved. */
46
47struct flchip {
48	unsigned long start; /* Offset within the map */
49	//	unsigned long len;
50	/* We omit len for now, because when we group them together
51	   we insist that they're all of the same size, and the chip size
52	   is held in the next level up. If we get more versatile later,
53	   it'll make it a damn sight harder to find which chip we want from
54	   a given offset, and we'll want to add the per-chip length field
55	   back in.
56	*/
57	flstate_t state;
58	flstate_t oldstate;
59	spinlock_t *mutex;
60	spinlock_t _spinlock; /* We do it like this because sometimes they'll be shared. */
61	wait_queue_head_t wq; /* Wait on here when we're waiting for the chip
62			     to be ready */
63	int word_write_time;
64	int buffer_write_time;
65	int erase_time;
66};
67
68
69
70#endif /* __MTD_FLASHCHIP_H__ */
71