File: /usr/include/linux/mtd/cfi.h

1     
2     /* Common Flash Interface structures 
3      * See http://support.intel.com/design/flash/technote/index.htm
4      * $Id: cfi.h,v 1.6 2000/07/03 13:29:16 dwmw2 Exp $
5      */
6     
7     #ifndef __MTD_CFI_H__
8     #define __MTD_CFI_H__
9     
10     #include <linux/types.h>
11     #include <linux/mtd/flashchip.h>
12     
13     /* NB: We keep these structures in memory in HOST byteorder, except
14      * where individually noted.
15      */
16     
17     /* Basic Query Structure */
18     struct cfi_ident {
19       __u8  qry[3];
20       __u16 P_ID;
21       __u16 P_ADR;
22       __u16 A_ID;
23       __u16 A_ADR;
24       __u8  VccMin;
25       __u8  VccMax;
26       __u8  VppMin;
27       __u8  VppMax;
28       __u8  WordWriteTimeoutTyp;
29       __u8  BufWriteTimeoutTyp;
30       __u8  BlockEraseTimeoutTyp;
31       __u8  ChipEraseTimeoutTyp;
32       __u8  WordWriteTimeoutMax;
33       __u8  BufWriteTimeoutMax;
34       __u8  BlockEraseTimeoutMax;
35       __u8  ChipEraseTimeoutMax;
36       __u8  DevSize;
37       __u16 InterfaceDesc;
38       __u16 MaxBufWriteSize;
39       __u8  NumEraseRegions;
40       __u32 EraseRegionInfo[1]; /* Not host ordered */
41     } __attribute__((packed));
42     
43     /* Extended Query Structure for both PRI and ALT */
44     
45     struct cfi_extquery {
46       __u8  pri[3];
47       __u8  MajorVersion;
48       __u8  MinorVersion;
49     } __attribute__((packed));
50     
51     /* Vendor-Specific PRI for Intel/Sharp Extended Command Set (0x0001) */
52     
53     struct cfi_pri_intelext {
54       __u8  pri[3];
55       __u8  MajorVersion;
56       __u8  MinorVersion;
57       __u32 FeatureSupport;
58       __u8  SuspendCmdSupport;
59       __u16 BlkStatusRegMask;
60       __u8  VccOptimal;
61       __u8  VppOptimal;
62     } __attribute__((packed));
63     
64     struct cfi_pri_query {
65       __u8  NumFields;
66       __u32 ProtField[1]; /* Not host ordered */
67     } __attribute__((packed));
68     
69     struct cfi_bri_query {
70       __u8  PageModeReadCap;
71       __u8  NumFields;
72       __u32 ConfField[1]; /* Not host ordered */
73     } __attribute__((packed));
74     
75     #define P_ID_NONE 0
76     #define P_ID_INTEL_EXT 1
77     #define P_ID_AMD_STD 2
78     #define P_ID_INTEL_STD 3
79     #define P_ID_AMD_EXT 4
80     #define P_ID_MITSUBISHI_STD 256
81     #define P_ID_MITSUBISHI_EXT 257
82     #define P_ID_RESERVED 65535
83     
84     
85     struct cfi_private {
86     	__u16 cmdset;
87     	void *cmdset_priv;
88     	int interleave;
89     	struct mtd_info *(*cmdset_setup)(struct map_info *);
90     	struct cfi_ident cfiq; /* For now only one. We insist that all devs
91     				  must be of the same type. */
92     	int numchips;
93     	unsigned long chipshift; /* Because they're of the same type */
94     	const char *im_name;	 /* inter_module name for cmdset_setup */
95     	struct flchip chips[0];  /* per-chip data structure for each chip */
96     	/* do not add extra fields after "chips" */
97     };
98     
99     #define MAX_CFI_CHIPS 8 /* Entirely arbitrary to avoid realloc() */
100     
101     #endif /* __MTD_CFI_H__ */
102