]> git.ipfire.org Git - people/ms/u-boot.git/blame - board/bf533-ezkit/flash-defines.h
Add GPL-2.0+ SPDX-License-Identifier to source files
[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 *
1a459660 9 * SPDX-License-Identifier: GPL-2.0+
6cb142fa
WD
10 */
11
12#ifndef __FLASHDEFINES_H__
13#define __FLASHDEFINES_H__
14
15#include <common.h>
16
17#define V_ULONG(a) (*(volatile unsigned long *)( a ))
18#define V_BYTE(a) (*(volatile unsigned char *)( a ))
6cb142fa
WD
19#define BUFFER_SIZE 0x80000
20#define NO_COMMAND 0
21#define GET_CODES 1
22#define RESET 2
23#define WRITE 3
24#define FILL 4
25#define ERASE_ALL 5
26#define ERASE_SECT 6
27#define READ 7
28#define GET_SECTNUM 8
53677ef1
WD
29#define FLASH_START_L 0x0000
30#define FLASH_START_H 0x2000
6cb142fa 31#define FLASH_TOT_SECT 40
53677ef1
WD
32#define FLASH_SIZE 0x220000
33#define FLASH_MAN_ST 2
6d0f6bcf 34#define CONFIG_SYS_FLASH0_BASE 0x20000000
65ba1abd 35#define CONFIG_SYS_FLASH1_BASE 0x20200000
6cb142fa
WD
36#define RESET_VAL 0xF0
37
6d0f6bcf 38flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS];
6cb142fa
WD
39
40int get_codes(void);
41int poll_toggle_bit(long lOffset);
42void reset_flash(void);
43int erase_flash(void);
3f0606ad 44int erase_block_flash(int, unsigned long);
6cb142fa 45void unlock_flash(long lOffset);
dfeeab2c 46int write_data(long lStart, long lCount, uchar *pnData);
6cb142fa
WD
47int FillData(long lStart, long lCount, long lStride, int *pnData);
48int read_data(long lStart, long lCount, long lStride, int *pnData);
49int read_flash(long nOffset, int *pnValue);
50int write_flash(long nOffset, int nValue);
51void get_sector_number(long lOffset, int *pnSector);
52int GetSectorProtectionStatus(flash_info_t * info, int nSector);
53int GetOffset(int nBlock);
6cb142fa
WD
54
55#define WRITESEQ1 0x0AAA
56#define WRITESEQ2 0x0554
57#define WRITESEQ3 0x0AAA
58#define WRITESEQ4 0x0AAA
59#define WRITESEQ5 0x0554
60#define WRITESEQ6 0x0AAA
61#define WRITEDATA1 0xaa
62#define WRITEDATA2 0x55
63#define WRITEDATA3 0x80
64#define WRITEDATA4 0xaa
65#define WRITEDATA5 0x55
66#define WRITEDATA6 0x10
67#define PriFlashABegin 0
68#define SecFlashABegin 32
69#define SecFlashBBegin 36
70#define PriFlashAOff 0x0
71#define PriFlashBOff 0x100000
72#define SecFlashAOff 0x200000
73#define SecFlashBOff 0x280000
74#define INVALIDLOCNSTART 0x20270000
75#define INVALIDLOCNEND 0x20280000
76#define BlockEraseVal 0x30
77#define UNLOCKDATA1 0xaa
78#define UNLOCKDATA2 0x55
79#define UNLOCKDATA3 0xa0
80#define GETCODEDATA1 0xaa
81#define GETCODEDATA2 0x55
82#define GETCODEDATA3 0x90
83#define SecFlashASec1Off 0x200000
84#define SecFlashASec2Off 0x204000
85#define SecFlashASec3Off 0x206000
86#define SecFlashASec4Off 0x208000
87#define SecFlashAEndOff 0x210000
88#define SecFlashBSec1Off 0x280000
89#define SecFlashBSec2Off 0x284000
90#define SecFlashBSec3Off 0x286000
91#define SecFlashBSec4Off 0x288000
92#define SecFlashBEndOff 0x290000
93
94#define SECT32 32
95#define SECT33 33
96#define SECT34 34
97#define SECT35 35
98#define SECT36 36
99#define SECT37 37
100#define SECT38 38
101#define SECT39 39
102
103#define FLASH_SUCCESS 0
104#define FLASH_FAIL -1
105
106#endif