2 # Copyright 2010 Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
6 # This is for the "at91rm9200-ek" eval board.
9 # It has atmel at91rm9200 chip.
10 source [find target/at91rm9200.cfg]
12 reset_config trst_and_srst
14 $_TARGETNAME configure -event gdb-attach { reset init }
15 $_TARGETNAME configure -event reset-init { at91rm9200_ek_init }
17 ## flash bank <name> <driver> <base> <size> <chip_width> <bus_width> <target>
18 set _FLASHNAME $_CHIPNAME.flash
19 flash bank $_FLASHNAME cfi 0x10000000 0x00800000 2 2 $_TARGETNAME
22 proc at91rm9200_ek_init { } {
23 # Try to run at 1khz... Yea, that slow!
24 # Chip is really running @ 32khz
27 mww 0xfffffc64 0xffffffff
28 ## disable all clocks but system clock
29 mww 0xfffffc04 0xfffffffe
30 ## disable all clocks to pioa and piob
31 mww 0xfffffc14 0xffffffc3
32 ## master clock = slow cpu = slow
33 ## (means the CPU is running at 32khz!)
36 mww 0xfffffc20 0x0000ff01
38 mww 0xFFFFFF50 0x00000000
39 ## MC_PUER: Memory controller protection unit disable
40 mww 0xFFFFFF54 0x00000000
42 mww 0xFFFFFF64 0x00000000
43 ## SMC2_CSR[0]: 16bit, 2 TDF, 4 WS
44 mww 0xFFFFFF70 0x00003284
48 mww 0xFFFFFC28 0x2000BF05
49 ## PLLAR: 179,712000 MHz for PCK
50 mww 0xFFFFFC28 0x20263E04
53 mww 0xFFFFFC30 0x00000100
55 ## ;MCKR : PCK/3 = MCK Master Clock = 59,904000MHz from PLLA
56 mww 0xFFFFFC30 0x00000202
59 #========================================
60 # CPU now runs at 180mhz
63 #========================================
66 ## PIOC_ASR: Configure PIOC as peripheral (D16/D31)
67 mww 0xFFFFF870 0xFFFF0000
69 mww 0xFFFFF874 0x00000000
71 mww 0xFFFFF804 0xFFFF0000
72 ## EBI_CSA : CS1=SDRAM
73 mww 0xFFFFFF60 0x00000002
75 mww 0xFFFFFF64 0x00000000
77 mww 0xFFFFFF98 0x2188c155
78 ## SDRC_MR : Precharge All
79 mww 0xFFFFFF90 0x00000002
81 mww 0x20000000 0x00000000
83 mww 0xFFFFFF90 0x00000004
85 mww 0x20000000 0x00000000
87 mww 0x20000000 0x00000000
89 mww 0x20000000 0x00000000
91 mww 0x20000000 0x00000000
93 mww 0x20000000 0x00000000
95 mww 0x20000000 0x00000000
97 mww 0x20000000 0x00000000
99 mww 0x20000000 0x00000000
100 ## SDRC_MR : Load Mode Register
101 mww 0xFFFFFF90 0x00000003
103 mww 0x20000080 0x00000000
104 ## SDRC_TR : Write refresh rate
105 mww 0xFFFFFF94 0x000002E0
107 mww 0x20000000 0x00000000
108 ## SDRC_MR : Normal Mode
109 mww 0xFFFFFF90 0x00000000
111 mww 0x20000000 0x00000000