]> git.ipfire.org Git - people/ms/u-boot.git/blob - board/ssv/adnpesc1/flash.c
rename CFG_ macros to CONFIG_SYS
[people/ms/u-boot.git] / board / ssv / adnpesc1 / flash.c
1 /*
2 * (C) Copyright 2000-2004
3 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
4 *
5 * (C) Copyright 2004, Li-Pro.Net <www.li-pro.net>
6 * Stephan Linz <linz@li-pro.net>
7 *
8 * See file CREDITS for list of people who contributed to this
9 * project.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License as
13 * published by the Free Software Foundation; either version 2 of
14 * the License, or (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
24 * MA 02111-1307 USA
25 */
26
27
28 #include <common.h>
29 #include <nios.h>
30
31 /*
32 * include common flash code (for ssv boards)
33 */
34 #include "../common/flash.c"
35
36 /*---------------------------------------------------------------------*/
37 #define BANKSZ (8 * 1024 * 1024)
38 #define SECTSZ (64 * 1024)
39 #define UBOOTSECS ((CONFIG_SYS_MONITOR_LEN + CONFIG_ENV_SIZE) / SECTSZ)
40 #define UBOOTAREA (UBOOTSECS * 64 * 1024) /* monitor / env area */
41
42 /*---------------------------------------------------------------------*/
43 unsigned long flash_init (void)
44 {
45 int i;
46 unsigned long addr;
47 flash_info_t *fli = &flash_info[0];
48
49 fli->size = BANKSZ;
50 fli->sector_count = CONFIG_SYS_MAX_FLASH_SECT;
51 fli->flash_id = FLASH_MAN_AMD + FLASH_AMLV640U;
52
53 addr = CONFIG_SYS_FLASH_BASE;
54 for (i = 0; i < fli->sector_count; ++i) {
55 fli->start[i] = addr;
56 addr += SECTSZ;
57
58 /* Protect monitor / environment area */
59 if (addr <= (CONFIG_SYS_FLASH_BASE + UBOOTAREA))
60 fli->protect[i] = 1;
61 else
62 fli->protect[i] = 0;
63 }
64
65 return (BANKSZ);
66 }