1 
2 /* JEDEC Flash Interface.
3  * This is an older type of interface for self programming flash. It is
4  * commonly use in older AMD chips and is obsolete compared with CFI.
5  * It is called JEDEC because the JEDEC association distributes the ID codes
6  * for the chips.
7  *
8  * See the AMD flash databook for information on how to operate the interface.
9  *
10  * $Id: jedec.h,v 1.2 2001/11/06 14:37:36 dwmw2 Exp $
11  */
12 
13 #ifndef __LINUX_MTD_JEDEC_H__
14 #define __LINUX_MTD_JEDEC_H__
15 
16 #include <linux/types.h>
17 #include <linux/mtd/map.h>
18 
19 #define MAX_JEDEC_CHIPS 16
20 
21 // Listing of all supported chips and their information
22 struct JEDECTable
23 {
24    __u16 jedec;
25    char *name;
26    unsigned long size;
27    unsigned long sectorsize;
28    __u32 capabilities;
29 };
30 
31 // JEDEC being 0 is the end of the chip array
32 struct jedec_flash_chip
33 {
34    __u16 jedec;
35    unsigned long size;
36    unsigned long sectorsize;
37 
38    // *(__u8*)(base + (adder << addrshift)) = data << datashift
39    // Address size = size << addrshift
40    unsigned long base;           // Byte 0 of the flash, will be unaligned
41    unsigned int datashift;       // Useful for 32bit/16bit accesses
42    unsigned int addrshift;
43    unsigned long offset;         // linerized start. base==offset for unbanked, uninterleaved flash
44 
45    __u32 capabilities;
46 
47    // These markers are filled in by the flash_chip_scan function
48    unsigned long start;
49    unsigned long length;
50 };
51 
52 struct jedec_private
53 {
54    unsigned long size;         // Total size of all the devices
55 
56    /* Bank handling. If sum(bank_fill) == size then this is linear flash.
57       Otherwise the mapping has holes in it. bank_fill may be used to
58       find the holes, but in the common symetric case
59       bank_fill[0] == bank_fill[*], thus addresses may be computed
60       mathmatically. bank_fill must be powers of two */
61    unsigned is_banked;
62    unsigned long bank_fill[MAX_JEDEC_CHIPS];
63 
64    struct jedec_flash_chip chips[MAX_JEDEC_CHIPS];
65 };
66 
67 #endif
68