1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /*
3  * Copyright (C) 2010
4  * Reinhard Meyer, reinhard.meyer@emk-elektronik.de
5  *
6  * Enhanced Embedded Flash Controller
7  * Based on AT91SAM9XE datasheet
8  */
9 
10 #ifndef AT91_EEFC_H
11 #define AT91_EEFC_H
12 
13 #ifndef __ASSEMBLY__
14 
15 typedef struct at91_eefc {
16 	u32	fmr;	/* Flash Mode Register RW */
17 	u32	fcr;	/* Flash Command Register WO */
18 	u32	fsr;	/* Flash Status Register RO */
19 	u32	frr;	/* Flash Result Register RO */
20 } at91_eefc_t;
21 
22 #endif /* __ASSEMBLY__ */
23 
24 #define AT91_EEFC_FMR_FWS_MASK	0x00000f00
25 #define AT91_EEFC_FMR_FRDY_BIT	0x00000001
26 
27 #define AT91_EEFC_FCR_KEY		0x5a000000
28 #define AT91_EEFC_FCR_FARG_MASK	0x00ffff00
29 #define AT91_EEFC_FCR_FARG_SHIFT	8
30 #define AT91_EEFC_FCR_FCMD_GETD	0x0
31 #define AT91_EEFC_FCR_FCMD_WP		0x1
32 #define AT91_EEFC_FCR_FCMD_WPL		0x2
33 #define AT91_EEFC_FCR_FCMD_EWP		0x3
34 #define AT91_EEFC_FCR_FCMD_EWPL	0x4
35 #define AT91_EEFC_FCR_FCMD_EA		0x5
36 #define AT91_EEFC_FCR_FCMD_SLB		0x8
37 #define AT91_EEFC_FCR_FCMD_CLB		0x9
38 #define AT91_EEFC_FCR_FCMD_GLB		0xA
39 #define AT91_EEFC_FCR_FCMD_SGPB	0xB
40 #define AT91_EEFC_FCR_FCMD_CGPB	0xC
41 #define AT91_EEFC_FCR_FCMD_GGPB	0xD
42 
43 #define AT91_EEFC_FSR_FRDY	1
44 #define AT91_EEFC_FSR_FCMDE	2
45 #define AT91_EEFC_FSR_FLOCKE	4
46 
47 #endif
48