- Remove all of the annoying $Id strings
[coreboot.git] / src / pmc / altimus / mpc7410 / mpc7410.c
1 /* Copyright 2000  AG Electronics Ltd. */
2 /* This code is distributed without warranty under the GPL v2 (see COPYING) */
3
4 #include <ppc.h>
5 #include <ppcreg.h>
6 #include <string.h>
7 #include <console/console.h>
8
9 #define ONEMEG  0x00100000
10 #define HALFMEG 0x00080000
11
12 unsigned long memory_base = 0;
13 unsigned long memory_top = 0;
14 unsigned long memory_size = 0;
15
16 //extern char __heap_end[];
17 extern unsigned mpc107_config_memory(void);
18
19 unsigned config_memory(unsigned offset)
20 {
21     //extern char __start[];
22     //extern char __bss_start[];
23     //unsigned rom_image = (unsigned) __start & 0xfff00000;
24     //unsigned physical = rom_image + offset;
25     //unsigned codesize = (unsigned) __bss_start - rom_image;
26
27 #if 0    
28     /* At this point, DBAT 0 is memory, 1 is variable, 2 is the rom image,
29        and 3 is IO. */
30     ppc_set_io_dbat_reloc(2, rom_image, physical, ONEMEG);
31     ppc_set_io_dbat (3, 0xf0000000, 0x10000000);
32     if ( rom_image != physical )
33             ppc_set_ibats_reloc(rom_image, physical, ONEMEG);
34     else
35             ppc_set_ibats(physical, ONEMEG);
36
37     printk_debug("bsp_init_memory...\n");
38 #endif
39
40     ppc_setup_cpu(1); /* icache enable = 1 */
41     //ppc_enable_mmu();
42
43     memory_size = mpc107_config_memory();
44         
45     /* If we have some working RAM, we copy the code and rodata into it.
46      * This allows us to reprogram the flash later. */
47 #if 0
48     if (memory_size)
49     {
50         unsigned onemeg = memory_size - ONEMEG;
51         ppc_set_mem_dbat_reloc(1, onemeg, onemeg, ONEMEG);
52         memcpy((void *)onemeg, (void *)rom_image, codesize);
53         memset((void *)(onemeg + codesize), 0, ONEMEG - codesize);
54         ppc_set_ibats_reloc2(rom_image, physical, onemeg, ONEMEG);
55         ppc_set_mem_dbat_reloc(2, rom_image, onemeg, ONEMEG);
56         make_coherent((void *)onemeg, ONEMEG);
57     }
58
59     ppc_set_memory_dbat (memory_size);
60 #endif
61
62     //ppc_enable_dcache ();
63
64     return memory_size;
65 }