1 /***************************************************************************
2 * Copyright (C) 2006 by Magnus Lundin *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; either version 2 of the License, or *
8 * (at your option) any later version. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
20 #ifndef STELLARIS_FLASH_H
21 #define STELLARIS_FLASH_H
23 struct stellaris_flash_bank
25 /* chip id register */
38 uint32_t pages_in_lockregion
;
41 uint16_t num_lockbits
;
43 /* main clock status */
50 const char *iosc_desc
;
54 /* STELLARIS control registers */
55 #define SCB_BASE 0x400FE000
69 /* "legacy" flash memory protection registers (64KB max) */
73 /* new flash memory protection registers (for more than 64KB) */
74 #define FMPRE0 0x200 /* PRE1 = PRE0 + 4, etc */
75 #define FMPPE0 0x400 /* PPE1 = PPE0 + 4, etc */
79 #define FLASH_CONTROL_BASE 0x400FD000
80 #define FLASH_FMA (FLASH_CONTROL_BASE | 0x000)
81 #define FLASH_FMD (FLASH_CONTROL_BASE | 0x004)
82 #define FLASH_FMC (FLASH_CONTROL_BASE | 0x008)
83 #define FLASH_CRIS (FLASH_CONTROL_BASE | 0x00C)
84 #define FLASH_CIM (FLASH_CONTROL_BASE | 0x010)
85 #define FLASH_MISC (FLASH_CONTROL_BASE | 0x014)
93 /* Flash Controller Command bits */
94 #define FMC_WRKEY (0xA442 << 16)
95 #define FMC_COMT (1 << 3)
96 #define FMC_MERASE (1 << 2)
97 #define FMC_ERASE (1 << 1)
98 #define FMC_WRITE (1 << 0)
100 /* STELLARIS constants */
102 /* values to write in FMA to commit write-"once" values */
103 #define FLASH_FMA_PRE(x) (2 * (x)) /* for FMPPREx */
104 #define FLASH_FMA_PPE(x) (2 * (x) + 1) /* for FMPPPEx */
106 #endif /* STELLARIS_H */