| 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 | */ |
|---|
| 11 | |
|---|
| 12 | #ifndef __LINUX_MTD_JEDEC_H__ |
|---|
| 13 | #define __LINUX_MTD_JEDEC_H__ |
|---|
| 14 | |
|---|
| 15 | #include <linux/types.h> |
|---|
| 16 | |
|---|
| 17 | #define MAX_JEDEC_CHIPS 16 |
|---|
| 18 | |
|---|
| 19 | // Listing of all supported chips and their information |
|---|
| 20 | struct JEDECTable |
|---|
| 21 | { |
|---|
| 22 | __u16 jedec; |
|---|
| 23 | char *name; |
|---|
| 24 | unsigned long size; |
|---|
| 25 | unsigned long sectorsize; |
|---|
| 26 | __u32 capabilities; |
|---|
| 27 | }; |
|---|
| 28 | |
|---|
| 29 | // JEDEC being 0 is the end of the chip array |
|---|
| 30 | struct jedec_flash_chip |
|---|
| 31 | { |
|---|
| 32 | __u16 jedec; |
|---|
| 33 | unsigned long size; |
|---|
| 34 | unsigned long sectorsize; |
|---|
| 35 | |
|---|
| 36 | // *(__u8*)(base + (adder << addrshift)) = data << datashift |
|---|
| 37 | // Address size = size << addrshift |
|---|
| 38 | unsigned long base; // Byte 0 of the flash, will be unaligned |
|---|
| 39 | unsigned int datashift; // Useful for 32bit/16bit accesses |
|---|
| 40 | unsigned int addrshift; |
|---|
| 41 | unsigned long offset; // linerized start. base==offset for unbanked, uninterleaved flash |
|---|
| 42 | |
|---|
| 43 | __u32 capabilities; |
|---|
| 44 | |
|---|
| 45 | // These markers are filled in by the flash_chip_scan function |
|---|
| 46 | unsigned long start; |
|---|
| 47 | unsigned long length; |
|---|
| 48 | }; |
|---|
| 49 | |
|---|
| 50 | struct jedec_private |
|---|
| 51 | { |
|---|
| 52 | unsigned long size; // Total size of all the devices |
|---|
| 53 | |
|---|
| 54 | /* Bank handling. If sum(bank_fill) == size then this is linear flash. |
|---|
| 55 | Otherwise the mapping has holes in it. bank_fill may be used to |
|---|
| 56 | find the holes, but in the common symetric case |
|---|
| 57 | bank_fill[0] == bank_fill[*], thus addresses may be computed |
|---|
| 58 | mathmatically. bank_fill must be powers of two */ |
|---|
| 59 | unsigned is_banked; |
|---|
| 60 | unsigned long bank_fill[MAX_JEDEC_CHIPS]; |
|---|
| 61 | |
|---|
| 62 | struct jedec_flash_chip chips[MAX_JEDEC_CHIPS]; |
|---|
| 63 | }; |
|---|
| 64 | |
|---|
| 65 | #endif |
|---|