File: jedec.h

package info (click to toggle)
kernel-source-2.4.14 2.4.14-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 139,160 kB
  • ctags: 428,423
  • sloc: ansic: 2,435,554; asm: 141,119; makefile: 8,258; sh: 3,099; perl: 2,561; yacc: 1,177; cpp: 755; tcl: 577; lex: 352; awk: 251; lisp: 218; sed: 72
file content (69 lines) | stat: -rw-r--r-- 2,018 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69

/* JEDEC Flash Interface.
 * This is an older type of interface for self programming flash. It is 
 * commonly use in older AMD chips and is obsolete compared with CFI.
 * It is called JEDEC because the JEDEC association distributes the ID codes
 * for the chips.
 *
 * See the AMD flash databook for information on how to operate the interface.
 *
 * $Id: jedec.h,v 1.1 2000/07/04 07:21:51 jgg Exp $
 */

#ifndef __LINUX_MTD_JEDEC_H__
#define __LINUX_MTD_JEDEC_H__

#include <linux/types.h>
#include <linux/mtd/map.h>

#define MAX_JEDEC_CHIPS 16

// Listing of all supported chips and their information
struct JEDECTable
{
   __u16 jedec;
   char *name;
   unsigned long size;
   unsigned long sectorsize;
   __u32 capabilities;
};

// JEDEC being 0 is the end of the chip array
struct jedec_flash_chip
{
   __u16 jedec;
   unsigned long size;
   unsigned long sectorsize;
   
   // *(__u8*)(base + (adder << addrshift)) = data << datashift
   // Address size = size << addrshift
   unsigned long base;           // Byte 0 of the flash, will be unaligned
   unsigned int datashift;       // Useful for 32bit/16bit accesses
   unsigned int addrshift;
   unsigned long offset;         // linerized start. base==offset for unbanked, uninterleaved flash
   
   __u32 capabilities;
   
   // These markers are filled in by the flash_chip_scan function
   unsigned long start;
   unsigned long length;
};

struct jedec_private
{
   unsigned long size;         // Total size of all the devices
   
   /* Bank handling. If sum(bank_fill) == size then this is linear flash.
      Otherwise the mapping has holes in it. bank_fill may be used to
      find the holes, but in the common symetric case 
      bank_fill[0] == bank_fill[*], thus addresses may be computed 
      mathmatically. bank_fill must be powers of two */
   unsigned is_banked;
   unsigned long bank_fill[MAX_JEDEC_CHIPS];
   
   struct jedec_flash_chip chips[MAX_JEDEC_CHIPS];  
};

extern const struct JEDECTable *jedec_idtoinf(__u8 mfr,__u8 id);

#endif