Blame view

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