]>
git.ipfire.org Git - people/ms/u-boot.git/blob - board/munices/munices.c
3 * Heiko Schocher, DENX Software Engineering, hs@denx.de.
5 * See file CREDITS for list of people who contributed to this
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License as
10 * published by the Free Software Foundation; either version 2 of
11 * the License, or (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
28 #include "mt48lc16m16a2-75.h"
30 #ifndef CONFIG_SYS_RAMBOOT
31 static void sdram_start (int hi_addr
)
33 long hi_addr_bit
= hi_addr
? 0x01000000 : 0;
35 /* unlock mode register */
36 *(vu_long
*)MPC5XXX_SDRAM_CTRL
= SDRAM_CONTROL
| 0x80000000 | hi_addr_bit
;
37 __asm__
volatile ("sync");
39 /* precharge all banks */
40 *(vu_long
*)MPC5XXX_SDRAM_CTRL
= SDRAM_CONTROL
| 0x80000002 | hi_addr_bit
;
41 __asm__
volatile ("sync");
44 /* set mode register: extended mode */
45 *(vu_long
*)MPC5XXX_SDRAM_MODE
= SDRAM_EMODE
;
46 __asm__
volatile ("sync");
48 /* set mode register: reset DLL */
49 *(vu_long
*)MPC5XXX_SDRAM_MODE
= SDRAM_MODE
| 0x04000000;
50 __asm__
volatile ("sync");
53 /* precharge all banks */
54 *(vu_long
*)MPC5XXX_SDRAM_CTRL
= SDRAM_CONTROL
| 0x80000002 | hi_addr_bit
;
55 __asm__
volatile ("sync");
58 *(vu_long
*)MPC5XXX_SDRAM_CTRL
= SDRAM_CONTROL
| 0x80000004 | hi_addr_bit
;
59 __asm__
volatile ("sync");
61 /* set mode register */
62 *(vu_long
*)MPC5XXX_SDRAM_MODE
= SDRAM_MODE
;
63 __asm__
volatile ("sync");
65 /* normal operation */
66 *(vu_long
*)MPC5XXX_SDRAM_CTRL
= SDRAM_CONTROL
| hi_addr_bit
;
67 __asm__
volatile ("sync");
72 * ATTENTION: Although partially referenced initdram does NOT make real use
73 * use of CONFIG_SYS_SDRAM_BASE. The code does not work if CONFIG_SYS_SDRAM_BASE
74 * is something else than 0x00000000.
77 phys_size_t
initdram (int board_type
)
81 #ifndef CONFIG_SYS_RAMBOOT
84 /* setup SDRAM chip selects */
85 *(vu_long
*)MPC5XXX_SDRAM_CS0CFG
= 0x0000001b;/* 256MB at 0x0 */
86 *(vu_long
*)MPC5XXX_SDRAM_CS1CFG
= 0x10000000;/* disabled */
87 __asm__
volatile ("sync");
89 /* setup config registers */
90 *(vu_long
*)MPC5XXX_SDRAM_CONFIG1
= SDRAM_CONFIG1
;
91 *(vu_long
*)MPC5XXX_SDRAM_CONFIG2
= SDRAM_CONFIG2
;
92 __asm__
volatile ("sync");
94 #if SDRAM_DDR && SDRAM_TAPDELAY
96 *(vu_long
*)MPC5XXX_CDM_PORCFG
= SDRAM_TAPDELAY
;
97 __asm__
volatile ("sync");
100 /* find RAM size using SDRAM CS0 only */
102 test1
= (ulong
)get_ram_size((long *)CONFIG_SYS_SDRAM_BASE
, 0x10000000);
104 test2
= (ulong
)get_ram_size((long *)CONFIG_SYS_SDRAM_BASE
, 0x10000000);
112 /* memory smaller than 1MB is impossible */
113 if (dramsize
< (1 << 20)) {
117 /* set SDRAM CS0 size according to the amount of RAM found */
119 *(vu_long
*)MPC5XXX_SDRAM_CS0CFG
= 0x13 + __builtin_ffs(dramsize
>> 20) - 1;
121 *(vu_long
*)MPC5XXX_SDRAM_CS0CFG
= 0; /* disabled */
124 #else /* CONFIG_SYS_RAMBOOT */
126 /* retrieve size of memory connected to SDRAM CS0 */
127 dramsize
= *(vu_long
*)MPC5XXX_SDRAM_CS0CFG
& 0xFF;
128 if (dramsize
>= 0x13) {
129 dramsize
= (1 << (dramsize
- 0x13)) << 20;
134 /* retrieve size of memory connected to SDRAM CS1 */
135 dramsize2
= *(vu_long
*)MPC5XXX_SDRAM_CS1CFG
& 0xFF;
136 if (dramsize2
>= 0x13) {
137 dramsize2
= (1 << (dramsize2
- 0x13)) << 20;
142 #endif /* CONFIG_SYS_RAMBOOT */
144 return dramsize
+ dramsize2
;
147 int checkboard (void)
149 puts ("Board: MUNICes\n");
154 static struct pci_controller hose
;
156 extern void pci_mpc5xxx_init(struct pci_controller
*);
158 void pci_init_board(void)
160 pci_mpc5xxx_init(&hose
);
164 #if defined(CONFIG_OF_LIBFDT) && defined(CONFIG_OF_BOARD_SETUP)
166 ft_board_setup(void *blob
, bd_t
*bd
)
168 ft_cpu_setup(blob
, bd
);