1 |
655 |
julius |
/* cfi_ctrl driver header */
|
2 |
|
|
|
3 |
|
|
#define CFI_CTRL_UNLOCKBLOCK_OFFSET 0x04000000
|
4 |
|
|
#define CFI_CTRL_ERASEBLOCK_OFFSET 0x08000000
|
5 |
|
|
#define CFI_CTRL_REGS_OFFSET 0x0c000000
|
6 |
|
|
#define CFI_CTRL_DEVICEIDENT_OFFSET 0x0e000000
|
7 |
|
|
#define CFI_CTRL_CFIQUERY_OFFSET 0x0e010000
|
8 |
|
|
|
9 |
|
|
#define CFI_CTRL_SCR_OFFSET (CFI_CTRL_REGS_OFFSET + 0)
|
10 |
|
|
#define CFI_CTRL_FSR_OFFSET (CFI_CTRL_REGS_OFFSET + 4)
|
11 |
|
|
|
12 |
|
|
#define CFI_CTRL_SCR_CONTROLLER_BUSY (1 << 0)
|
13 |
|
|
#define CFI_CTRL_SCR_CLEAR_FSR (1 << 1)
|
14 |
|
|
#define CFI_CTRL_SCR_RESET_DEVICE (1 << 2)
|
15 |
|
|
|
16 |
|
|
/* Flash status register (FSR) bit meanings - from CFI standard */
|
17 |
|
|
#define CFI_FSR_DWS (1<<7) /* Device write status. 0 - busy, 1 - ready */
|
18 |
|
|
#define CFI_FSR_ERR (1<<6) /* Erase suspend status - N/A here */
|
19 |
|
|
#define CFI_FSR_ES (1<<5) /* Erase status. 0 - successful, 1 - fail/seq err. */
|
20 |
|
|
#define CFI_FSR_PS (1<<4) /* Program status. 0 - successful, 1 - fail/seq err*/
|
21 |
|
|
#define CFI_FSR_VPPS (1<<3) /* VPP status. N/A here */
|
22 |
|
|
#define CFI_FSR_PSS (1<<2) /* Program suspend status. N/A here */
|
23 |
|
|
#define CFI_FSR_BLS (1<<1) /* Block-locked status */
|
24 |
|
|
#define CFI_FSR_BWS (1<<0) /* Buffer-enhanced programming status - N/A here */
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
/* Driver function prototypes */
|
28 |
|
|
void cfi_ctrl_reset_flash(void);
|
29 |
|
|
void cfi_ctrl_clear_status(void);
|
30 |
|
|
int cfi_ctrl_busy(void);
|
31 |
|
|
unsigned char cfi_ctrl_get_status(void);
|
32 |
|
|
void cfi_ctrl_unlock_block(unsigned int addr);
|
33 |
|
|
int cfi_ctrl_erase_block(unsigned int addr);
|
34 |
|
|
void cfi_ctrl_erase_block_no_wait(unsigned int addr);
|
35 |
|
|
int cfi_ctrl_write_short(short data, unsigned int addr);
|
36 |
|
|
short cfi_ctrl_read_identifier(unsigned int addr);
|
37 |
|
|
short cfi_ctrl_query_info(unsigned int addr);
|
38 |
|
|
void cfi_ctrl_enable_data_read(void);
|