2 * (C) Copyright 2000-2005
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 /*-----------------------------------------------------------------------
29 * FLASH Info: contains chip specific data, per FLASH bank
33 ulong size; /* total bank size in bytes */
34 ulong sector_size; /* size of erase unit in bytes */
35 ushort sector_count; /* number of erase units */
36 ulong flash_id; /* combined device & manufacturer code */
37 ulong start[CFG_MAX_FLASH_SECT]; /* physical sector start addresses */
38 uchar protect[CFG_MAX_FLASH_SECT]; /* sector protection status */
43 extern unsigned long flash_init (void);
44 extern int flash_erase(flash_info_t *, int, int);
45 extern int flash_sect_erase(ulong addr_first, ulong addr_last);
46 extern int flash_sect_protect(int flag, ulong addr_first, ulong addr_last);
49 extern int flash_write(char *, ulong, ulong);
50 extern flash_info_t *addr2info(ulong);
51 extern int write_buff(flash_info_t *info, uchar *src, ulong addr, ulong cnt);
53 /*-----------------------------------------------------------------------
54 * return codes from flash_write():
58 #define ERR_NOT_ERASED 2
59 #define ERR_PROTECTED 4
62 #define ERR_UNKNOWN_FLASH_VENDOR 32
63 #define ERR_UNKNOWN_FLASH_TYPE 64
64 #define ERR_PROG_ERROR 128
66 /*-----------------------------------------------------------------------
69 #define FLASH_CUSTOM 0x1111
70 #define FLASH_UNKNOWN 0xFFFF /* unknown flash type */
72 #endif /* !CFG_NO_FLASH */
74 #endif /* _FLASH_H_ */