1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24#ifndef SPR_SMI_H
25#define SPR_SMI_H
26
27
28
29
30#define FLASH_START_ADDRESS CONFIG_SYS_FLASH_BASE
31#define FLASH_BANK_SIZE CONFIG_SYS_FLASH_BANK_SIZE
32
33#define SMIBANK0_BASE (FLASH_START_ADDRESS)
34#define SMIBANK1_BASE (SMIBANK0_BASE + FLASH_BANK_SIZE)
35#define SMIBANK2_BASE (SMIBANK1_BASE + FLASH_BANK_SIZE)
36#define SMIBANK3_BASE (SMIBANK2_BASE + FLASH_BANK_SIZE)
37
38#define BANK0 0
39#define BANK1 1
40#define BANK2 2
41#define BANK3 3
42
43struct smi_regs {
44 u32 smi_cr1;
45 u32 smi_cr2;
46 u32 smi_sr;
47 u32 smi_tr;
48 u32 smi_rr;
49};
50
51
52#define BANK_EN 0x0000000F
53#define DSEL_TIME 0x00000060
54#define PRESCAL5 0x00000500
55#define PRESCALA 0x00000A00
56#define PRESCAL3 0x00000300
57#define PRESCAL4 0x00000400
58#define SW_MODE 0x10000000
59#define WB_MODE 0x20000000
60#define FAST_MODE 0x00008000
61#define HOLD1 0x00010000
62
63
64#define RD_STATUS_REG 0x00000400
65#define WE 0x00000800
66#define BANK0_SEL 0x00000000
67#define BANK1_SEL 0x00001000
68#define BANK2_SEL 0x00002000
69#define BANK3_SEL 0x00003000
70#define BANKSEL_SHIFT 12
71#define SEND 0x00000080
72#define TX_LEN_1 0x00000001
73#define TX_LEN_2 0x00000002
74#define TX_LEN_3 0x00000003
75#define TX_LEN_4 0x00000004
76#define RX_LEN_1 0x00000010
77#define RX_LEN_2 0x00000020
78#define RX_LEN_3 0x00000030
79#define RX_LEN_4 0x00000040
80#define TFIE 0x00000100
81#define WCIE 0x00000200
82
83
84#define INT_WCF_CLR 0xFFFFFDFF
85#define INT_TFF_CLR 0xFFFFFEFF
86#define WIP_BIT 0x00000001
87#define WEL_BIT 0x00000002
88#define RSR 0x00000005
89#define TFF 0x00000100
90#define WCF 0x00000200
91#define ERF1 0x00000400
92#define ERF2 0x00000800
93#define WM0 0x00001000
94#define WM1 0x00002000
95#define WM2 0x00004000
96#define WM3 0x00008000
97#define WM_SHIFT 12
98
99
100#define READ_ID 0x0000009F
101#define BULK_ERASE 0x000000C7
102#define SECTOR_ERASE 0x000000D8
103#define WRITE_ENABLE 0x00000006
104
105struct flash_dev {
106 u32 density;
107 ulong size;
108 ushort sector_count;
109};
110
111#define SFLASH_PAGE_SIZE 0x100
112#define XFER_FINISH_TOUT 2
113#define WMODE_TOUT 2
114
115#endif
116