1 /***************************************************************************
2 * Copyright (C) 2006 by Magnus Lundin *
5 * Copyright (C) 2006 by Gheorghe Guran (atlas) *
7 * This program is free software; you can redistribute it and/or modify *
8 * it under the terms of the GNU General Public License as published by *
9 * the Free Software Foundation; either version 2 of the License, or *
10 * (at your option) any later version. *
12 * This program is distributed in the hope that it will be useful, *
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
15 * GNU General Public License for more details. *
17 * You should have received a copy of the GNU General Public License *
18 * along with this program; if not, write to the *
19 * Free Software Foundation, Inc., *
20 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
21 ***************************************************************************/
30 typedef struct at91sam7_flash_bank_s
32 /* chip id register */
44 /* flash auto-detection */
45 u8 flash_autodetection;
50 u16 pages_in_lockregion;
61 1: fmcn for nvbits (1uS)
62 2: fmcn for flash (1.5uS) */
65 /* main clock status */
69 /* external clock frequency */
72 } at91sam7_flash_bank_t;
75 /* AT91SAM7 control registers */
76 #define DBGU_CIDR 0xFFFFF240
77 #define CKGR_MCFR 0xFFFFFC24
78 #define CKGR_MOR 0xFFFFFC20
79 #define CKGR_MCFR_MAINRDY 0x10000
80 #define CKGR_PLLR 0xFFFFFC2c
81 #define CKGR_PLLR_DIV 0xff
82 #define CKGR_PLLR_MUL 0x07ff0000
83 #define PMC_MCKR 0xFFFFFC30
84 #define PMC_MCKR_CSS 0x03
85 #define PMC_MCKR_PRES 0x1c
87 /* Flash Controller Commands */
97 /* MC_FSR bit definitions */
101 /* AT91SAM7 constants */
102 #define RC_FREQ 32000
104 /* Flash timing modes */
105 #define FMR_TIMING_NONE 0
106 #define FMR_TIMING_NVBITS 1
107 #define FMR_TIMING_FLASH 2
109 /* Flash size constants */
110 #define FLASH_SIZE_8KB 1
111 #define FLASH_SIZE_16KB 2
112 #define FLASH_SIZE_32KB 3
113 #define FLASH_SIZE_64KB 5
114 #define FLASH_SIZE_128KB 7
115 #define FLASH_SIZE_256KB 9
116 #define FLASH_SIZE_512KB 10
117 #define FLASH_SIZE_1024KB 12
118 #define FLASH_SIZE_2048KB 14
120 #endif /* AT91SAM7_H */