Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 Nobuhiro Iwamatsu |
| 3 | * Copyright (C) 2008 Renesas Solutions Corp. |
| 4 | * |
| 5 | * This program is free software; you can redistribute it and/or |
| 6 | * modify it under the terms of the GNU General Public License as |
| 7 | * published by the Free Software Foundation; either version 2 of |
| 8 | * the License, or (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 Free Software |
| 17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, |
| 18 | * MA 02111-1307 USA |
| 19 | */ |
| 20 | #include <config.h> |
| 21 | #include <version.h> |
| 22 | |
| 23 | #include <asm/processor.h> |
| 24 | |
| 25 | .global lowlevel_init |
| 26 | |
| 27 | .text |
| 28 | .align 2 |
| 29 | |
| 30 | lowlevel_init: |
| 31 | /* Cache setting */ |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 32 | mov.l CCR1_A, r1 |
| 33 | mov.l CCR1_D, r0 |
| 34 | mov.l r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 35 | |
| 36 | /* ConfigurePortPins */ |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 37 | mov.l PECRL3_A, r1 |
| 38 | mov.l PECRL3_D, r0 |
| 39 | mov.w r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 40 | |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 41 | mov.l PCCRL4_A, r1 |
| 42 | mov.l PCCRL4_D0, r0 |
| 43 | mov.w r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 44 | |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 45 | mov.l PECRL4_A, r1 |
| 46 | mov.l PECRL4_D0, r0 |
| 47 | mov.w r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 48 | |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 49 | mov.l PEIORL_A, r1 |
| 50 | mov.l PEIORL_D0, r0 |
| 51 | mov.w r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 52 | |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 53 | mov.l PCIORL_A, r1 |
| 54 | mov.l PCIORL_D, r0 |
| 55 | mov.w r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 56 | |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 57 | mov.l PFCRH2_A, r1 |
| 58 | mov.l PFCRH2_D, r0 |
| 59 | mov.w r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 60 | |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 61 | mov.l PFCRH3_A, r1 |
| 62 | mov.l PFCRH3_D, r0 |
| 63 | mov.w r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 64 | |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 65 | mov.l PFCRH1_A, r1 |
| 66 | mov.l PFCRH1_D, r0 |
| 67 | mov.w r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 68 | |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 69 | mov.l PFIORH_A, r1 |
| 70 | mov.l PFIORH_D, r0 |
| 71 | mov.w r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 72 | |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 73 | mov.l PECRL1_A, r1 |
| 74 | mov.l PECRL1_D0, r0 |
| 75 | mov.w r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 76 | |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 77 | mov.l PEIORL_A, r1 |
| 78 | mov.l PEIORL_D1, r0 |
| 79 | mov.w r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 80 | |
| 81 | /* Configure Operating Frequency */ |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 82 | mov.l WTCSR_A, r1 |
| 83 | mov.l WTCSR_D0, r0 |
| 84 | mov.w r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 85 | |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 86 | mov.l WTCSR_A, r1 |
| 87 | mov.l WTCSR_D1, r0 |
| 88 | mov.w r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 89 | |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 90 | mov.l WTCNT_A, r1 |
| 91 | mov.l WTCNT_D, r0 |
| 92 | mov.w r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 93 | |
| 94 | /* Set clock mode*/ |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 95 | mov.l FRQCR_A, r1 |
| 96 | mov.l FRQCR_D, r0 |
| 97 | mov.w r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 98 | |
| 99 | /* Configure Bus And Memory */ |
| 100 | init_bsc_cs0: |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 101 | mov.l PCCRL4_A, r1 |
| 102 | mov.l PCCRL4_D1, r0 |
| 103 | mov.w r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 104 | |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 105 | mov.l PECRL1_A, r1 |
| 106 | mov.l PECRL1_D1, r0 |
| 107 | mov.w r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 108 | |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 109 | mov.l CMNCR_A, r1 |
| 110 | mov.l CMNCR_D, r0 |
| 111 | mov.l r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 112 | |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 113 | mov.l SC0BCR_A, r1 |
| 114 | mov.l SC0BCR_D, r0 |
| 115 | mov.l r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 116 | |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 117 | mov.l CS0WCR_A, r1 |
| 118 | mov.l CS0WCR_D, r0 |
| 119 | mov.l r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 120 | |
| 121 | init_bsc_cs1: |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 122 | mov.l PECRL4_A, r1 |
| 123 | mov.l PECRL4_D1, r0 |
| 124 | mov.w r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 125 | |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 126 | mov.l CS1WCR_A, r1 |
| 127 | mov.l CS1WCR_D, r0 |
| 128 | mov.l r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 129 | |
| 130 | init_sdram: |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 131 | mov.l PCCRL2_A, r1 |
| 132 | mov.l PCCRL2_D, r0 |
| 133 | mov.w r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 134 | |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 135 | mov.l PCCRL4_A, r1 |
| 136 | mov.l PCCRL4_D2, r0 |
| 137 | mov.w r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 138 | |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 139 | mov.l PCCRL1_A, r1 |
| 140 | mov.l PCCRL1_D, r0 |
| 141 | mov.w r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 142 | |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 143 | mov.l PCCRL3_A, r1 |
| 144 | mov.l PCCRL3_D, r0 |
| 145 | mov.w r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 146 | |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 147 | mov.l CS3BCR_A, r1 |
| 148 | mov.l CS3BCR_D, r0 |
| 149 | mov.l r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 150 | |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 151 | mov.l CS3WCR_A, r1 |
| 152 | mov.l CS3WCR_D, r0 |
| 153 | mov.l r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 154 | |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 155 | mov.l SDCR_A, r1 |
| 156 | mov.l SDCR_D, r0 |
| 157 | mov.l r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 158 | |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 159 | mov.l RTCOR_A, r1 |
| 160 | mov.l RTCOR_D, r0 |
| 161 | mov.l r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 162 | |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 163 | mov.l RTCSR_A, r1 |
| 164 | mov.l RTCSR_D, r0 |
| 165 | mov.l r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 166 | |
| 167 | /* wait 200us */ |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 168 | mov.l REPEAT_D, r3 |
| 169 | mov #0, r2 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 170 | repeat0: |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 171 | add #1, r2 |
| 172 | cmp/hs r3, r2 |
| 173 | bf repeat0 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 174 | nop |
| 175 | |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 176 | mov.l SDRAM_MODE, r1 |
| 177 | mov #0, r0 |
| 178 | mov.l r0, @r1 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 179 | |
| 180 | nop |
| 181 | rts |
| 182 | |
| 183 | .align 4 |
| 184 | |
| 185 | CCR1_A: .long CCR1 |
| 186 | CCR1_D: .long 0x0000090B |
| 187 | PCCRL4_A: .long 0xFFFE3910 |
| 188 | PCCRL4_D0: .long 0x00000000 |
| 189 | PECRL4_A: .long 0xFFFE3A10 |
| 190 | PECRL4_D0: .long 0x00000000 |
| 191 | PECRL3_A: .long 0xFFFE3A12 |
| 192 | PECRL3_D: .long 0x00000000 |
| 193 | PEIORL_A: .long 0xFFFE3A06 |
| 194 | PEIORL_D0: .long 0x00001C00 |
| 195 | PEIORL_D1: .long 0x00001C02 |
| 196 | PCIORL_A: .long 0xFFFE3906 |
| 197 | PCIORL_D: .long 0x00004000 |
| 198 | PFCRH2_A: .long 0xFFFE3A8C |
| 199 | PFCRH2_D: .long 0x00000000 |
| 200 | PFCRH3_A: .long 0xFFFE3A8A |
| 201 | PFCRH3_D: .long 0x00000000 |
| 202 | PFCRH1_A: .long 0xFFFE3A8E |
| 203 | PFCRH1_D: .long 0x00000000 |
| 204 | PFIORH_A: .long 0xFFFE3A84 |
| 205 | PFIORH_D: .long 0x00000729 |
| 206 | PECRL1_A: .long 0xFFFE3A16 |
| 207 | PECRL1_D0: .long 0x00000033 |
| 208 | |
| 209 | |
| 210 | WTCSR_A: .long 0xFFFE0000 |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 211 | WTCSR_D0: .long 0x0000A518 |
| 212 | WTCSR_D1: .long 0x0000A51D |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 213 | WTCNT_A: .long 0xFFFE0002 |
| 214 | WTCNT_D: .long 0x00005A84 |
| 215 | FRQCR_A: .long 0xFFFE0010 |
| 216 | FRQCR_D: .long 0x00000104 |
| 217 | |
| 218 | PCCRL4_D1: .long 0x00000010 |
| 219 | PECRL1_D1: .long 0x00000133 |
| 220 | |
| 221 | CMNCR_A: .long 0xFFFC0000 |
| 222 | CMNCR_D: .long 0x00001810 |
| 223 | SC0BCR_A: .long 0xFFFC0004 |
| 224 | SC0BCR_D: .long 0x10000400 |
| 225 | CS0WCR_A: .long 0xFFFC0028 |
| 226 | CS0WCR_D: .long 0x00000B41 |
| 227 | PECRL4_D1: .long 0x00000100 |
| 228 | CS1WCR_A: .long 0xFFFC002C |
| 229 | CS1WCR_D: .long 0x00000B01 |
| 230 | PCCRL4_D2: .long 0x00000011 |
| 231 | PCCRL3_A: .long 0xFFFE3912 |
| 232 | PCCRL3_D: .long 0x00000011 |
| 233 | PCCRL2_A: .long 0xFFFE3914 |
| 234 | PCCRL2_D: .long 0x00001111 |
| 235 | PCCRL1_A: .long 0xFFFE3916 |
| 236 | PCCRL1_D: .long 0x00001010 |
| 237 | PDCRL4_A: .long 0xFFFE3990 |
| 238 | PDCRL4_D: .long 0x00000011 |
| 239 | PDCRL3_A: .long 0xFFFE3992 |
| 240 | PDCRL3_D: .long 0x00000011 |
| 241 | PDCRL2_A: .long 0xFFFE3994 |
| 242 | PDCRL2_D: .long 0x00001111 |
| 243 | PDCRL1_A: .long 0xFFFE3996 |
| 244 | PDCRL1_D: .long 0x00001000 |
| 245 | CS3BCR_A: .long 0xFFFC0010 |
| 246 | CS3BCR_D: .long 0x00004400 |
| 247 | CS3WCR_A: .long 0xFFFC0034 |
| 248 | CS3WCR_D: .long 0x00002892 |
| 249 | SDCR_A: .long 0xFFFC004C |
| 250 | SDCR_D: .long 0x00000809 |
| 251 | RTCOR_A: .long 0xFFFC0058 |
| 252 | RTCOR_D: .long 0xA55A0041 |
| 253 | RTCSR_A: .long 0xFFFC0050 |
| 254 | RTCSR_D: .long 0xa55a0010 |
| 255 | |
| 256 | STBCR3_A: .long 0xFFFE0408 |
| 257 | STBCR3_D: .long 0x00000000 |
| 258 | STBCR4_A: .long 0xFFFE040C |
| 259 | STBCR4_D: .long 0x00000008 |
| 260 | STBCR5_A: .long 0xFFFE0410 |
| 261 | STBCR5_D: .long 0x00000000 |
Jean-Christophe PLAGNIOL-VILLARD | e443077 | 2008-12-20 19:29:48 +0100 | [diff] [blame^] | 262 | STBCR6_A: .long 0xFFFE0414 |
Nobuhiro Iwamatsu | c655fad | 2008-08-31 23:02:04 +0900 | [diff] [blame] | 263 | STBCR6_D: .long 0x00000002 |
| 264 | SDRAM_MODE: .long 0xFFFC5040 |
| 265 | REPEAT_D: .long 0x00009C40 |