]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - include/flash.h
sandbox: Add a simple sound driver
[karo-tx-uboot.git] / include / flash.h
index a6e91b5e69fb1a8fc8711ea1afdcab7a9d86f529..5454c9ea218e29d27e1a883657bfdf59ba38be22 100644 (file)
@@ -2,23 +2,7 @@
  * (C) Copyright 2000-2005
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
  *
- * See file CREDITS for list of people who contributed to this
- * project.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License as
- * published by the Free Software Foundation; either version 2 of
- * the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- * MA 02111-1307 USA
+ * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #ifndef _FLASH_H_
@@ -33,7 +17,7 @@ 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[CONFIG_SYS_MAX_FLASH_SECT];   /* physical sector start addresses */
+       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                */
@@ -44,9 +28,10 @@ typedef struct {
        ulong   buffer_write_tout;      /* maximum buffer write timeout         */
        ushort  vendor;                 /* the primary vendor id                */
        ushort  cmd_reset;              /* vendor specific reset command        */
+       uchar   cmd_erase_sector;       /* vendor specific erase sect. command  */
        ushort  interface;              /* used for x8/x16 adjustments          */
        ushort  legacy_unlock;          /* support Intel legacy (un)locking     */
-       uchar   manufacturer_id;        /* manufacturer id                      */
+       ushort  manufacturer_id;        /* manufacturer id                      */
        ushort  device_id;              /* device id                            */
        ushort  device_id2;             /* extended device id                   */
        ushort  ext_addr;               /* extended query table address         */
@@ -58,6 +43,10 @@ typedef struct {
 #endif
 } flash_info_t;
 
+extern flash_info_t flash_info[]; /* info for FLASH chips      */
+
+typedef unsigned long flash_sect_t;
+
 /*
  * Values for the width of the port
  */
@@ -84,14 +73,18 @@ typedef struct {
 
 /* convert between bit value and numeric value */
 #define CFI_FLASH_SHIFT_WIDTH  3
+
 /* Prototypes */
 
 extern unsigned long flash_init (void);
+extern void flash_protect_default(void);
 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);
@@ -99,6 +92,11 @@ 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(CONFIG_SYS_FLASH_PROTECTION)
 extern int flash_real_protect(flash_info_t *info, long sector, int prot);
@@ -112,6 +110,9 @@ 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():
@@ -125,6 +126,7 @@ extern int jedec_flash_match(flash_info_t *info, ulong base);
 #define ERR_UNKNOWN_FLASH_VENDOR       32
 #define ERR_UNKNOWN_FLASH_TYPE         64
 #define ERR_PROG_ERROR                 128
+#define ERR_ABORTED                    256
 
 /*-----------------------------------------------------------------------
  * Protection Flags for flash_protect():
@@ -141,6 +143,7 @@ extern int jedec_flash_match(flash_info_t *info, ulong base);
  * 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 */
@@ -153,6 +156,13 @@ extern int jedec_flash_match(flash_info_t *info, ulong base);
 #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)  */
@@ -323,7 +333,7 @@ extern int jedec_flash_match(flash_info_t *info, ulong base);
 
 #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                  */
+#define NUMONYX_256MBIT        0x8922          /* Numonyx P33/30 256MBit 65nm  */
 
 /*-----------------------------------------------------------------------
  * Internal FLASH identification codes