Home | History | Annotate | Download | only in mtd
      1 /****************************************************************************
      2  ****************************************************************************
      3  ***
      4  ***   This header was automatically generated from a Linux kernel header
      5  ***   of the same name, to make information necessary for userspace to
      6  ***   call into the kernel available to libc.  It contains only constants,
      7  ***   structures, and macros generated from the original header, and thus,
      8  ***   contains no copyrightable information.
      9  ***
     10  ****************************************************************************
     11  ****************************************************************************/
     12 #ifndef __MTD_CFI_H__
     13 #define __MTD_CFI_H__
     14 
     15 #include <linux/delay.h>
     16 #include <linux/types.h>
     17 #include <linux/interrupt.h>
     18 #include <linux/mtd/flashchip.h>
     19 #include <linux/mtd/map.h>
     20 #include <linux/mtd/cfi_endian.h>
     21 
     22 #define cfi_interleave_is_1(cfi) (0)
     23 
     24 #define cfi_interleave_is_2(cfi) (0)
     25 
     26 #define cfi_interleave_is_4(cfi) (0)
     27 
     28 #define cfi_interleave_is_8(cfi) (0)
     29 
     30 #define CFI_DEVICETYPE_X8 (8 / 8)
     31 #define CFI_DEVICETYPE_X16 (16 / 8)
     32 #define CFI_DEVICETYPE_X32 (32 / 8)
     33 #define CFI_DEVICETYPE_X64 (64 / 8)
     34 
     35 struct cfi_extquery {
     36  uint8_t pri[3];
     37  uint8_t MajorVersion;
     38  uint8_t MinorVersion;
     39 } __attribute__((packed));
     40 
     41 struct cfi_pri_intelext {
     42  uint8_t pri[3];
     43  uint8_t MajorVersion;
     44  uint8_t MinorVersion;
     45  uint32_t FeatureSupport;
     46  uint8_t SuspendCmdSupport;
     47  uint16_t BlkStatusRegMask;
     48  uint8_t VccOptimal;
     49  uint8_t VppOptimal;
     50  uint8_t NumProtectionFields;
     51  uint16_t ProtRegAddr;
     52  uint8_t FactProtRegSize;
     53  uint8_t UserProtRegSize;
     54  uint8_t extra[0];
     55 } __attribute__((packed));
     56 
     57 struct cfi_intelext_otpinfo {
     58  uint32_t ProtRegAddr;
     59  uint16_t FactGroups;
     60  uint8_t FactProtRegSize;
     61  uint16_t UserGroups;
     62  uint8_t UserProtRegSize;
     63 } __attribute__((packed));
     64 
     65 struct cfi_intelext_blockinfo {
     66  uint16_t NumIdentBlocks;
     67  uint16_t BlockSize;
     68  uint16_t MinBlockEraseCycles;
     69  uint8_t BitsPerCell;
     70  uint8_t BlockCap;
     71 } __attribute__((packed));
     72 
     73 struct cfi_intelext_regioninfo {
     74  uint16_t NumIdentPartitions;
     75  uint8_t NumOpAllowed;
     76  uint8_t NumOpAllowedSimProgMode;
     77  uint8_t NumOpAllowedSimEraMode;
     78  uint8_t NumBlockTypes;
     79  struct cfi_intelext_blockinfo BlockTypes[1];
     80 } __attribute__((packed));
     81 
     82 struct cfi_intelext_programming_regioninfo {
     83  uint8_t ProgRegShift;
     84  uint8_t Reserved1;
     85  uint8_t ControlValid;
     86  uint8_t Reserved2;
     87  uint8_t ControlInvalid;
     88  uint8_t Reserved3;
     89 } __attribute__((packed));
     90 
     91 struct cfi_pri_amdstd {
     92  uint8_t pri[3];
     93  uint8_t MajorVersion;
     94  uint8_t MinorVersion;
     95  uint8_t SiliconRevision;
     96  uint8_t EraseSuspend;
     97  uint8_t BlkProt;
     98  uint8_t TmpBlkUnprotect;
     99  uint8_t BlkProtUnprot;
    100  uint8_t SimultaneousOps;
    101  uint8_t BurstMode;
    102  uint8_t PageMode;
    103  uint8_t VppMin;
    104  uint8_t VppMax;
    105  uint8_t TopBottom;
    106 } __attribute__((packed));
    107 
    108 struct cfi_pri_atmel {
    109  uint8_t pri[3];
    110  uint8_t MajorVersion;
    111  uint8_t MinorVersion;
    112  uint8_t Features;
    113  uint8_t BottomBoot;
    114  uint8_t BurstMode;
    115  uint8_t PageMode;
    116 } __attribute__((packed));
    117 
    118 struct cfi_pri_query {
    119  uint8_t NumFields;
    120  uint32_t ProtField[1];
    121 } __attribute__((packed));
    122 
    123 struct cfi_bri_query {
    124  uint8_t PageModeReadCap;
    125  uint8_t NumFields;
    126  uint32_t ConfField[1];
    127 } __attribute__((packed));
    128 
    129 #define P_ID_NONE 0x0000
    130 #define P_ID_INTEL_EXT 0x0001
    131 #define P_ID_AMD_STD 0x0002
    132 #define P_ID_INTEL_STD 0x0003
    133 #define P_ID_AMD_EXT 0x0004
    134 #define P_ID_WINBOND 0x0006
    135 #define P_ID_ST_ADV 0x0020
    136 #define P_ID_MITSUBISHI_STD 0x0100
    137 #define P_ID_MITSUBISHI_EXT 0x0101
    138 #define P_ID_SST_PAGE 0x0102
    139 #define P_ID_INTEL_PERFORMANCE 0x0200
    140 #define P_ID_INTEL_DATA 0x0210
    141 #define P_ID_RESERVED 0xffff
    142 
    143 #define CFI_MODE_CFI 1
    144 #define CFI_MODE_JEDEC 0
    145 
    146 struct cfi_private {
    147  uint16_t cmdset;
    148  void *cmdset_priv;
    149  int interleave;
    150  int device_type;
    151  int cfi_mode;
    152  int addr_unlock1;
    153  int addr_unlock2;
    154  struct mtd_info *(*cmdset_setup)(struct map_info *);
    155  struct cfi_ident *cfiq;
    156  int mfr, id;
    157  int numchips;
    158  unsigned long chipshift;
    159  const char *im_name;
    160  struct flchip chips[0];
    161 };
    162 
    163 #if BITS_PER_LONG >= 64
    164 #endif
    165 #define CMD(x) cfi_build_cmd((x), map, cfi)
    166 #if BITS_PER_LONG >= 64
    167 #endif
    168 #define MERGESTATUS(x) cfi_merge_status((x), map, cfi)
    169 
    170 struct cfi_fixup {
    171  uint16_t mfr;
    172  uint16_t id;
    173  void (*fixup)(struct mtd_info *mtd, void* param);
    174  void* param;
    175 };
    176 
    177 #define CFI_MFR_ANY 0xffff
    178 #define CFI_ID_ANY 0xffff
    179 
    180 #define CFI_MFR_AMD 0x0001
    181 #define CFI_MFR_ATMEL 0x001F
    182 #define CFI_MFR_ST 0x0020
    183 
    184 typedef int (*varsize_frob_t)(struct map_info *map, struct flchip *chip,
    185  unsigned long adr, int len, void *thunk);
    186 
    187 #endif
    188