2 * U-Boot - flash-defines.h
4 * Copyright (c) 2005-2007 Analog Devices Inc.
6 * (C) Copyright 2000-2004
7 * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
9 * SPDX-License-Identifier: GPL-2.0+
12 #ifndef __FLASHDEFINES_H__
13 #define __FLASHDEFINES_H__
17 #define V_ULONG(a) (*(volatile unsigned long *)( a ))
18 #define V_BYTE(a) (*(volatile unsigned char *)( a ))
19 #define BUFFER_SIZE 0x80000
29 #define FLASH_START_L 0x0000
30 #define FLASH_START_H 0x2000
31 #define FLASH_TOT_SECT 40
32 #define FLASH_SIZE 0x220000
33 #define FLASH_MAN_ST 2
34 #define CONFIG_SYS_FLASH0_BASE 0x20000000
35 #define CONFIG_SYS_FLASH1_BASE 0x20200000
36 #define RESET_VAL 0xF0
38 flash_info_t flash_info[CONFIG_SYS_MAX_FLASH_BANKS];
41 int poll_toggle_bit(long lOffset);
42 void reset_flash(void);
43 int erase_flash(void);
44 int erase_block_flash(int, unsigned long);
45 void unlock_flash(long lOffset);
46 int write_data(long lStart, long lCount, uchar *pnData);
47 int FillData(long lStart, long lCount, long lStride, int *pnData);
48 int read_data(long lStart, long lCount, long lStride, int *pnData);
49 int read_flash(long nOffset, int *pnValue);
50 int write_flash(long nOffset, int nValue);
51 void get_sector_number(long lOffset, int *pnSector);
52 int GetSectorProtectionStatus(flash_info_t * info, int nSector);
53 int GetOffset(int nBlock);
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
103 #define FLASH_SUCCESS 0
104 #define FLASH_FAIL -1