]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - include/flash.h
Convert CONFIG_SYS_BOOTCOUNT_SINGLEWORD to Kconfig
[people/ms/u-boot.git] / include / flash.h
index e614d07dfa90187ca32835ff751755e5eb23db29..1a4e87900996d4f0a8ce3cd62a6798106bdcbff5 100644 (file)
@@ -2,29 +2,16 @@
  * (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_
 #define _FLASH_H_
 
-#ifndef CONFIG_SYS_NO_FLASH
+#ifndef CONFIG_SYS_MAX_FLASH_SECT
+#define CONFIG_SYS_MAX_FLASH_SECT      512
+#endif
+
 /*-----------------------------------------------------------------------
  * FLASH Info: contains chip specific data, per FLASH bank
  */
@@ -44,6 +31,7 @@ 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     */
        ushort  manufacturer_id;        /* manufacturer id                      */
@@ -54,8 +42,16 @@ typedef struct {
        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  */
+       uchar   sr_supported;           /* status register supported            */
        const char *name;               /* human-readable name                  */
 #endif
+#ifdef CONFIG_MTD
+       struct mtd_info *mtd;
+#endif
+#ifdef CONFIG_CFI_FLASH                        /* DM-specific parts */
+       struct udevice *dev;
+       phys_addr_t base;
+#endif
 } flash_info_t;
 
 extern flash_info_t flash_info[]; /* info for FLASH chips      */
@@ -76,8 +72,6 @@ typedef unsigned long flash_sect_t;
 #define FLASH_CFI_BY16         0x02
 #define FLASH_CFI_BY32         0x04
 #define FLASH_CFI_BY64         0x08
-/* convert between bit value and numeric value */
-#define CFI_FLASH_SHIFT_WIDTH  3
 /*
  * Values for the flash device interface
  */
@@ -92,7 +86,6 @@ typedef unsigned long flash_sect_t;
 /* 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);
@@ -125,15 +118,11 @@ 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():
  */
 #define ERR_OK                         0
-#define ERR_TIMOUT                     1
+#define ERR_TIMEOUT                    1
 #define ERR_NOT_ERASED                 2
 #define ERR_PROTECTED                  4
 #define ERR_INVAL                      8
@@ -141,6 +130,7 @@ extern flash_info_t *flash_get_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():
@@ -172,6 +162,7 @@ extern flash_info_t *flash_get_info(ulong base);
 #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 */
+#define EON_ALT_MANU   0x001C001C      /* EON     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 */
@@ -347,7 +338,6 @@ extern flash_info_t *flash_get_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  */
 
 /*-----------------------------------------------------------------------
@@ -408,6 +398,9 @@ extern flash_info_t *flash_get_info(ulong base);
 #define FLASH_STM800DT 0x00D7          /* STM M29W800DT (1M = 64K x 16, top)   */
 #define FLASH_STM800DB 0x005B          /* STM M29W800DB (1M = 64K x 16, bottom)*/
 
+#define FLASH_MCHP100T 0x0060          /* MCHP internal (1M = 64K x 16) */
+#define FLASH_MCHP100B 0x0061          /* MCHP internal (1M = 64K x 16) */
+
 #define FLASH_28F400_T 0x0062          /* MT  28F400B3 ID (  4M = 256K x 16 )  */
 #define FLASH_28F400_B 0x0063          /* MT  28F400B3 ID (  4M = 256K x 16 )  */
 
@@ -473,6 +466,8 @@ extern flash_info_t *flash_get_info(ulong base);
 #define FLASH_S29GL064M 0x00F0         /* Spansion S29GL064M-R6                */
 #define FLASH_S29GL128N 0x00F1         /* Spansion S29GL128N                   */
 
+#define FLASH_STM32    0x00F2          /* STM32 Embedded Flash */
+
 #define FLASH_UNKNOWN  0xFFFF          /* unknown flash type                   */
 
 
@@ -491,7 +486,7 @@ extern flash_info_t *flash_get_info(ulong base);
 #define FLASH_MAN_SHARP 0x00500000
 #define FLASH_MAN_ATM  0x00600000
 #define FLASH_MAN_CFI  0x01000000
-
+#define FLASH_MAN_MCHP 0x02000000      /* Microchip Technology         */
 
 #define FLASH_TYPEMASK 0x0000FFFF      /* extract FLASH type   information     */
 #define FLASH_VENDMASK 0xFFFF0000      /* extract FLASH vendor information     */
@@ -511,6 +506,4 @@ extern flash_info_t *flash_get_info(ulong base);
 #define FLASH_ERASE_TIMEOUT    120000  /* timeout for erasing in ms            */
 #define FLASH_WRITE_TIMEOUT    500     /* timeout for writes  in ms            */
 
-#endif /* !CONFIG_SYS_NO_FLASH */
-
 #endif /* _FLASH_H_ */