X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2Fflash.h;h=95992fa689bbc7c8cbb2fbe34e7cbdac958a77f4;hb=46b5c8ed017958fc387ab86c71ae6c90abb6793c;hp=30aa080b883eb0ec1febcb067965cea758491bfd;hpb=878cd63e02f63f245182a101807186b44e20f116;p=platform%2Fkernel%2Fu-boot.git diff --git a/include/flash.h b/include/flash.h index 30aa080..95992fa 100644 --- a/include/flash.h +++ b/include/flash.h @@ -1,14 +1,12 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * (C) Copyright 2000-2005 * Wolfgang Denk, DENX Software Engineering, wd@denx.de. - * - * SPDX-License-Identifier: GPL-2.0+ */ #ifndef _FLASH_H_ #define _FLASH_H_ -#ifndef CONFIG_SYS_NO_FLASH /*----------------------------------------------------------------------- * FLASH Info: contains chip specific data, per FLASH bank */ @@ -19,9 +17,10 @@ typedef struct { ulong flash_id; /* combined device & manufacturer code */ 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 */ + uchar chip_lsb; /* extra Least Significant Bit in the */ + /* address of chip */ ushort buffer_size; /* # of bytes in write buffer */ ulong erase_blk_tout; /* maximum block erase timeout */ ulong write_tout; /* maximum write timeout */ @@ -39,7 +38,14 @@ 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 */ +#ifdef CONFIG_DM_MTD + struct mtd_info *mtd; +#endif +#ifdef CONFIG_CFI_FLASH /* DM-specific parts */ + struct udevice *dev; + phys_addr_t base; #endif } flash_info_t; @@ -61,8 +67,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 */ @@ -76,21 +80,21 @@ 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); -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); +unsigned long flash_init(void); +void flash_print_info(flash_info_t *info); +int flash_erase(flash_info_t *info, int s_first, int s_last); +int flash_sect_erase(ulong addr_first, ulong addr_last); +int flash_sect_protect(int flag, ulong addr_first, ulong addr_last); +int flash_sect_roundb(ulong *addr); +unsigned long flash_sector_size(flash_info_t *info, flash_sect_t sect); +void flash_cmd_reset(flash_info_t *info); +void flash_set_verbose(uint v); /* common/flash.c */ -extern void flash_protect (int flag, ulong from, ulong to, flash_info_t *info); -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); +void flash_protect(int flag, ulong from, ulong to, flash_info_t *info); +int flash_write(char *src, ulong addr, ulong cnt); +flash_info_t *addr2info(ulong addr); +int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt); /* drivers/mtd/cfi_mtd.c */ #ifdef CONFIG_FLASH_CFI_MTD @@ -110,15 +114,18 @@ 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 +/** + * flash_perror() - Print a flash error + * + * @err: Error number of message to print (ERR_... as below) + */ +void flash_perror(int err); /*----------------------------------------------------------------------- * 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 @@ -394,6 +401,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 ) */ @@ -459,6 +469,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 */ @@ -477,7 +489,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 */ @@ -497,6 +509,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_ */