85b709cc69f9c91df3c6286563e02c66dd1864a9
[fw/openocd] / src / flash / nor / stellaris.h
1 /***************************************************************************
2  *   Copyright (C) 2006 by Magnus Lundin                                   *
3  *   lundin@mlu.mine.nu                                                    *
4  *                                                                         *
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.                                   *
9  *                                                                         *
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.                          *
14  *                                                                         *
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
22
23 #include <flash/flash.h>
24
25 struct stellaris_flash_bank
26 {
27         /* chip id register */
28         uint32_t did0;
29         uint32_t did1;
30         uint32_t dc0;
31         uint32_t dc1;
32
33         char * target_name;
34
35         uint32_t sramsiz;
36         uint32_t flshsz;
37         /* flash geometry */
38         uint32_t num_pages;
39         uint32_t pagesize;
40         uint32_t pages_in_lockregion;
41
42         /* nv memory bits */
43         uint16_t num_lockbits;
44         uint32_t lockbits;
45
46         /* main clock status */
47         uint32_t rcc;
48         uint32_t rcc2;
49         uint8_t  mck_valid;
50         uint8_t  xtal_mask;
51         uint32_t iosc_freq;
52         uint32_t mck_freq;
53         const char *iosc_desc;
54         const char *mck_desc;
55 };
56
57 /* STELLARIS control registers */
58 #define SCB_BASE        0x400FE000
59 #define DID0            0x000
60 #define DID1            0x004
61 #define DC0                     0x008
62 #define DC1                     0x010
63 #define DC2                     0x014
64 #define DC3                     0x018
65 #define DC4                     0x01C
66
67 #define RIS                     0x050
68 #define RCC                     0x060
69 #define PLLCFG          0x064
70 #define RCC2            0x070
71
72 #define FMPRE           0x130
73 #define FMPPE           0x134
74 #define USECRL          0x140
75
76 #define FLASH_CONTROL_BASE      0x400FD000
77 #define FLASH_FMA       (FLASH_CONTROL_BASE | 0x000)
78 #define FLASH_FMD       (FLASH_CONTROL_BASE | 0x004)
79 #define FLASH_FMC       (FLASH_CONTROL_BASE | 0x008)
80 #define FLASH_CRIS      (FLASH_CONTROL_BASE | 0x00C)
81 #define FLASH_CIM       (FLASH_CONTROL_BASE | 0x010)
82 #define FLASH_MISC      (FLASH_CONTROL_BASE | 0x014)
83
84 #define AMISC   1
85 #define PMISC   2
86
87 #define AMASK   1
88 #define PMASK   2
89
90 /* Flash Controller Command bits */
91 #define FMC_WRKEY       (0xA442 << 16)
92 #define FMC_COMT        (1 << 3)
93 #define FMC_MERASE      (1 << 2)
94 #define FMC_ERASE       (1 << 1)
95 #define FMC_WRITE       (1 << 0)
96
97 /* STELLARIS constants */
98
99 #endif /* STELLARIS_H */