2 * Memory Setup stuff - taken from blob memsetup.S
4 * Copyright (C) 1999 2000 2001 Erik Mouw (J.A.K.Mouw@its.tudelft.nl) and
5 * Jan-Derk Bakker (J.D.Bakker@its.tudelft.nl)
6 * 2004 (c) MontaVista Software, Inc.
8 * SPDX-License-Identifier: GPL-2.0+
16 /*-----------------------------------------------------------------------
43 #define MDREFR_TRASR(n_) (n_ & (0x0000000f))
44 #define MDREFR_DRI(n_) ((n_ & (0x00000fff)) << 4)
45 #define MDREFR_K0DB2 (1 << 18)
46 #define MDREFR_K1DB2 (1 << 22)
47 #define MDREFR_K2DB2 (1 << 26)
49 #define MDREFR_K0RUN (1 << 17)
50 #define MDREFR_K1RUN (1 << 21)
51 #define MDREFR_K2RUN (1 << 25)
53 #define MDREFR_SLFRSH (1 << 31)
54 #define MDREFR_E1PIN (1 << 20)
57 #define PSSR_DH 0x00000008
61 /*-----------------------------------------------------------------------
62 * Setup parameters for the board:
64 MEM_BASE: .long 0xa0000000
65 MEM_START: .long 0xc0000000
66 PWR_BASE: .word 0x90020000
67 RST_BASE: .long 0x90030000
68 PPC_BASE: .long 0x90060000
69 GPIO_BASE: .long 0x90040000
70 IC_BASE: .word 0x90050000
73 /* calculated from old blob bootloader */
74 mdcnfg: .long 0x00037267 /* mdcnfg 0x00037267 */
75 mdcas00: .long 0x5555557f /* mdcas00 0x5555557f */
76 mdcas01: .long 0x55555555 /* mdcas01 0x55555555 */
77 mdcas02: .long 0x55555555 /* mdcas02 0x55555555 */
78 msc0: .long 0xfff04f78 /* msc0 0xfff04f78 */
79 msc1: .long 0xfff8fff0 /* msc1 0xfff8fff0 */
80 mecr: .long 0x98c698c6 /* mecr 0x98c698c6 */
81 mdrefr: .long 0x067600c7 /* mdrefr 0x04340327 */
82 mdcas20: .long 0xd1284142 /* mdcas20 0xd1284142 */
83 mdcas21: .long 0x72249529 /* mdcas21 0x72249529 */
84 mdcas22: .long 0x78414351 /* mdcas22 0x78414351 */
85 msc2: .long 0x201d2959 /* msc2 0x201d2959 */
86 smcnfg: .long 0x00000000 /* smcnfg 0x00000000 */
88 pin_set_out: .long 0x37ff70
89 pin_set_dir: .long 0x11480
91 gpdr_set: .long 0x0B3A0900
92 gpsr_set: .long 0x02100800
93 gpcr_set: .long 0x092A0100
94 gafr_set: .long 0x08600000
100 /* this is required for flashing */
107 /* Setting up the memory and stuff */
108 /***********************************/
113 str r1, [r0, #MDCNFG]
115 str r1, [r0, #MDCAS00]
117 str r1, [r0, #MDCAS01]
119 str r1, [r0, #MDCAS02]
121 str r1, [r0, #MDCAS20]
123 str r1, [r0, #MDCAS21]
125 str r1, [r0, #MDCAS22]
128 ldr r2, [r0, #MDREFR]
129 bic r2, r2, #MDREFR_K0DB2
130 bic r2, r2, #MDREFR_K1DB2
131 bic r2, r2, #MDREFR_K2DB2
132 str r2, [r0, #MDREFR]
134 ldr r2, [r0, #MDREFR]
135 orr r2, r2, #MDREFR_TRASR(7)
138 spin: subs r4, r4, #1
145 ldr r2, [r0, #MDREFR]
146 bic r2, r2, #MDREFR_K0DB2
147 bic r2, r2, #MDREFR_K1DB2
148 bic r2, r2, #MDREFR_K2DB2
149 str r2, [r0, #MDREFR]
151 ldr r2, [r0, #MDREFR]
152 orr r2, r2, #MDREFR_TRASR(7)
153 orr r2, r2, #MDREFR_DRI(12)
154 orr r2, r2, #MDREFR_K0DB2
155 orr r2, r2, #MDREFR_K1DB2
156 orr r2, r2, #MDREFR_K2DB2
157 str r2, [r0, #MDREFR]
159 ldr r2, [r0, #MDREFR]
160 orr r2, r2, #MDREFR_K0RUN
161 orr r2, r2, #MDREFR_K1RUN
162 orr r2, r2, #MDREFR_K2RUN
163 str r2, [r0, #MDREFR]
165 ldr r2, [r0, #MDREFR]
166 bic r2, r2, #MDREFR_SLFRSH
167 str r2, [r0, #MDREFR]
169 ldr r2, [r0, #MDREFR]
170 orr r2, r2, #MDREFR_E1PIN
171 str r2, [r0, #MDREFR]
178 ldr r2, [r0, #MDCNFG]
179 orr r2, r2, #0x00000003
180 orr r2, r2, #0x00030000
181 str r2, [r0, #MDCNFG]
190 str r1, [r0, #SMCNFG]