]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - include/flash.h
Fixup native builds on powerpc
[karo-tx-uboot.git] / include / flash.h
index d91589a6c02c283c5f4714fbccbee85f12a478d3..8feca1b5fad5a700c9eb73a63e1f6f921a541332 100644 (file)
@@ -24,7 +24,7 @@
 #ifndef _FLASH_H_
 #define _FLASH_H_
 
-#ifndef CFG_NO_FLASH
+#ifndef CONFIG_SYS_NO_FLASH
 /*-----------------------------------------------------------------------
  * FLASH Info: contains chip specific data, per FLASH bank
  */
@@ -33,9 +33,9 @@ typedef struct {
        ulong   size;                   /* total bank size in bytes             */
        ushort  sector_count;           /* number of erase units                */
        ulong   flash_id;               /* combined device & manufacturer code  */
-       ulong   start[CFG_MAX_FLASH_SECT];   /* physical sector start addresses */
-       uchar   protect[CFG_MAX_FLASH_SECT]; /* sector protection status        */
-#ifdef CFG_FLASH_CFI
+       ulong   start[CONFIG_SYS_MAX_FLASH_SECT];   /* virtual sector start address */
+       uchar   protect[CONFIG_SYS_MAX_FLASH_SECT]; /* sector protection status */
+#ifdef CONFIG_SYS_FLASH_CFI
        uchar   portwidth;              /* the width of the port                */
        uchar   chipwidth;              /* the width of the chip                */
        ushort  buffer_size;            /* # of bytes in write buffer           */
@@ -43,12 +43,23 @@ typedef struct {
        ulong   write_tout;             /* maximum write timeout                */
        ulong   buffer_write_tout;      /* maximum buffer write timeout         */
        ushort  vendor;                 /* the primary vendor id                */
-       ushort  cmd_reset;              /* Vendor specific reset command        */
+       ushort  cmd_reset;              /* vendor specific reset command        */
        ushort  interface;              /* used for x8/x16 adjustments          */
        ushort  legacy_unlock;          /* support Intel legacy (un)locking     */
+       ushort  manufacturer_id;        /* manufacturer id                      */
+       ushort  device_id;              /* device id                            */
+       ushort  device_id2;             /* extended device id                   */
+       ushort  ext_addr;               /* extended query table address         */
+       ushort  cfi_version;            /* cfi version                          */
+       ushort  cfi_offset;             /* offset for cfi query                 */
+       ulong   addr_unlock1;           /* unlock address 1 for AMD flash roms  */
+       ulong   addr_unlock2;           /* unlock address 2 for AMD flash roms  */
+       const char *name;               /* human-readable name                  */
 #endif
 } flash_info_t;
 
+typedef unsigned long flash_sect_t;
+
 /*
  * Values for the width of the port
  */
@@ -71,9 +82,11 @@ typedef struct {
 #define FLASH_CFI_X8           0x00
 #define FLASH_CFI_X16          0x01
 #define FLASH_CFI_X8X16                0x02
+#define FLASH_CFI_X16X32       0x05
 
 /* convert between bit value and numeric value */
 #define CFI_FLASH_SHIFT_WIDTH  3
+
 /* Prototypes */
 
 extern unsigned long flash_init (void);
@@ -81,6 +94,9 @@ extern void flash_print_info (flash_info_t *);
 extern int flash_erase (flash_info_t *, int, int);
 extern int flash_sect_erase (ulong addr_first, ulong addr_last);
 extern int flash_sect_protect (int flag, ulong addr_first, ulong addr_last);
+extern int flash_sect_roundb (ulong *addr);
+extern unsigned long flash_sector_size(flash_info_t *info, flash_sect_t sect);
+extern void flash_set_verbose(uint);
 
 /* common/flash.c */
 extern void flash_protect (int flag, ulong from, ulong to, flash_info_t *info);
@@ -88,12 +104,27 @@ extern int flash_write (char *, ulong, ulong);
 extern flash_info_t *addr2info (ulong);
 extern int write_buff (flash_info_t *info, uchar *src, ulong addr, ulong cnt);
 
+/* drivers/mtd/cfi_mtd.c */
+#ifdef CONFIG_FLASH_CFI_MTD
+extern int cfi_mtd_init(void);
+#endif
+
 /* board/?/flash.c */
-#if defined(CFG_FLASH_PROTECTION)
+#if defined(CONFIG_SYS_FLASH_PROTECTION)
 extern int flash_real_protect(flash_info_t *info, long sector, int prot);
 extern void flash_read_user_serial(flash_info_t * info, void * buffer, int offset, int len);
 extern void flash_read_factory_serial(flash_info_t * info, void * buffer, int offset, int len);
-#endif /* CFG_FLASH_PROTECTION */
+#endif /* CONFIG_SYS_FLASH_PROTECTION */
+
+#ifdef CONFIG_FLASH_CFI_LEGACY
+extern ulong board_flash_get_legacy(ulong base, int banknum, flash_info_t *info);
+extern int jedec_flash_match(flash_info_t *info, ulong base);
+#define CFI_CMDSET_AMD_LEGACY          0xFFF0
+#endif
+
+#if defined(CONFIG_SYS_FLASH_CFI)
+extern flash_info_t *flash_get_info(ulong base);
+#endif
 
 /*-----------------------------------------------------------------------
  * return codes from flash_write():
@@ -113,11 +144,17 @@ extern void flash_read_factory_serial(flash_info_t * info, void * buffer, int of
  */
 #define FLAG_PROTECT_SET       0x01
 #define FLAG_PROTECT_CLEAR     0x02
+#define        FLAG_PROTECT_INVALID    0x03
+/*-----------------------------------------------------------------------
+ * Set Environment according to label:
+ */
+#define        FLAG_SETENV             0x80
 
 /*-----------------------------------------------------------------------
  * Device IDs
  */
 
+/* Manufacturers inside bank 0 have ids like 0x00xx00xx */
 #define AMD_MANUFACT   0x00010001      /* AMD     manuf. ID in D23..D16, D7..D0 */
 #define FUJ_MANUFACT   0x00040004      /* FUJITSU manuf. ID in D23..D16, D7..D0 */
 #define ATM_MANUFACT   0x001F001F      /* ATMEL */
@@ -130,6 +167,13 @@ extern void flash_read_factory_serial(flash_info_t * info, void * buffer, int of
 #define TOSH_MANUFACT  0x00980098      /* TOSHIBA manuf. ID in D23..D16, D7..D0 */
 #define MT2_MANUFACT   0x002C002C      /* alternate MICRON manufacturer ID*/
 #define EXCEL_MANUFACT 0x004A004A      /* Excel Semiconductor                  */
+#define AMIC_MANUFACT  0x00370037      /* AMIC    manuf. ID in D23..D16, D7..D0 */
+#define WINB_MANUFACT  0x00DA00DA      /* Winbond manuf. ID in D23..D16, D7..D0 */
+
+/* Manufacturers inside bank 1 have ids like 0x01xx01xx */
+#define EON_MANUFACT   0x011C011C      /* EON     manuf. ID in D23..D16, D7..D0 */
+
+/* Manufacturers inside bank 2 have ids like 0x02xx02xx */
 
                                        /* Micron Technologies (INTEL compat.)  */
 #define MT_ID_28F400_T 0x44704470      /* 28F400B3 ID ( 4 M, top boot sector)  */
@@ -246,6 +290,8 @@ extern void flash_read_factory_serial(flash_info_t * info, void * buffer, int of
 #define STM_ID_x800AB  0x005B005B      /* M29W800AB ID (8M = 512K x 16 )       */
 #define STM_ID_29W320DT 0x22CA22CA     /* M29W320DT ID (32 M, top boot sector) */
 #define STM_ID_29W320DB 0x22CB22CB     /* M29W320DB ID (32 M, bottom boot sect)        */
+#define STM_ID_29W320ET 0x22562256     /* M29W320ET ID (32 M, top boot sector) */
+#define STM_ID_29W320EB 0x22572257     /* M29W320EB ID (32 M, bottom boot sect)*/
 #define STM_ID_29W040B 0x00E300E3      /* M29W040B ID (4M = 512K x 8)  */
 #define FLASH_PSD4256GV 0x00E9         /* PSD4256 Flash and CPLD combination   */
 
@@ -298,6 +344,7 @@ extern void flash_read_factory_serial(flash_info_t * info, void * buffer, int of
 
 #define TOSH_ID_FVT160 0xC2            /* TC58FVT160 ID (16 M, top )           */
 #define TOSH_ID_FVB160 0x43            /* TC58FVT160 ID (16 M, bottom )        */
+#define PHILIPS_LPC2292 0x0401FF13  /* LPC2292 internal FLASH                  */
 
 /*-----------------------------------------------------------------------
  * Internal FLASH identification codes
@@ -439,6 +486,7 @@ extern void flash_read_factory_serial(flash_info_t * info, void * buffer, int of
 #define FLASH_MAN_MT   0x00400000
 #define FLASH_MAN_SHARP 0x00500000
 #define FLASH_MAN_ATM  0x00600000
+#define FLASH_MAN_CFI  0x01000000
 
 
 #define FLASH_TYPEMASK 0x0000FFFF      /* extract FLASH type   information     */
@@ -459,6 +507,6 @@ extern void flash_read_factory_serial(flash_info_t * info, void * buffer, int of
 #define FLASH_ERASE_TIMEOUT    120000  /* timeout for erasing in ms            */
 #define FLASH_WRITE_TIMEOUT    500     /* timeout for writes  in ms            */
 
-#endif /* !CFG_NO_FLASH */
+#endif /* !CONFIG_SYS_NO_FLASH */
 
 #endif /* _FLASH_H_ */