2 * Copyright 2010 Ben. Herrenschmidt, IBM Corporation.
4 * Based on earlier code:
5 * Copyright (C) Paul Mackerras 1997.
7 * Matt Porter <mporter@kernel.crashing.org>
8 * Copyright 2002-2005 MontaVista Software Inc.
10 * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
11 * Copyright (c) 2003, 2004 Zultys Technologies
13 * Copyright 2007 David Gibson, IBM Corporation.
15 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License
17 * as published by the Free Software Foundation; either version
18 * 2 of the License, or (at your option) any later version.
37 static u32 ibm4xx_memstart;
39 static void iss_4xx_fixups(void)
44 memory = finddevice("/memory");
46 fatal("Can't find memory node\n");
47 /* This assumes #address-cells = 2, #size-cells =1 and that */
48 getprop(memory, "reg", reg, sizeof(reg));
50 /* If the device tree specifies the memory range, use it */
51 ibm4xx_memstart = reg[1];
53 /* othersize, read it from the SDRAM controller */
54 ibm4xx_sdram_fixup_memsize();
57 static void *iss_4xx_vmlinux_alloc(unsigned long size)
59 return (void *)ibm4xx_memstart;
62 #define SPRN_PIR 0x11E /* Processor Identification Register */
63 void platform_init(void)
65 unsigned long end_of_ram = 0x08000000;
66 unsigned long avail_ram = end_of_ram - (unsigned long)_end;
69 simple_alloc_init(_end, avail_ram, 128, 64);
70 platform_ops.fixups = iss_4xx_fixups;
71 platform_ops.vmlinux_alloc = iss_4xx_vmlinux_alloc;
72 platform_ops.exit = ibm44x_dbcr_reset;
73 pir_reg = mfspr(SPRN_PIR);
74 fdt_set_boot_cpuid_phys(_dtb_start, pir_reg);
76 serial_console_init();