]> git.ipfire.org Git - people/ms/u-boot.git/blame - board/bf533-ezkit/flash-defines.h
Consolidate bool type
[people/ms/u-boot.git] / board / bf533-ezkit / flash-defines.h
CommitLineData
6cb142fa
WD
1/*
2 * U-boot - flash-defines.h
3 *
155fd766 4 * Copyright (c) 2005-2007 Analog Devices Inc.
6cb142fa
WD
5 *
6 * (C) Copyright 2000-2004
7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
8 *
9 * See file CREDITS for list of people who contributed to this
10 * project.
11 *
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation; either version 2 of
15 * the License, or (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
155fd766
AL
24 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
25 * MA 02110-1301 USA
6cb142fa
WD
26 */
27
28#ifndef __FLASHDEFINES_H__
29#define __FLASHDEFINES_H__
30
31#include <common.h>
32
33#define V_ULONG(a) (*(volatile unsigned long *)( a ))
34#define V_BYTE(a) (*(volatile unsigned char *)( a ))
6cb142fa
WD
35#define BUFFER_SIZE 0x80000
36#define NO_COMMAND 0
37#define GET_CODES 1
38#define RESET 2
39#define WRITE 3
40#define FILL 4
41#define ERASE_ALL 5
42#define ERASE_SECT 6
43#define READ 7
44#define GET_SECTNUM 8
53677ef1
WD
45#define FLASH_START_L 0x0000
46#define FLASH_START_H 0x2000
6cb142fa 47#define FLASH_TOT_SECT 40
53677ef1
WD
48#define FLASH_SIZE 0x220000
49#define FLASH_MAN_ST 2
6d0f6bcf 50#define CONFIG_SYS_FLASH0_BASE 0x20000000
65ba1abd 51#define CONFIG_SYS_FLASH1_BASE 0x20200000
6cb142fa
WD
52#define RESET_VAL 0xF0
53
6d0f6bcf 54flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS];
6cb142fa
WD
55
56int get_codes(void);
57int poll_toggle_bit(long lOffset);
58void reset_flash(void);
59int erase_flash(void);
3f0606ad 60int erase_block_flash(int, unsigned long);
6cb142fa 61void unlock_flash(long lOffset);
dfeeab2c 62int write_data(long lStart, long lCount, uchar *pnData);
6cb142fa
WD
63int FillData(long lStart, long lCount, long lStride, int *pnData);
64int read_data(long lStart, long lCount, long lStride, int *pnData);
65int read_flash(long nOffset, int *pnValue);
66int write_flash(long nOffset, int nValue);
67void get_sector_number(long lOffset, int *pnSector);
68int GetSectorProtectionStatus(flash_info_t * info, int nSector);
69int GetOffset(int nBlock);
6cb142fa
WD
70
71#define WRITESEQ1 0x0AAA
72#define WRITESEQ2 0x0554
73#define WRITESEQ3 0x0AAA
74#define WRITESEQ4 0x0AAA
75#define WRITESEQ5 0x0554
76#define WRITESEQ6 0x0AAA
77#define WRITEDATA1 0xaa
78#define WRITEDATA2 0x55
79#define WRITEDATA3 0x80
80#define WRITEDATA4 0xaa
81#define WRITEDATA5 0x55
82#define WRITEDATA6 0x10
83#define PriFlashABegin 0
84#define SecFlashABegin 32
85#define SecFlashBBegin 36
86#define PriFlashAOff 0x0
87#define PriFlashBOff 0x100000
88#define SecFlashAOff 0x200000
89#define SecFlashBOff 0x280000
90#define INVALIDLOCNSTART 0x20270000
91#define INVALIDLOCNEND 0x20280000
92#define BlockEraseVal 0x30
93#define UNLOCKDATA1 0xaa
94#define UNLOCKDATA2 0x55
95#define UNLOCKDATA3 0xa0
96#define GETCODEDATA1 0xaa
97#define GETCODEDATA2 0x55
98#define GETCODEDATA3 0x90
99#define SecFlashASec1Off 0x200000
100#define SecFlashASec2Off 0x204000
101#define SecFlashASec3Off 0x206000
102#define SecFlashASec4Off 0x208000
103#define SecFlashAEndOff 0x210000
104#define SecFlashBSec1Off 0x280000
105#define SecFlashBSec2Off 0x284000
106#define SecFlashBSec3Off 0x286000
107#define SecFlashBSec4Off 0x288000
108#define SecFlashBEndOff 0x290000
109
110#define SECT32 32
111#define SECT33 33
112#define SECT34 34
113#define SECT35 35
114#define SECT36 36
115#define SECT37 37
116#define SECT38 38
117#define SECT39 39
118
119#define FLASH_SUCCESS 0
120#define FLASH_FAIL -1
121
122#endif